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, name: config.aliasFor[c.walletId] || c.walletName,
id: c.walletId, id: c.walletId,
network: c.network, network: c.network,
color: config.colorFor[c.walletId] || '#4A90E2' color: config.colorFor[c.walletId] || '#4A90E2',
copayerId: c.copayerId
}; };
}); });
ret = lodash.filter(ret, function(w) { ret = lodash.filter(ret, function(w) {

View file

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