refactor disclaimer handling

This commit is contained in:
Matias Alejo Garcia 2016-02-22 19:32:24 -03:00
commit bffaf9ad9d
10 changed files with 57 additions and 55 deletions

View file

@ -28,12 +28,19 @@ angular.module('copayApp.services')
if (!config.pushNotifications.enabled) return;
storageService.getDeviceToken(function(err, token) {
if (err || !token) {
$log.warn('No token available for this device. Cannot set push notifications');
return;
}
lodash.forEach(walletsClients, function(walletClient) {
var opts = {};
opts.type = isMobile.iOS() ? "ios" : isMobile.Android() ? "android" : null;
opts.token = token;
root.subscribe(opts, walletClient, function(err, response) {
if (err) $log.warn('Subscription error: ' + err.message);
if (err) $log.warn('Subscription error: ' + err.message + ': ' + JSON.stringify(opts));
else $log.debug('Subscribed to push notifications service: ' + JSON.stringify(response));
});
});