push notifications service addapted to bws
This commit is contained in:
parent
50ffb0af23
commit
425d8ffb33
4 changed files with 44 additions and 37 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, pushNotificationsService, lodash, go, profileService, configService, isCordova, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, nodeWebkit, addonManager, feeService, isChromeApp, bwsError, txFormatService, uxLanguage, $state, glideraService, isMobile, addressbookService) {
|
||||
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, isMobile, pushNotificationsService, lodash, go, profileService, configService, isCordova, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, nodeWebkit, addonManager, feeService, isChromeApp, bwsError, txFormatService, uxLanguage, $state, glideraService, isMobile, addressbookService) {
|
||||
var self = this;
|
||||
var SOFT_CONFIRMATION_LIMIT = 12;
|
||||
self.isCordova = isCordova;
|
||||
|
|
@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.prevState = 'walletHome';
|
||||
|
||||
document.addEventListener('deviceready', function() {
|
||||
if (self.isCordova) {
|
||||
if (isMobile.Android() || isMobile.iOS()) {
|
||||
storageService.getDeviceToken(function(err, token) {
|
||||
$timeout(function() {
|
||||
if (!token) pushNotificationsService.pushNotificationsInit();
|
||||
|
|
@ -31,15 +31,24 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
|
||||
self.menu = [{
|
||||
'title': gettext('Receive'),
|
||||
'icon': {false:'icon-receive', true: 'icon-receive-active'},
|
||||
'icon': {
|
||||
false: 'icon-receive',
|
||||
true: 'icon-receive-active'
|
||||
},
|
||||
'link': 'receive'
|
||||
}, {
|
||||
'title': gettext('Activity'),
|
||||
'icon': {false:'icon-activity',true: 'icon-activity-active'},
|
||||
'icon': {
|
||||
false: 'icon-activity',
|
||||
true: 'icon-activity-active'
|
||||
},
|
||||
'link': 'walletHome'
|
||||
}, {
|
||||
'title': gettext('Send'),
|
||||
'icon': {false:'icon-send', true: 'icon-send-active'},
|
||||
'icon': {
|
||||
false: 'icon-send',
|
||||
true: 'icon-send-active'
|
||||
},
|
||||
'link': 'send'
|
||||
}];
|
||||
|
||||
|
|
@ -403,7 +412,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.availableMaxBalance = strip((self.availableBalanceSat - feeToSendMaxSat) * self.satToUnit);
|
||||
self.feeToSendMaxStr = profileService.formatAmount(feeToSendMaxSat) + ' ' + self.unitName;
|
||||
}
|
||||
|
||||
|
||||
if (cb) return cb(self.currentFeePerKb, self.availableMaxBalance, self.feeToSendMaxStr);
|
||||
});
|
||||
}
|
||||
|
|
@ -1277,8 +1286,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
pushNotificationsService.enableNotifications();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/UnsubscribeNotifications', function(event, walletId) {
|
||||
pushNotificationsService.unsubscribe(walletId);
|
||||
$rootScope.$on('Local/UnsubscribeNotifications', function(event) {
|
||||
pushNotificationsService.unsubscribe(null, function(err, response) {
|
||||
if (err) $log.warn('Error: ' + err.code);
|
||||
$log.debug('Unsubscribed: ' + response);
|
||||
});
|
||||
});
|
||||
|
||||
self.debouncedUpdate = lodash.throttle(function() {
|
||||
|
|
@ -1482,5 +1494,5 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
$rootScope.$apply();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue