-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overlay HUD + Alert #454
Overlay HUD + Alert #454
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite neat, a good solution.
left some comments for clarification.
Sources/Core/FeaturePrelude/Banner/BannerClient+Interface.swift
Outdated
Show resolved
Hide resolved
Sources/Core/FeaturePrelude/Banner/BannerClient+Interface.swift
Outdated
Show resolved
Hide resolved
290ec68
to
4fde957
Compare
383a7b9
to
05688f5
Compare
4fde957
to
dcd66b0
Compare
05688f5
to
3e6ac1a
Compare
e8055fb
to
6e87f8b
Compare
3e6ac1a
to
ffbafbc
Compare
535caf5
to
5e12956
Compare
ffbafbc
to
44b43da
Compare
5e12956
to
5d50ea4
Compare
44b43da
to
8f60e53
Compare
Sources/Core/FeaturePrelude/Banner/BannerClient+Interface.swift
Outdated
Show resolved
Hide resolved
This is very important and useful functionality, but I think it should be implemented differently. First of all I don't think it's desirable that the view controller is responsible for dismissing itself through animation completions. Architecturally it makes sense for the client to handle this, especially when we start considering a queue of notifications of different types, including errors. This also removes any reason to keep this in UIKit. When the client is in charge, this can easily be done in SwiftUI. Starting out it can just be a transition, later, with a queue, we might need to look at TimeLineView. |
a80a68b
to
1513860
Compare
55a0fea
to
5fa8839
Compare
1513860
to
865d938
Compare
865d938
to
995189e
Compare
Agreed, and that's how it is implemented - view controller is not dismissing itself. If you take closer look at the code, Currently it simply removes the window used for presentation. I would expand this feature further so the client actually encapsulates an array of notifications, each notification contains presentation animation type, which is propagated one by one to the child, implemented in UIKit or SwiftUI, whatever gives better result overall. Each notification has unique ID, and upon animation completion relevant notification element is removed from the notification queue. When there's nothing left in the queue, the client removes the presentation window. So we would have to think a bit what do we want to display, how do we want that to look, and how do we interact with it. This is out of scope of this PR, and more importantly it's not something that would make the current implementation irrelevant.
The client is already in charge, it doesn't have anything to do with UI framework. |
Blocked by #450 |
This is what I'm referring to. I didn't mean that it physically removes itself. |
Dismissal of banner view (the child) is separate from dismissal of the parent (view controller) which is controlled by the client. It's pretty standard parent - child relationship. How would you design this feature? |
Like I wrote above, I think it's fine to have a view model/reducer control this, especially when the time comes to present a queue of notifications, some of which may be errors, and they may have different priorities. Then it will no longer be reasonable to listen to animation completions, it has to be centrally controlled. But it sounds like your argument against SwiftUI is that you want to use animation completions. |
5c8a190
to
04fc27f
Compare
|
||
// MARK: - OverlayWindowClient | ||
/// This client is the intermediary between Main Window and the Overlay Window. | ||
public struct OverlayWindowClient: Sendable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need a better name than Overlay...
, couldn't make something better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe Foreground
?
Sources/Clients/OverlayWindowClient/OverlayWindowClient+Interface.swift
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,13 @@ | |||
import UIKit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if canImport(UIKit)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me double check if it actually is needed, was brought in from the old implementation.
), | ||
then: { HUD.View(store: $0) } | ||
) | ||
.task { viewStore.send(.task) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await .... finish()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This task is never meant to finish, the OverlayView is always shown, never ever dismissed.
Sources/Clients/OverlayWindowClient/OverlayWindowClient+Interface.swift
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,33 @@ | |||
import SwiftUI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if canImport(UIKit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff and a lot of good code 👌
Let me know what do you think about the suggestions that I raised in comments though 🙏
Sources/Clients/OverlayWindowClientLive/OverlayWindowClient+Live.swift
Outdated
Show resolved
Hide resolved
Sources/Core/FeaturePrelude/AnimationCompletionViewModifier.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I'm particularly happy aboyt that one 🎉
I left you a small comment, cause it seems that the unsafe subscript is still there.
Issue: https://radixdlt.atlassian.net/browse/ABW-1151
The base for showing HUD and Alerts in single/centralised place.
Copied
HUD anytime something is copied.RPReplay_Final1688027790.MP4