sendflow service integrated into flow
This commit is contained in:
parent
f7ecdb2f2f
commit
2206102715
2 changed files with 20 additions and 2 deletions
|
|
@ -191,6 +191,7 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
};
|
||||
|
||||
$scope.goBack = function() {
|
||||
sendFlowService.previousState();
|
||||
$ionicHistory.goBack();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,15 @@ angular.module('copayApp.services').factory('sendFlowService', function ($log) {
|
|||
var vm = this;
|
||||
|
||||
vm.amount = false;
|
||||
|
||||
vm.fromWalletId = false;
|
||||
vm.previousStates = [];
|
||||
vm.thirdParty = false;
|
||||
vm.sendMax = false;
|
||||
vm.toAddress = false;
|
||||
vm.toWalletId = false;
|
||||
|
||||
vm.initialize = function() {
|
||||
vm.clear = function() {
|
||||
$log.debug("Reinitialize Send Flow variables");
|
||||
vm.amount = false;
|
||||
vm.fromWalletId = false;
|
||||
|
|
@ -18,13 +20,28 @@ angular.module('copayApp.services').factory('sendFlowService', function ($log) {
|
|||
vm.sendMax = false;
|
||||
vm.toAddress = false;
|
||||
vm.toWalletId = false;
|
||||
vm.previousStates = [];
|
||||
};
|
||||
|
||||
vm.map = function(params) {
|
||||
|
||||
var tempState = {};
|
||||
Object.keys(vm).map(function(key, index) {
|
||||
if (typeof vm[key] !== 'function' && key !== 'previousStates') {
|
||||
tempState[key] = vm[key];
|
||||
}
|
||||
});
|
||||
vm.previousStates.push(tempState);
|
||||
|
||||
Object.keys(params).map(function(key, index) {
|
||||
vm[key] = params[key];
|
||||
});
|
||||
console.log(vm);
|
||||
};
|
||||
|
||||
vm.previousState = function() {
|
||||
if (vm.previousStates.length) {
|
||||
vm.map(vm.previousStates.pop());
|
||||
}
|
||||
};
|
||||
|
||||
return vm;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue