mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(ios delegate) Eliminate crash on selector looking for "Window" (#6428)
* Add a "window" value so that NS doesn't crash on selectors looking for the delegate.window... * chore: tslint * chore: comments to referenced issues added
This commit is contained in:
committed by
Alexander Vakrilov
parent
540b2b4f82
commit
19895945c2
@@ -21,9 +21,20 @@ import { Frame, NavigationEntry } from "../ui/frame";
|
||||
import * as utils from "../utils/utils";
|
||||
import { profile, level as profilingLevel, Level } from "../profiling";
|
||||
|
||||
class Responder extends UIResponder {
|
||||
//
|
||||
}
|
||||
// NOTE: UIResponder with implementation of window - related to https://github.com/NativeScript/ios-runtime/issues/430
|
||||
// TODO: Refactor the UIResponder to use Typescript extends when this issue is resolved:
|
||||
// https://github.com/NativeScript/ios-runtime/issues/1012
|
||||
var Responder = (<any>UIResponder).extend({
|
||||
get window() {
|
||||
return iosApp ? iosApp.window : undefined;
|
||||
},
|
||||
set window(setWindow) {
|
||||
// NOOP
|
||||
}
|
||||
}, {
|
||||
protocols: [UIApplicationDelegate]
|
||||
}
|
||||
);
|
||||
|
||||
class NotificationObserver extends NSObject {
|
||||
private _onReceiveCallback: (notification: NSNotification) => void;
|
||||
@@ -150,7 +161,7 @@ class IOSApplication implements IOSApplicationDefinition {
|
||||
this.setWindowContent(args.root);
|
||||
} else {
|
||||
this._window = UIApplication.sharedApplication.delegate.window;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@profile
|
||||
@@ -368,4 +379,4 @@ global.__onLiveSync = function () {
|
||||
}
|
||||
|
||||
livesync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user