Skip to content

Commit 9a81cd7

Browse files
committed
feat: delay the launch event until the app becomes active
1 parent a7d99be commit 9a81cd7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/core/application/application.ios.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication
7777
private _window: UIWindow;
7878
private _notificationObservers: NotificationObserver[] = [];
7979
private _rootView: View;
80+
private launchEventCalled = false;
8081

8182
displayedOnce = false;
8283
displayedLinkTarget: CADisplayLinkTarget;
@@ -314,6 +315,7 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication
314315
}
315316

316317
private notifyAppStarted(notification?: NSNotification) {
318+
this.launchEventCalled = true;
317319
const root = this.notifyLaunch({
318320
ios: notification?.userInfo?.objectForKey('UIApplicationLaunchOptionsLocalNotificationKey') ?? null,
319321
});
@@ -369,11 +371,14 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication
369371
// TODO: Expose Window module so that it can we styled from XML & CSS
370372
this._window.backgroundColor = Utils.ios.MajorVersion <= 12 || !UIColor.systemBackgroundColor ? UIColor.whiteColor : UIColor.systemBackgroundColor;
371373

372-
this.notifyAppStarted(notification);
374+
this.launchEventCalled = false;
373375
}
374376

375377
@profile
376378
private didBecomeActive(notification: NSNotification) {
379+
if (!this.launchEventCalled) {
380+
this.notifyAppStarted(notification);
381+
}
377382
const additionalData = {
378383
ios: UIApplication.sharedApplication,
379384
};

0 commit comments

Comments
 (0)