amazon integration refactor

This commit is contained in:
Gabriel Bazán 2016-07-21 11:18:48 -03:00 committed by Gustavo Maximiliano Cortez
commit 6dff2840c8
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
12 changed files with 336 additions and 454 deletions

View file

@ -1,6 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, $ionicSideMenuDelegate, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwcError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, openURLService, ongoingProcess) {
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, $ionicSideMenuDelegate, $httpBackend, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwcError, txFormatService, uxLanguage, glideraService, coinbaseService, amazonService, platformInfo, addressbookService, openURLService, ongoingProcess) {
var self = this;
var SOFT_CONFIRMATION_LIMIT = 12;
var errors = bwcService.getErrors();
@ -1041,10 +1042,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
};
self.initAmazon = function() {
self.amazonEnabled = configService.getSync().amazon.enabled;
};
self.initGlidera = function(accessToken) {
self.glideraEnabled = configService.getSync().glidera.enabled;
self.glideraTestnet = configService.getSync().glidera.testnet;
@ -1394,6 +1391,15 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
};
self.initAmazon = function() {
self.amazonEnabled = configService.getSync().amazon.enabled;
self.amazonTestnet = configService.getSync().amazon.testnet;
var network = self.amazonTestnet ? 'testnet' : 'livenet';
if (!self.amazonEnabled) return;
amazonService.setCredentials(network);
};
self.isInFocus = function(walletId) {
var fc = profileService.focusedClient;
return fc && fc.credentials.walletId == walletId;