feat: delay the launch event until the app becomes active

This commit is contained in:
Eduardo Speroni
2022-05-11 16:06:39 -03:00
parent a7d99be025
commit 9a81cd76b0

View File

@@ -77,6 +77,7 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication
private _window: UIWindow;
private _notificationObservers: NotificationObserver[] = [];
private _rootView: View;
private launchEventCalled = false;
displayedOnce = false;
displayedLinkTarget: CADisplayLinkTarget;
@@ -314,6 +315,7 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication
}
private notifyAppStarted(notification?: NSNotification) {
this.launchEventCalled = true;
const root = this.notifyLaunch({
ios: notification?.userInfo?.objectForKey('UIApplicationLaunchOptionsLocalNotificationKey') ?? null,
});
@@ -369,11 +371,14 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication
// TODO: Expose Window module so that it can we styled from XML & CSS
this._window.backgroundColor = Utils.ios.MajorVersion <= 12 || !UIColor.systemBackgroundColor ? UIColor.whiteColor : UIColor.systemBackgroundColor;
this.notifyAppStarted(notification);
this.launchEventCalled = false;
}
@profile
private didBecomeActive(notification: NSNotification) {
if (!this.launchEventCalled) {
this.notifyAppStarted(notification);
}
const additionalData = {
ios: UIApplication.sharedApplication,
};