mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat: delay the launch event until the app becomes active
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user