-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
State management breaks on quick opening/closing of the popup #29
Comments
Hello, |
Ping. Thanks |
Yes, I will follow your instructions by replicating the issue on a clean sample project and will attach it. |
Hey @LeoNatan, Attached is an example project LNPopupNetworkExample.zip Thank you for looking into this. |
Hello @vamsii777 I suggest leaving the popup open/close to the user, and at most, closing the popup when your playback ends. But it seems to me, at least from a cursory look, that you set it to closed and then open multiple times in very short times, creating the issue. If you must, use the I will keep this issue open, but not sure if/when I will be able to improve it. |
So, I've been looking at how SwiftUI solves UIKit transitions, because it seems UIKit has the same issues as LNPopupController. For example, attempting to present and dismiss a view controller right away causes a crash. Yet, in SwiftUI, the system finishes the presentation and then dismisses. So that gave me an idea to implement a similar queueing system in LNPopupController (and thus in LNPopupUI). For example, the following code: - (void)_start
{
__weak __typeof(self) weakSelf = self;
[self _firstContentController];
[self _presentBar];
[self _dismissBar];
[self _presentBar];
[self _dismissBar];
[self _presentBar];
[self _openPopup];
[self _secondContentController];
[self _presentBar];
[self _dismissBar];
[self _presentBarAndOpen];
[self _closePopup];
[self _openPopup];
[self _dismissBarCompletionHandler:^{
[weakSelf _afterSecond:^{
[weakSelf _start];
}];
}];
} creates the following behavior: Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2023-12-24.at.23.53.24.mp4That's not to say that this solves your issue, because if your code remains as it is, your users will see a lot of transitions they shouldn't, but I am happy with this result as a stop gap between nothing (current implementation) and a complete interruptibility (which I also tried, but so far haven't had a satisfactory result). |
Acknowledged the recent developments and insights on the state management issue with LNPopupController. The proposed queueing system, inspired by SwiftUI's handling of UIKit transitions, seems like a strategic solution to address the rapid state changes and their impact on rendering. This approach could provide a more stable and consistent user experience, effectively resolving the visual anomalies observed during popup interactions. Eager to see how this implementation enhances the framework's robustness in upcoming releases. |
I hope to release a new version soon. Want to test locally to try and catch any regressions that might have been introduced. Nothing so far. |
Hello, |
Hello, when investigating #31 (which was a similar issue to this), I added an improvement on top of the previous release, which now makes things much better. Please try it out. |
Describe the Bug:
When interacting with the LNPopupUI in my SwiftUI application, specifically when the audio is playing and I either drag down the popup or click the close button on the popup, the tab view and popup view turn black. The audio continues to play as expected, but the visual elements of the popup and tab view do not render correctly.
To Reproduce:
Steps to reproduce the behavior:
Expected Behavior:
The popup and tab view should maintain their proper visual appearance when interacted with, without turning black, while allowing the audio to continue playing.
Screenshots:
RPReplay_Final1702224398.MP4
Additional Context:
Environment:
The text was updated successfully, but these errors were encountered: