@@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http';
22import { Injectable } from '@angular/core' ;
33import { TranslateService } from '@ngx-translate/core' ;
44import { timer } from 'rxjs' ;
5- import { FCM } from "capacitor-fcm" ;
5+ // import { FCM } from "capacitor-fcm";
66// providers
77import { AppProvider } from '../app/app' ;
88import { BwcProvider } from '../bwc/bwc' ;
@@ -35,7 +35,7 @@ export class PushNotificationsProvider {
3535 private notifications = [ ] ;
3636 private currentNotif : HTMLIonModalElement ;
3737 private openWalletId ;
38- public fcm ;
38+ // public fcm ;
3939 constructor (
4040 public http : HttpClient ,
4141 public profileProvider : ProfileProvider ,
@@ -53,7 +53,7 @@ export class PushNotificationsProvider {
5353 this . isIOS = this . platformProvider . isIOS ;
5454 this . isAndroid = this . platformProvider . isAndroid ;
5555 this . usePushNotifications = this . platformProvider . isCordova ;
56- this . fcm = new FCM ( ) ;
56+ // this.fcm = new FCM();
5757 }
5858
5959 public init ( ) : void {
@@ -63,37 +63,37 @@ export class PushNotificationsProvider {
6363 if ( ! config . pushNotifications . enabled ) return ;
6464 await this . registerNotifications ( ) ;
6565 // On success, we should be able to receive notifications
66- this . fcm
67- . getToken ( )
68- . then ( async token => {
69- if ( ! token ) {
70- setTimeout ( ( ) => {
71- this . init ( ) ;
72- } , 5000 ) ;
73- return ;
74- }
75- this . logger . debug ( 'Get token for push notifications: ' + token . token ) ;
76- this . _token = token . token ;
77- this . enable ( ) ;
78- // enabling topics
79- if (
80- this . appProvider . info . name != 'copay' &&
81- config . offersAndPromotions . enabled
82- )
83- await this . subscribeToTopic ( 'offersandpromotions' ) ;
84- if (
85- this . appProvider . info . name != 'copay' &&
86- config . productsUpdates . enabled
87- )
88- await this . subscribeToTopic ( 'productsupdates' ) ;
89-
90- this . fcmInterval = setInterval ( ( ) => {
91- this . renewSubscription ( ) ;
92- } , 5 * 60 * 1000 ) ; // 5 min
93-
94- } ) . catch ( error => {
95- this . logger . error ( error ) ;
96- } ) ;
66+ // this.fcm
67+ // .getToken()
68+ // .then(async token => {
69+ // if (!token) {
70+ // setTimeout(() => {
71+ // this.init();
72+ // }, 5000);
73+ // return;
74+ // }
75+ // this.logger.debug('Get token for push notifications: ' + token.token);
76+ // this._token = token.token;
77+ // this.enable();
78+ // // enabling topics
79+ // if (
80+ // this.appProvider.info.name != 'copay' &&
81+ // config.offersAndPromotions.enabled
82+ // )
83+ // await this.subscribeToTopic('offersandpromotions');
84+ // if (
85+ // this.appProvider.info.name != 'copay' &&
86+ // config.productsUpdates.enabled
87+ // )
88+ // await this.subscribeToTopic('productsupdates');
89+ //
90+ // this.fcmInterval = setInterval(() => {
91+ // this.renewSubscription();
92+ // }, 5 * 60 * 1000); // 5 min
93+ //
94+ // }).catch(error=>{
95+ // this.logger.error(error);
96+ // });
9797 } ) ;
9898
9999 // Show us the notification payload if the app is open on our device
@@ -225,8 +225,8 @@ export class PushNotificationsProvider {
225225 }
226226
227227 // disabling topics
228- this . unsubscribeFromTopic ( 'offersandpromotions' ) ;
229- this . unsubscribeFromTopic ( 'productsupdates' ) ;
228+ // this.unsubscribeFromTopic('offersandpromotions');
229+ // this.unsubscribeFromTopic('productsupdates');
230230
231231 const opts = {
232232 showHidden : true
@@ -246,23 +246,23 @@ export class PushNotificationsProvider {
246246 }
247247
248248 public async subscribeToTopic ( topic : string ) : Promise < void > {
249- await this . fcm . subscribeTo ( { topic : topic } )
250- . then ( r => {
251- return this . logger . info ( r ) ;
252- } )
253- . catch ( err => {
254- return this . logger . error ( err ) ;
255- } ) ;
249+ // await this.fcm.subscribeTo({ topic: topic })
250+ // .then(r => {
251+ // return this.logger.info(r);
252+ // })
253+ // .catch(err => {
254+ // return this.logger.error(err);
255+ // });
256256 }
257257
258258 public async unsubscribeFromTopic ( topic : string ) : Promise < void > {
259- await this . fcm . unsubscribeFrom ( { topic : topic } )
260- . then ( r => {
261- return this . logger . info ( r ) ;
262- } )
263- . catch ( err => {
264- return this . logger . error ( err ) ;
265- } ) ;
259+ // await this.fcm.unsubscribeFrom({ topic: topic })
260+ // .then(r => {
261+ // return this.logger.info(r);
262+ // })
263+ // .catch(err => {
264+ // return this.logger.error(err);
265+ // });
266266 }
267267
268268 private _subscribe ( walletClient ) : void {
0 commit comments