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();
|
uxLanguage.init();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'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 root = {};
|
||||||
|
|
||||||
var _setError = function(msg, e) {
|
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) {
|
storageService.setBitpayDebitCards(bitpayService.getEnvironment().network, apiContext.pairData.email, cards, function(err) {
|
||||||
|
register();
|
||||||
|
|
||||||
return cb(err, cards);
|
return cb(err, cards);
|
||||||
});
|
});
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
|
|
@ -193,6 +195,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
||||||
$log.error('Error removing BitPay debit card: ' + err);
|
$log.error('Error removing BitPay debit card: ' + err);
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
register();
|
||||||
storageService.removeBitpayDebitCardHistory(cardId, cb);
|
storageService.removeBitpayDebitCardHistory(cardId, cb);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -1244,6 +1247,26 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
||||||
'bp002': 'default'
|
'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;
|
return root;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,17 +14,21 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
root.unregister = function(serviceName) {
|
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);
|
$log.info('Removing NextSteps entry:' + serviceName);
|
||||||
var newS = lodash.filter(services, function(x) {
|
// This is to preserve services pointer
|
||||||
return x.name!=serviceName;
|
while (services.length)
|
||||||
});
|
services.pop();
|
||||||
|
|
||||||
// This is to preserve services pointer
|
while (newS.length)
|
||||||
while(services.length)
|
services.push(newS.pop());
|
||||||
services.pop();
|
|
||||||
|
|
||||||
while(newS.length)
|
|
||||||
services.push(newS.pop());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
root.get = function() {
|
root.get = function() {
|
||||||
|
|
|
||||||
20
www/views/includes/homeIntegrations.html
Normal file
20
www/views/includes/homeIntegrations.html
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<div class="list card" ng-controller="homeIntegrationsController">
|
||||||
|
<div class="item item-icon-right item-heading" ng-click="toggle()" >
|
||||||
|
<span translate>Services</span>
|
||||||
|
<i class="icon bp-arrow-up" ng-show="!hide"></i>
|
||||||
|
<i class="icon bp-arrow-down" ng-show="hide"></i>
|
||||||
|
</div>
|
||||||
|
<div ng-show="!hide">
|
||||||
|
<div ng-repeat="service in services">
|
||||||
|
<a ui-sref="{{service.sref}}" class="item item-sub item-icon-left item-big-icon-left item-icon-right next-step">
|
||||||
|
<i class="icon big-icon-svg">
|
||||||
|
<div class="bg {{service.icon}}"></div>
|
||||||
|
</i>
|
||||||
|
<span>{{service.title || service.name}}</span>
|
||||||
|
<i class="icon bp-arrow-right"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue