-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fixes an issue where app hangs on startup with both Unity notifications and Firebase in the project #130
Conversation
…ns and Firebase in the project
…ns and Firebase in the project
…ty-Technologies/com.unity.mobile.notifications into fix-ios-hang-on-app-relaunch # Conflicts: # com.unity.mobile.notifications/Runtime/iOS/Plugins/UnityNotificationManager.m
…ns and Firebase in the project
…ty-Technologies/com.unity.mobile.notifications into fix-ios-hang-on-app-relaunch
After discussions with Alexey, it was noted that setting the delegate in load is a bad bad idea. https://developer.apple.com/documentation/objectivec/nsobject/1418815-load?language=objc Adding them to the PR |
Sorry for the git mess, GUI client... When squashed it will be sensible. |
@vaidasma after the changes the concerning points are push notifications and app launch by clicking the notification. By changing the place when we set the delegate we risk losing info about notifications delivered while app was in background (or killed entirely) and not receiving information about the notification that was used to launch it. |
if that change results in issues or we worry about resulting in the issues - should we try +initialize ? this happens when app runtime is fully setup |
|
And in order to allow UaaL to function correctly, I have decided to have the notifications init on the broadcast of kUnityWillFinishLaunchingWithOptions. When launching an app, the AppDelegate's methods are called and then the notification posted shortly afterward, we cannot guarantee the timing of the native lifecycle notifications, but we always post kUnityWillFinishLaunchingWithOptions from the AppDelegate. This could guarantee that the notification stuff is set up late enough not to cause locks and early enough not to miss notifications. This would also be a good thing to document to all plugin writers as a good place to init your plugin? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified as fixed:
• No longer crashes upon killing the app and launching again (with FIrebase used in the project)
• Application does not demonstrate any unwanted behavior when putting it to background/foreground, locking/unlocking
• Notifications Authorization is successful
• Local/push notifications are received
Tested with Notification projects merged into the user's project from Fogbugz
Device used: iPhone 12 (OS:15.2)
Note: during testing, it has been noticed that authorization on launch no longer works. Unrelated to the current fix.
@vaidasma after the changes the concerning points are push notifications and app launch by clicking the notification. By changing the place when we set the delegate we risk losing info about notifications delivered while app was in background (or killed entirely) and not receiving information about the notification that was used to launch it. |
Above issue by design: caused by "Provisional" flag in Default Notification Authorization Settings |
When the fix will become available in Unity Package Manager? |
https://fogbugz.unity3d.com/f/cases/1375744/
We need to move the setting of a delegate out of the load method in order to fix the above case.