add debit card to nextsteps
This commit is contained in:
parent
54c8c64351
commit
8e5d42edc5
4 changed files with 58 additions and 11 deletions
|
|
@ -1088,7 +1088,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
});
|
||||
})
|
||||
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService) {
|
||||
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) {
|
||||
|
||||
uxLanguage.init();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('bitpayCardService', function($log, $rootScope, lodash, storageService, bitauthService, platformInfo, moment, appIdentityService, bitpayService) {
|
||||
angular.module('copayApp.services').factory('bitpayCardService', function($log, $rootScope, lodash, storageService, bitauthService, platformInfo, moment, appIdentityService, bitpayService, nextStepsService) {
|
||||
var root = {};
|
||||
|
||||
var _setError = function(msg, e) {
|
||||
|
|
@ -66,6 +66,8 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
|||
});
|
||||
|
||||
storageService.setBitpayDebitCards(bitpayService.getEnvironment().network, apiContext.pairData.email, cards, function(err) {
|
||||
register();
|
||||
|
||||
return cb(err, cards);
|
||||
});
|
||||
}, function(data) {
|
||||
|
|
@ -193,6 +195,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
|||
$log.error('Error removing BitPay debit card: ' + err);
|
||||
return cb(err);
|
||||
}
|
||||
register();
|
||||
storageService.removeBitpayDebitCardHistory(cardId, cb);
|
||||
});
|
||||
};
|
||||
|
|
@ -1244,6 +1247,26 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
|||
'bp002': 'default'
|
||||
};
|
||||
|
||||
var nextStepItem = {
|
||||
name: 'bitpaycard',
|
||||
title: 'Add Bitpay VISA Card',
|
||||
icon: 'icon-bitpay-card',
|
||||
sref: 'tabs.bitpayCardIntro',
|
||||
};
|
||||
|
||||
|
||||
var register = function() {
|
||||
root.getCards(function(err, cards) {
|
||||
if (lodash.isEmpty(cards)) {
|
||||
nextStepsService.register(nextStepItem);
|
||||
} else {
|
||||
nextStepsService.unregister(nextStepItem);
|
||||
// homeIntegrationsService.register(homeItem);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
register();
|
||||
return root;
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,17 +14,21 @@
|
|||
};
|
||||
|
||||
root.unregister = function(serviceName) {
|
||||
|
||||
var newS = lodash.filter(services, function(x) {
|
||||
return x.name != serviceName;
|
||||
});
|
||||
|
||||
// Found?
|
||||
if (newS.length == services.length) return;
|
||||
|
||||
$log.info('Removing NextSteps entry:' + serviceName);
|
||||
var newS = lodash.filter(services, function(x) {
|
||||
return x.name!=serviceName;
|
||||
});
|
||||
// This is to preserve services pointer
|
||||
while (services.length)
|
||||
services.pop();
|
||||
|
||||
// This is to preserve services pointer
|
||||
while(services.length)
|
||||
services.pop();
|
||||
|
||||
while(newS.length)
|
||||
services.push(newS.pop());
|
||||
while (newS.length)
|
||||
services.push(newS.pop());
|
||||
};
|
||||
|
||||
root.get = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue