Closed SethForsgren closed 3 years ago
There was a bug in 8.0.4 that could cause this issue. What version are you on? #444
thanks for the quick reply. I'm running 9.0.0 currently.
I'll try and take a look at any differences between 8.0.4 and 8.0.5 perhaps. Lmk if other details could help debug.
I created a test app that demonstrates this issue: https://github.com/SethForsgren/SM-testing
It has 2 buttons on the main screen:
When tapping "Show Message Once" => message always appears
When tapping "Show Message Once, and again in 3 seconds" => if you dismiss the first message within 3 seconds by tapping on it or dragging it away, then the second message does not present on screen. If you don't interact with the first message, then the second one will appear.
Ideally both messages will show whenever tapping "Show Message Once, and again in 3 seconds"
An interesting finding is that if the user taps anywhere on the app screen after dismissing the first message, then the subsequent message will show. The subsequent message is missed if the user interacts with the first message, and then does nothing on the app until the subsequent message is supposed to show up.
One more note in case it helps, I went ahead and tried that sample app with previous versions of SwiftMessages below. The app builds and reproduces the same issue with each.
9.0.0
Commit: 4408c09c863b1c6af4d053fe17fd532a4f96b237
8.0.5
Commit: 243fa7596818e3a96a7f0563453b3f35a674a5fb
8.0.4
Commit: f7297cc4e9acfaf6710cada80a396d58ff8de5b3
Thanks for making this so easy to troubleshoot. Could you try out the branch work/9.0.1
?
Basically, in cases where the message is displayed in a separate window, that window may become the key window, like if you interact with it. iOS doesn't automatically restore the previous key window when you dismiss the message. So, the WindowViewController
class in SM tries to automatically restore the key window for you, but that logic wasn't particularly robust. Hopefully my fix covers all of the cases.
That branch works perfectly, thank you for the quick update!
I will use that work/9.0.1 branch now unless you want to merge it into main.
For reference, I swapped 9.0.0 for work/9.0.1 commit: eeb685398f4cea6f8c54e63bd87a0d81393cc515
Don't merge into main
. I have a major 10.0.0 under development on main
(forgot to put it on a work branch).
I'll release a 9.0.1 patch after I get chance to see if there are any other small changes I need to get in.
Sounds good. I will keep an eye out for the patch.
9.0.1 is released
I'm using SwiftMessages to alert the user to a new message from a coworker. The code below is called each time a user receives a notification. It works great until the user interacts with the SwiftMessage. Once they either tap on it, or dismiss it by dragging it up, then no more SwiftMessages are presented until the user navigates to a different view within our app itself.
I'd like new SwiftMessages to keep showing up even if the user dismisses or taps on one in their current view. Any ideas on how to achieve this?
How I'm calling show() currently: