forked from NativeScript/firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ios.ts
62 lines (52 loc) · 1.34 KB
/
index.ios.ts
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { firebase, FirebaseApp } from '@nativescript/firebase-core';
import { IInAppMessaging } from './common';
let defaultInAppMessaging: InAppMessaging;
const fb = firebase();
Object.defineProperty(fb, 'inAppMessaging', {
value: () => {
if (!defaultInAppMessaging) {
defaultInAppMessaging = new InAppMessaging();
}
return defaultInAppMessaging;
},
writable: false,
});
export class InAppMessaging implements IInAppMessaging {
_native: FIRInAppMessaging;
_app: FirebaseApp;
constructor() {
if (defaultInAppMessaging) {
return defaultInAppMessaging;
}
defaultInAppMessaging = this;
this._native = FIRInAppMessaging.inAppMessaging();
}
get isAutomaticDataCollectionEnabled(): boolean {
return this.native.automaticDataCollectionEnabled;
}
set isAutomaticDataCollectionEnabled(value) {
this.native.automaticDataCollectionEnabled = value;
}
get isMessagesDisplaySuppressed(): boolean {
return this.native.messageDisplaySuppressed;
}
set isMessagesDisplaySuppressed(value) {
this.native.messageDisplaySuppressed = value;
}
triggerEvent(eventId: string) {
this.native.triggerEvent(eventId);
}
get native() {
return this._native;
}
get ios() {
return this.native;
}
get app(): FirebaseApp {
if (!this._app) {
// @ts-ignore
this._app = FirebaseApp.fromNative(this.native.app);
}
return this._app;
}
}