Merge branch 'ref/design' of github.com:bitpay/bitpay-wallet into feature/new-qrscanner-permissions

This commit is contained in:
Jason Dreyzehner 2016-10-11 03:15:07 -04:00
commit f1a849c5d8
36 changed files with 344 additions and 284 deletions

View file

@ -296,7 +296,8 @@ angular.module('copayApp.services')
if (!val) {
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
}
if (usePushNotifications)
var config = configService.getSync();
if (config.pushNotifications.enabled && usePushNotifications)
root.pushNotificationsInit();
return cb();
});
@ -317,6 +318,8 @@ angular.module('copayApp.services')
var defaults = configService.getDefaults();
var push = pushNotificationsService.init(root.wallet);
if (!push) return;
push.on('notification', function(data) {
if (!data.additionalData.foreground) {
$log.debug('Push notification event: ', data.message);

View file

@ -11,10 +11,14 @@ angular.module('copayApp.services')
root.init = function(walletsClients) {
var defaults = configService.getDefaults();
var push = PushNotification.init(defaults.pushNotifications.config);
try {
var push = PushNotification.init(defaults.pushNotifications.config);
} catch(e) {
$log.error(e);
return;
};
push.on('registration', function(data) {
if (root.token) return;
$log.debug('Starting push notification registration');
root.token = data.registrationId;
var config = configService.getSync();
@ -31,7 +35,7 @@ angular.module('copayApp.services')
if (!config.pushNotifications.enabled) return;
if (!root.token) {
$log.warn('No token available for this device. Cannot set push notifications');
$log.warn('No token available for this device. Cannot set push notifications. Needs registration.');
return;
}

View file

@ -195,6 +195,14 @@ angular.module('copayApp.services')
storage.remove('config', cb);
};
root.getHomeTipAccepted = function(cb) {
storage.get('homeTip', cb);
};
root.setHomeTipAccepted = function(val, cb) {
storage.set('homeTip', val, cb);
};
root.setHideBalanceFlag = function(walletId, val, cb) {
storage.set('hideBalance-' + walletId, val, cb);
};
@ -361,21 +369,6 @@ angular.module('copayApp.services')
});
};
root.setScanTipsAccepted = function(val, cb) {
storage.set('scanTips', val, cb);
};
root.getScanTipsAccepted = function(cb) {
storage.get('scanTips', cb);
};
root.setReceiveTipsAccepted = function(val, cb) {
storage.set('receiveTips', val, cb);
};
root.getReceiveTipsAccepted = function(cb) {
storage.get('receiveTips', cb);
};
root.setBackupNeededModalFlag = function(walletId, val, cb) {
storage.set('showBackupNeededModal-' + walletId, val, cb);