Skip to content

Commit 4888e9c

Browse files
committed
feat: delay the launch event until the app becomes active
1 parent eb4c4a3 commit 4888e9c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/application/index.ios.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export class iOSApplication implements iOSApplicationDefinition {
136136
private _orientation: 'portrait' | 'landscape' | 'unknown';
137137
private _rootView: View;
138138
private _systemAppearance: 'light' | 'dark';
139+
private launchEventCalled = false;
139140

140141
constructor() {
141142
this._observers = new Array<NotificationObserver>();
@@ -222,11 +223,11 @@ export class iOSApplication implements iOSApplicationDefinition {
222223
this._window = UIWindow.alloc().initWithFrame(UIScreen.mainScreen.bounds);
223224
// TODO: Expose Window module so that it can we styled from XML & CSS
224225
this._window.backgroundColor = this._backgroundColor;
225-
226-
this.notifyAppStarted(notification);
226+
this.launchEventCalled = false;
227227
}
228228

229229
public notifyAppStarted(notification?: NSNotification) {
230+
this.launchEventCalled = true;
230231
const args: LaunchEventData = {
231232
eventName: launchEvent,
232233
object: this,
@@ -252,6 +253,9 @@ export class iOSApplication implements iOSApplicationDefinition {
252253

253254
@profile
254255
private didBecomeActive(notification: NSNotification) {
256+
if (!this.launchEventCalled) {
257+
this.notifyAppStarted(notification);
258+
}
255259
const ios = UIApplication.sharedApplication;
256260
const object = this;
257261
notify(<ApplicationEventData>{ eventName: resumeEvent, object, ios });

0 commit comments

Comments
 (0)