From 9a81cd76b0931810b2007e02b0bfa3540b31906c Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Wed, 11 May 2022 16:06:39 -0300 Subject: [PATCH] feat: delay the launch event until the app becomes active --- packages/core/application/application.ios.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/application/application.ios.ts b/packages/core/application/application.ios.ts index 1a61b7a979..9d4239787d 100644 --- a/packages/core/application/application.ios.ts +++ b/packages/core/application/application.ios.ts @@ -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, };