@nativescript/firebase-in-app-messaging
Version:
NativeScript Firebase - In App Messaging
50 lines • 1.5 kB
JavaScript
import { firebase, FirebaseApp } from '@nativescript/firebase-core';
let defaultInAppMessaging;
const fb = firebase();
Object.defineProperty(fb, 'inAppMessaging', {
value: () => {
if (!defaultInAppMessaging) {
defaultInAppMessaging = new InAppMessaging();
}
return defaultInAppMessaging;
},
writable: false,
});
export class InAppMessaging {
constructor() {
if (defaultInAppMessaging) {
return defaultInAppMessaging;
}
defaultInAppMessaging = this;
this._native = com.google.firebase.inappmessaging.FirebaseInAppMessaging.getInstance();
}
get isAutomaticDataCollectionEnabled() {
return this.native.isAutomaticDataCollectionEnabled();
}
set isAutomaticDataCollectionEnabled(value) {
this.native.setAutomaticDataCollectionEnabled(value);
}
get isMessagesDisplaySuppressed() {
return this.native.areMessagesSuppressed();
}
set isMessagesDisplaySuppressed(value) {
this.native.setMessagesSuppressed(java.lang.Boolean.valueOf(value));
}
triggerEvent(eventId) {
this.native.triggerEvent(eventId);
}
get native() {
return this._native;
}
get android() {
return this.native;
}
get app() {
if (!this._app) {
// @ts-ignore
this._app = FirebaseApp.fromNative(this.native.app);
}
return this._app;
}
}
//# sourceMappingURL=index.android.js.map