Coder Social home page Coder Social logo

Comments (10)

vamsii777 avatar vamsii777 commented on July 18, 2024 1

Yes, I will follow your instructions by replicating the issue on a clean sample project and will attach it.

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024 1

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.

LeoNatan avatar LeoNatan commented on July 18, 2024 1

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.

LeoNatan avatar LeoNatan commented on July 18, 2024 1

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.

LeoNatan avatar LeoNatan commented on July 18, 2024 1

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.

LeoNatan avatar LeoNatan commented on July 18, 2024

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.

LeoNatan avatar LeoNatan commented on July 18, 2024

Ping.

Thanks

from lnpopupui.

vamsii777 avatar vamsii777 commented on July 18, 2024

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.

LeoNatan avatar LeoNatan commented on July 18, 2024

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.

vamsii777 avatar vamsii777 commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.