mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #6060 from cmgustavo/bug/creating-wallet-push-notif
Subscribe push notifications after create a wallet
This commit is contained in:
commit
15b7330d90
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('createController',
|
||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService) {
|
||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService, pushNotificationsService) {
|
||||
|
||||
/* For compressed keys, m*73 + n*34 <= 496 */
|
||||
var COPAYER_PAIR_LIMITS = {
|
||||
|
@ -214,6 +214,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
}
|
||||
|
||||
walletService.updateRemotePreferences(client);
|
||||
pushNotificationsService.updateSubscription(client);
|
||||
|
||||
if ($scope.seedSource.id == 'set') {
|
||||
profileService.setBackupFlag(client.credentials.walletId);
|
||||
|
|
|
@ -23,6 +23,14 @@ angular.module('copayApp.services').factory('pushNotificationsService', function
|
|||
});
|
||||
};
|
||||
|
||||
root.updateSubscription = function(walletClient) {
|
||||
if (!_token) {
|
||||
$log.warn('Push notifications disabled for this device. Nothing to do here.');
|
||||
return;
|
||||
}
|
||||
_subscribe(walletClient);
|
||||
};
|
||||
|
||||
root.enable = function() {
|
||||
if (!_token) {
|
||||
$log.warn('No token available for this device. Cannot set push notifications. Needs registration.');
|
||||
|
|
Loading…
Reference in New Issue