eft del"> - 10 src/views/Tab1Page.vue
Näytä tiedosto
@@ -72,7 +72,7 @@ import SearchEngine from '@/components/SearchEngine.vue'
72 72
 import { CapacitorHttp } from '@capacitor/core';
73 73
 import { ref } from 'vue';
74 74
 import { TOKEN, getProducts, setToken, getObject, getToken, getTrainers, listMats, storeAPNToken,
75
-getTodayProgs, getLive, getPosts, initAPI, clearPref, isLogin} from '@/composable/settings';
75
+getTodayProgs, getLive, getPosts, initAPI, clearPref, isLogin, getPref } from '@/composable/settings';
76 76
 //import VueCoreVideoPlayer from 'vue-core-video-player'
77 77
 import { vueVimeoPlayer } from 'vue-vimeo-player'
78 78
 
@@ -114,6 +114,7 @@ const options = {
114 114
       width: 640,
115 115
       loop: true
116 116
   };
117
+let myprofile = null;
117 118
  //const video = ref(null)
118 119
 
119 120
   //const player = new Player(video, options);
@@ -126,6 +127,10 @@ const modules =  [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
126 127
     if( v == false ) {
127 128
     ;
128 129
       //ionRouter.navigate('/tabs/tab4', 'forward', 'replace');
130
+    }else {
131
+    
132
+      myprofile = await getPref()
133
+      console.log("my profile ", myprofile);
129 134
     }
130 135
     //console.log("video " ,video)
131 136
     //console.log("video id", video.value.id)
@@ -161,10 +166,10 @@ const modules =  [Autoplay, Keyboard, Pagination, Scrollbar, Zoom]
161 166
     })
162 167
     console.log(" trainers => ", trainers)
163 168
 
164
-    GoogleAuth.initialize();
165
-    registerNotifications()
169
+    //GoogleAuth.initialize();
166 170
     addListeners()
167
-
171
+    registerNotifications()
172
+    
168 173
     getTodayProgs().then( (data) => {
169 174
       todays.value = data
170 175
     })
@@ -199,12 +204,6 @@ const addListeners = async () => {
199 204
   await PushNotifications.addListener('registration', token => {
200 205
     console.info('Registration token: ', token.value);
201 206
     storeAPNToken(token.value)
202
-    
203
-    FCM.subscribeTo({ topic: "TMT" })
204
-    .then((r) => {
205
-      console.log("subsribe to topic ", r)
206
-    })
207
-    .catch((err) => console.log(err));
208 207
   });
209 208
 
210 209
   await PushNotifications.addListener('registrationError', err => {
@@ -231,6 +230,34 @@ const registerNotifications = async () => {
231 230
     throw new Error('User denied permissions!');
232 231
   }
233 232
 
233
+    if( myprofile ) {
234
+      if( myprofile.live_noti == true ) {
235
+        FCM.subscribeTo({ topic: "LIVE" })
236
+        .then((r) => {
237
+          console.log("subsribe to topic ", r)
238
+        })
239
+        .catch((err) => console.log(err));
240
+      }else {
241
+        FCM.unsubscribeFrom({ topic: "LIVE" })
242
+        .then((r) => {
243
+          console.log("unsubsribe to topic ", r)
244
+        })
245
+        .catch((err) => console.log(err));
246
+      }
247
+      if( myprofile.news_noti == true ) {
248
+        FCM.subscribeTo({ topic: "NEWS" })
249
+        .then((r) => {
250
+          console.log("subsribe to topic ", r)
251
+        })
252
+        .catch((err) => console.log(err));
253
+      }else {
254
+        FCM.unsubscribeFrom({ topic: "NEWS" })
255
+        .then((r) => {
256
+          console.log("unsubsribe to topic ", r)
257
+        })
258
+        .catch((err) => console.log(err));
259
+      }
260
+    }
234 261
   await PushNotifications.register();
235 262
 }
236 263
 

BIN
tmt.keystore


tum/coi - Gogs: Simplico Git Service

暫無描述

tum 2399a43570 templates 1 年之前
..
static_src 2399a43570 templates 1 年之前
templates 2399a43570 templates 1 年之前
__init__.py 2399a43570 templates 1 年之前
apps.py 2399a43570 templates 1 年之前