changed FCMPlugin to FirebasePlugin
This commit is contained in:
parent
37bfa63425
commit
2e11a402f0
2 changed files with 15 additions and 18 deletions
|
|
@ -70,10 +70,7 @@
|
|||
</plugin>
|
||||
<plugin name="cordova-custom-config" spec="~3.0.5" />
|
||||
<plugin name="cordova-plugin-queries-schemes" spec="~0.1.5" />
|
||||
<plugin name="cordova-plugin-fcm" spec="https://github.com/cmgustavo/cordova-plugin-fcm.git" />
|
||||
|
||||
<!-- Delete cordova-plugin-qrscanner plugin and enable phonegap-plugin-barcodescanner to build cordova windows-->
|
||||
<!-- <plugin name="phonegap-plugin-barcodescanner" spec="https://github.com/phonegap/phonegap-plugin-barcodescanner.git" /> -->
|
||||
<plugin name="cordova-plugin-firebase" spec="https://github.com/arnesson/cordova-plugin-firebase.git" />
|
||||
|
||||
<!-- Supported Platforms -->
|
||||
<engine name="ios" spec="~4.2.1" />
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ angular.module('copayApp.services').factory('pushNotificationsService', function
|
|||
if (!usePushNotifications || _token) return;
|
||||
configService.whenAvailable(function(config) {
|
||||
if (!config.pushNotificationsEnabled) return;
|
||||
|
||||
$log.debug('Starting push notification registration...');
|
||||
|
||||
$log.debug('Starting push notification registration...');
|
||||
|
||||
//Keep in mind the function will return null if the token has not been established yet.
|
||||
FCMPlugin.getToken(function(token) {
|
||||
FirebasePlugin.getToken(function(token) {
|
||||
$log.debug('Get token for push notifications: ' + token);
|
||||
_token = token;
|
||||
root.enable();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.updateSubscription = function(walletClient) {
|
||||
|
|
@ -87,10 +87,10 @@ angular.module('copayApp.services').factory('pushNotificationsService', function
|
|||
});
|
||||
|
||||
if (!wallet) return;
|
||||
|
||||
|
||||
if (!wallet.isComplete()) {
|
||||
return $state.go('tabs.copayers', {
|
||||
walletId: wallet.id
|
||||
walletId: wallet.id
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -100,19 +100,19 @@ angular.module('copayApp.services').factory('pushNotificationsService', function
|
|||
};
|
||||
|
||||
if (usePushNotifications) {
|
||||
|
||||
FCMPlugin.onTokenRefresh(function(token) {
|
||||
|
||||
FirebasePlugin.onTokenRefresh(function(token) {
|
||||
if (!_token) return;
|
||||
$log.debug('Refresh and update token for push notifications...');
|
||||
_token = token;
|
||||
root.enable();
|
||||
});
|
||||
|
||||
FCMPlugin.onNotification(function(data) {
|
||||
FirebasePlugin.onNotificationOpen(function(data) {
|
||||
if (!_token) return;
|
||||
$log.debug('New Event Push onNotification: ' + JSON.stringify(data));
|
||||
if(data.wasTapped) {
|
||||
// Notification was received on device tray and tapped by the user.
|
||||
if(data.tap) {
|
||||
// Notification was received on device tray and tapped by the user.
|
||||
var walletIdHashed = data.walletId;
|
||||
if (!walletIdHashed) return;
|
||||
$ionicHistory.nextViewOptions({
|
||||
|
|
@ -128,10 +128,10 @@ angular.module('copayApp.services').factory('pushNotificationsService', function
|
|||
});
|
||||
} else {
|
||||
// TODO
|
||||
// Notification was received in foreground. Maybe the user needs to be notified.
|
||||
// Notification was received in foreground. Maybe the user needs to be notified.
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return root;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue