adding copayerid to opts.user

This commit is contained in:
Gabriel Bazán 2016-01-07 16:56:28 -03:00
commit a97befc20a
2 changed files with 7 additions and 7 deletions

View file

@ -664,7 +664,8 @@ angular.module('copayApp.services')
name: config.aliasFor[c.walletId] || c.walletName,
id: c.walletId,
network: c.network,
color: config.colorFor[c.walletId] || '#4A90E2'
color: config.colorFor[c.walletId] || '#4A90E2',
copayerId: c.copayerId
};
});
ret = lodash.filter(ret, function(w) {

View file

@ -18,6 +18,7 @@ angular.module('copayApp.services')
});
push.on('registration', function(data) {
$log.debug('Starting registration');
storageService.setDeviceToken(data.registrationId, function() {
root.enableNotifications();
});
@ -41,13 +42,11 @@ angular.module('copayApp.services')
root.enableNotifications = function() {
storageService.getDeviceToken(function(err, token) {
lodash.forEach(profileService.getWallets('testnet'), function(wallets) {
var opts = {};
opts.user = wallets.id;
opts.user = wallets.id + '$' + wallets.copayerId;
opts.type = (navigator.userAgent.match(/iPhone/i)) == "iPhone" ? "ios" : (navigator.userAgent.match(/Android/i)) == "Android" ? "android" : null;
opts.token = token;
root.subscribe(opts).then(function(response) {
$log.debug('Suscribed: ' + response.status);
},
@ -70,17 +69,17 @@ angular.module('copayApp.services')
}
root.subscribe = function(opts) {
return $http.post('http://192.168.1.121:8000/subscribe', opts);
return $http.post('http://192.168.1.128:8000/subscribe', opts);
}
root.unsubscribe = function(user) {
return $http.post('http://192.168.1.121:8000/unsubscribe', {
return $http.post('http://192.168.1.128:8000/unsubscribe', {
user: user
});
}
root.unsubscribeAll = function(token) {
return $http.post('http://192.168.1.121:8000/unsubscribe', {
return $http.post('http://192.168.1.128:8000/unsubscribe', {
token: token
});
}