Comments (10)
Yes, I will follow your instructions by replicating the issue on a clean sample project and will attach it.
from lnpopupui.
Hello @vamsii777
I took a short look at the demo project. It's not a small one. While I haven't investigated the ins and outs of it, and I am afraid I won't be able to, I do find that my instinct was correct; it is a state management issue. For example, removing the isPopupOpen: $audioPlaybackViewModel.isPopupOpen
portion in ContentView.swift is enough to remove the issue (but might break your logic). I did notice, in your code you set isPopupOpen
in multiple places. What I suspect that might be happening is that the underlying framework, LNPopupController
, is not dealing with multiple changes in state as gracefully as it should, and something breaks. However, this is not a priority for the framework, and debugging these issues are very difficult, especially with a complex project as your example one. Before SwiftUI support was introduced with LNPopupUI, the LNPopupFramework framework considered state changes while transitioning to be user error. This was no longer possible in SwiftUI due to the nature of the beast, and I tried making everything as cancellable and reversible as possible, but it's not an easy task, and there seem to be some issues left.
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 onOpen
and onClose
to track the state of popup, and queue your state changes according to those, but, again, I do not suggest doing that (especially not in something like SwiftUI+LNPopupUI).
I will keep this issue open, but not sure if/when I will be able to improve it.
from lnpopupui.
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.
from lnpopupui.
Hello,
I released LNPopupController 2.18.0 yesterday, which includes what we discussed before. Please update your dependencies, and try it out.
Thanks
from lnpopupui.
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.
from lnpopupui.
Hello,
This looks like a user state management bug. Please try to reproduce the issue on a clean example project (or the included one with this repo) and attach here.
Thanks
from lnpopupui.
Ping.
Thanks
from lnpopupui.
Hey @LeoNatan,
Attached is an example project LNPopupNetworkExample.zip
demonstrating the issue where dragging down the popup while playing on network audio stream causes it to vanish unexpectedly.
Thank you for looking into this.
from lnpopupui.
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.mp4
That'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).
from lnpopupui.
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.
from lnpopupui.
Related Issues (20)
- Change color of now playing bar background HOT 5
- popup bar and popup content can get stuck in wrong position when dismissing a modal sheet with the keyboard in a transitory state HOT 20
- iOS 15.2 has broken safe area insets under some conditions HOT 1
- LNPopupController: The popup controller is already in transition. Will ignore this transition request. HOT 2
- Using a custom view for the popup bar breaks presentation/dismiss animations HOT 4
- Run the example project HOT 1
- How to cooperate with withAnimation(...) when switching PopupOpen HOT 1
- After adding .popupBarStyle(.prominent) or .popupBarProgressViewStyle(.top) or .popupBarMarqueeScrollEnabled(true) to the View hierarchy, iOS keyboard will resign after single keypress HOT 3
- Possible regression between 1.4.0 and 1.4.1 in popupBarItems HOT 4
- Can't build test target while using LNPopupUI HOT 5
- Gesture Conflict HOT 3
- Interaction Style issues HOT 5
- Popover's background Scale Effect HOT 1
- Making isBarPresented = true, while its animating closed when set to false causes the popup to become bugged until open/closed again HOT 12
- Make popup image nullable
- Updating popup content while popup is closing causes popup to get stuck in a loop of closing and opening endlessly. HOT 6
- popupBarCustomView produces too much padding HOT 2
- Inconsistent Scrolling in PopupView HOT 2
- Limiting dragging area HOT 23
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lnpopupui.