-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapp.ts
More file actions
37 lines (28 loc) · 1.18 KB
/
Copy pathapp.ts
File metadata and controls
37 lines (28 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Application } from '@nativescript/core';
if (global.isIOS) {
@NativeClass()
class MyLoggerDelegateImpl extends NSObject implements GCKLoggerDelegate {
static ObjCProtocols = [GCKLoggerDelegate];
static new(): MyLoggerDelegateImpl {
return <MyLoggerDelegateImpl>super.new();
}
logMessageFromFunction(message, fromFunction) {
console.log(message, fromFunction);
}
}
@NativeClass()
class MyDelegate extends UIResponder implements UIApplicationDelegate {
public static ObjCProtocols = [UIApplicationDelegate, GCKLoggerDelegate];
applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<string, any>): boolean {
const appId = NSBundle.mainBundle.objectForInfoDictionaryKey('AppID');
const castOptions = GCKCastOptions.alloc().initWithReceiverApplicationID(appId);
GCKCastContext.setSharedInstanceWithOptions(castOptions);
// Optional logger
const delegate: MyLoggerDelegateImpl = MyLoggerDelegateImpl.new();
GCKLogger.sharedInstance().delegate = delegate;
return true;
}
}
Application.ios.delegate = MyDelegate;
}
Application.run({ moduleName: 'app-root' });