changed FCMPlugin to FirebasePlugin

This commit is contained in:
Kadir Sekha 2017-11-10 14:41:02 +09:00
commit 2e11a402f0
2 changed files with 15 additions and 18 deletions

View file

@ -70,10 +70,7 @@
</plugin> </plugin>
<plugin name="cordova-custom-config" spec="~3.0.5" /> <plugin name="cordova-custom-config" spec="~3.0.5" />
<plugin name="cordova-plugin-queries-schemes" spec="~0.1.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" /> <plugin name="cordova-plugin-firebase" spec="https://github.com/arnesson/cordova-plugin-firebase.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" /> -->
<!-- Supported Platforms --> <!-- Supported Platforms -->
<engine name="ios" spec="~4.2.1" /> <engine name="ios" spec="~4.2.1" />

View file

@ -15,7 +15,7 @@ angular.module('copayApp.services').factory('pushNotificationsService', function
$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. //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); $log.debug('Get token for push notifications: ' + token);
_token = token; _token = token;
root.enable(); root.enable();
@ -101,17 +101,17 @@ angular.module('copayApp.services').factory('pushNotificationsService', function
if (usePushNotifications) { if (usePushNotifications) {
FCMPlugin.onTokenRefresh(function(token) { FirebasePlugin.onTokenRefresh(function(token) {
if (!_token) return; if (!_token) return;
$log.debug('Refresh and update token for push notifications...'); $log.debug('Refresh and update token for push notifications...');
_token = token; _token = token;
root.enable(); root.enable();
}); });
FCMPlugin.onNotification(function(data) { FirebasePlugin.onNotificationOpen(function(data) {
if (!_token) return; if (!_token) return;
$log.debug('New Event Push onNotification: ' + JSON.stringify(data)); $log.debug('New Event Push onNotification: ' + JSON.stringify(data));
if(data.wasTapped) { if(data.tap) {
// Notification was received on device tray and tapped by the user. // Notification was received on device tray and tapped by the user.
var walletIdHashed = data.walletId; var walletIdHashed = data.walletId;
if (!walletIdHashed) return; if (!walletIdHashed) return;