33 <ActionBar title =" Firebase Vue demo" ></ActionBar >
44
55 <StackLayout >
6- <!-- <Button @tap="onTapHasPermission" class="btn" text="Has Permission?"></Button>-->
7- <!-- <Button @tap="onTapScheduleNotification" class="btn" text="Schedule Notification"></Button>-->
8- <!-- <Button @tap="onTapCancelAll" class="btn" text="Cancel notifications"></Button>-->
96 <Label class =" message" :text =" message" textWrap =" true" horizontalAlignment =" center" ></Label >
10- <!-- MLKitTextRecognition width="260"
11- height="340"
12- processEveryNthFrame="5"
13- @scanResult="onTextRecognitionResult">
14- </MLKitTextRecognition-->
15-
167 </StackLayout >
8+
179 </Page >
1810</template >
1911
2012<script >
21- const firebase = require (" nativescript-plugin-firebase" );
2213 import { inappmessaging } from " nativescript-plugin-firebase/inappmessaging" ;
2314
2415 export default {
3122 created () {
3223 // wire up an 'onMessageClicked' callback
3324 inappmessaging .onMessageClicked (message => {
34- console .log (" >> inappmessaging onMessageClicked, campaign: " + message .campaignName + " , with url: " + message .actionURL );
3525 this .message = ` Campaign ${ message .campaignName } clicked` ;
3626 });
3727
3828 // 👉 .. and for fun, wire an 'onMessageImpression' callback so when know when the message is shown
3929 inappmessaging .onMessageImpression (message => {
40- console .log (" >> inappmessaging onMessageImpression, campaign: " + message .campaignName );
4130 this .message = ` Campaign ${ message .campaignName } seen` ;
4231 });
43- },
44-
45- methods: {
46- onTextRecognitionResult () {
47- console .log (" onTextRecognitionResult" );
48- }
49- /*
50- onTapHasPermission() {
51- LocalNotifications.hasPermission()
52- .then(granted => {
53- alert({
54- title: "Permission granted?",
55- message: granted ? "YES" : "NO",
56- okButtonText: "OK"
57- });
58- });
59- },
60-
61- onTapScheduleNotification() {
62- LocalNotifications.schedule(
63- [{
64- id: 1,
65- title: 'Would you like a Red Alert poster?',
66- subtitle: 'This poster is awesome!',
67- body: 'The big brown Vue app jumped over the lazy Angular app. The big brown Vue app jumped over the lazy Angular app. The big brown Vue app jumped over the lazy Angular app. The big brown Vue app jumped over the lazy Angular app.',
68- bigTextStyle: false, // Allow more than 1 row of the 'body' text on Android, but setting this to true denies showing the 'image'
69- color: new Color("green"),
70- image: "https://images-na.ssl-images-amazon.com/images/I/61mx-VbrS0L.jpg",
71- thumbnail: "https://2.bp.blogspot.com/-H_SZ3nAmNsI/VrJeARpbuSI/AAAAAAAABfc/szsV7_F609k/s200/emoji.jpg",
72- forceShowWhenInForeground: true,
73- channel: "vue-channel",
74- ticker: "Special ticker text for Vue (Android only)",
75- at: new Date(new Date().getTime() + (5 * 1000)), // 5 seconds from now
76- actions: [
77- {
78- id: "yes",
79- type: "button",
80- title: "Yes (and launch app)",
81- launch: true
82- },
83- {
84- id: "no",
85- type: "button",
86- title: "No",
87- launch: false
88- }
89- ]
90- }])
91- .then(() => {
92- alert({
93- title: "Notification scheduled",
94- message: "ID: 1",
95- okButtonText: "OK, thanks"
96- });
97- })
98- .catch(error => console.log("doSchedule error: " + error));
99- },
100-
101- onTapCancelAll() {
102- LocalNotifications.cancelAll()
103- .then(() => {
104- alert({
105- title: "All canceled",
106- okButtonText: "Awesome!"
107- });
108- })
109- .catch(error => console.log("doCancelAll error: " + error));
110- }
111- */
11232 }
11333 }
11434 </script >
12444 margin : 17 ;
12545 color : #53ba82 ;
12646 }
127-
128- Button .btn {
129- font-size : 14 ;
130- border-radius : 3 ;
131- border-width : 2 ;
132- border-color : #63d4a5 ;
133- color : #63d4a5 ;
134- padding : 12 ;
135- margin : 16 ;
136- }
137- </style >
47+ </style >
0 commit comments