Giter VIP home page Giter VIP logo

Comments (16)

wtmoose avatar wtmoose commented on June 5, 2024 1

@wangchaodong I see. With config.presentationContext = .window(windowLevel: .normal), I would say that SwiftMessages is working as designed. The global SwiftMessages instance has no way of knowing your intentions, so it would not dismiss the message on your behalf. What you can do is use a local SwiftMessages instance in your view controller. When it gets deinited, it will automatically dismiss.

See here:

SwiftMessagesTest#516.zip

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

This isn't a problem other people are having, so my initial guess is you're doing something unusual in your code. However, since I don't have your code, there's not much I can do. Is there any way you could attach a sample project that reproduces the problem?

Otherwise, I can help you step through the SwiftMessages code on your end to understand what is happening. My first suggestion is to put a break point on line 607 of SwiftMessages.swift:

try current.show { completed in

If this line is not being reached, it means that SwiftMessages decided not to display your message, maybe due to de-duplication logic. Otherwise, something is going wrong with the view presentation in Presenter.swift. Either way, we should be able to step through the code and get to the line of code where something goes wrong.

Hope that helps.

from swiftmessages.

keshavgesu1 avatar keshavgesu1 commented on June 5, 2024

Okay Thank you for your reply. I will Check

from swiftmessages.

wangchaodong avatar wangchaodong commented on June 5, 2024

This isn't a problem other people are having, so my initial guess is you're doing something unusual in your code. However, since I don't have your code, there's not much I can do. Is there any way you could attach a sample project that reproduces the problem?

Otherwise, I can help you step through the SwiftMessages code on your end to understand what is happening. My first suggestion is to put a break point on line 607 of SwiftMessages.swift:

try current.show { completed in

If this line is not being reached, it means that SwiftMessages decided not to display your message, maybe due to de-duplication logic. Otherwise, something is going wrong with the view presentation in Presenter.swift. Either way, we should be able to step through the code and get to the line of code where something goes wrong.

Hope that helps.

I got the same issue here.
the first time I call SwiftMessages.show to show a view, it works perfectly,
After I hide this view with SwiftMessages.hideAll(), I change the rootViewController of the Window. and then I go back to call SwiftMessages.show to show my view, it does't work.

I had try with config.ignoreDuplicates = false , it does't work.

20230429-123653
I debug and found that the self._current == nil is false. I'm not sure how to figure out.

from swiftmessages.

wangchaodong avatar wangchaodong commented on June 5, 2024

This isn't a problem other people are having, so my initial guess is you're doing something unusual in your code. However, since I don't have your code, there's not much I can do. Is there any way you could attach a sample project that reproduces the problem?
Otherwise, I can help you step through the SwiftMessages code on your end to understand what is happening. My first suggestion is to put a break point on line 607 of SwiftMessages.swift:

try current.show { completed in

If this line is not being reached, it means that SwiftMessages decided not to display your message, maybe due to de-duplication logic. Otherwise, something is going wrong with the view presentation in Presenter.swift. Either way, we should be able to step through the code and get to the line of code where something goes wrong.
Hope that helps.

I got the same issue here. the first time I call SwiftMessages.show to show a view, it works perfectly, After I hide this view with SwiftMessages.hideAll(), I change the rootViewController of the Window. and then I go back to call SwiftMessages.show to show my view, it does't work.

I had try with config.ignoreDuplicates = false , it does't work.

20230429-123653 I debug and found that the self._current == nil is false. I'm not sure how to figure out.

I found my bug and solve it, I didnot hidAll SwiftMessage show's view befour change the rootViewController of the Window, and the view show by SwiftMessage cannot see because rootVC of window changed, and that's need to be carefully. But after SwiftMessage hide all and then to change rootVC of window, SwiftMessage works well.

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

@wangchaodong you're right. Orphaned message views can block the queue. This can happen if you remove the view hierarchy before the message is hidden. It is uncommon and hasn't come up in a long time, so I'd forgotten about it. I put together a PR that attempts to prevent orphaned message views from blocking the queue.

@wangchaodong @keshavgesu1 please try the changes in #517 and let me know if it resolves the issue.

from swiftmessages.

wangchaodong avatar wangchaodong commented on June 5, 2024

I had try with #517, and it work no different with master branch.
if I did not hide swiftmessage shows view before I change rootVC of Window, it still not work.
I think you should catch it in a demo. easily show a swiftmessage view, and the change rootVC of Window, and try show swiftmessage view again. hope it can help you.

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

@wangchaodong well, I think it makes more sense for you to supply a sample project since you are the one experiencing the issue and I only have a vague description of the steps. In any case, I put one together that replaces the root view controller and it is working correctly. Maybe you could modify this project to reproduce your issue?

SwiftMessagesTest#516.zip

from swiftmessages.

wangchaodong avatar wangchaodong commented on June 5, 2024

@wangchaodong well, I think it makes more sense for you to supply a sample project since you are the one experiencing the issue and I only have a vague description of the steps. In any case, I put one together that replaces the root view controller and it is working correctly. Maybe you could modify this project to reproduce your issue?

SwiftMessagesTest#516.zip

In your demo, it works, but not such perfect.
In my project , my presentationContext is set to .window, So I try to replace
config.presentationContext = .viewController(self)
with
config.presentationContext = .window(windowLevel: .normal)

and then the cardView will not hide. So maybe that's the point you need to take care.
hope it can help you.

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

Closing due to no response from OP

from swiftmessages.

veeranfmq avatar veeranfmq commented on June 5, 2024

Hi, I am getting the same issue after updating the pods, Swift message with configuration is in the memory, however, not showing, Attaching a screenshot, and this is also happening after changing the root view controller.

Basically, the swift message window is beneath the UIWindow

SwiftMessageIssue

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

Hi, I am getting the same issue after updating the pods, Swift message with configuration is in the memory, however, not showing, Attaching a screenshot, and this is also happening after changing the root view controller.

Basically, the swift message window is beneath the UIWindow

SwiftMessageIssue

Is my above reply missing something?

from swiftmessages.

veeranfmq avatar veeranfmq commented on June 5, 2024

Yes, it is not mentioned why on changing root vc the presenter is not showing. it's hiding beneath the window, please check above attached screenshot.

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

You have to hide the message before changing the root view controller

from swiftmessages.

veeranfmq avatar veeranfmq commented on June 5, 2024

Yes I am hiding the message

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

This isn't a normal issue and I don't quite understand what you're doing to get into this state. I need detailed reproduction steps or a sample project. Maybe you could take the sample project I attached above modify it to reproduce your issue?

from swiftmessages.

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.