|
6 | 6 | <!--<Button @tap="onTapHasPermission" class="btn" text="Has Permission?"></Button>--> |
7 | 7 | <!--<Button @tap="onTapScheduleNotification" class="btn" text="Schedule Notification"></Button>--> |
8 | 8 | <!--<Button @tap="onTapCancelAll" class="btn" text="Cancel notifications"></Button>--> |
9 | | - <Label class="message" :text="message" textWrap="true"></Label> |
10 | | - <MLKitTextRecognition width="260" |
| 9 | + <Label class="message" :text="message" textWrap="true" horizontalAlignment="center"></Label> |
| 10 | + <!--MLKitTextRecognition width="260" |
11 | 11 | height="340" |
12 | 12 | processEveryNthFrame="5" |
13 | 13 | @scanResult="onTextRecognitionResult"> |
14 | | - </MLKitTextRecognition> |
| 14 | + </MLKitTextRecognition--> |
15 | 15 |
|
16 | 16 | </StackLayout> |
17 | 17 | </Page> |
18 | 18 | </template> |
19 | 19 |
|
20 | 20 | <script> |
21 | 21 | const firebase = require("nativescript-plugin-firebase"); |
22 | | -
|
23 | | - firebase.init({ |
24 | | - onDynamicLinkCallback: function (result) { |
25 | | - console.log("Dynamic Link received: " + result); |
26 | | - console.log("Dynamic Link received, url: " + result.url); |
27 | | - if (result.url.indexOf("/campaigns/shit") > -1) { |
28 | | - // note that you could deeplink/route the user now, but let's just show an alert |
29 | | - alert({ |
30 | | - title: "Campaign button tapped!", |
31 | | - message: "You tapped the button in the 'Firebase is the 💩' campaign - well don!", |
32 | | - okButtonText: "Yep!" |
33 | | - }) |
34 | | - } |
35 | | - } |
36 | | - }).then(function () { |
37 | | - console.log("Firebase initialized"); |
38 | | - }).catch(function (error) { |
39 | | - console.log("Error initializing Firebase: " + error); |
40 | | - }); |
| 22 | + import { inappmessaging } from "nativescript-plugin-firebase/inappmessaging"; |
41 | 23 |
|
42 | 24 | export default { |
43 | 25 | data() { |
44 | 26 | return { |
45 | | - message: "Tap a button above.." |
| 27 | + message: "Fear not, young Skywalker" |
46 | 28 | } |
47 | 29 | }, |
48 | 30 |
|
| 31 | + created() { |
| 32 | + // wire up an 'onMessageClicked' callback |
| 33 | + inappmessaging.onMessageClicked(message => { |
| 34 | + console.log(">> inappmessaging onMessageClicked, campaign: " + message.campaignName); |
| 35 | + this.message = `Campaign ${message.campaignName} clicked`; |
| 36 | + }); |
| 37 | +
|
| 38 | + // 👉 .. and for fun, wire an 'onMessageImpression' callback so when know when the message is shown |
| 39 | + inappmessaging.onMessageImpression(message => { |
| 40 | + console.log(">> inappmessaging onMessageImpression, campaign: " + message.campaignName); |
| 41 | + this.message = `Campaign ${message.campaignName} seen`; |
| 42 | + }); |
| 43 | + }, |
| 44 | +
|
49 | 45 | methods: { |
50 | 46 | onTextRecognitionResult() { |
51 | 47 | console.log("onTextRecognitionResult"); |
|
124 | 120 | } |
125 | 121 |
|
126 | 122 | .message { |
127 | | - font-size: 14; |
128 | | - margin: 16; |
| 123 | + font-size: 17; |
| 124 | + margin: 17; |
129 | 125 | color: #53ba82; |
130 | 126 | } |
131 | 127 |
|
|
0 commit comments