refactor
This commit is contained in:
parent
3a38384451
commit
1b38a42292
2 changed files with 18 additions and 41 deletions
|
|
@ -466,38 +466,23 @@ angular
|
||||||
url: '/cordova/:status/:isHome',
|
url: '/cordova/:status/:isHome',
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
controller: function($rootScope, $state, $log, $stateParams, $timeout, go, isCordova, storageService) {
|
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) {
|
||||||
|
switch ($stateParams.status) {
|
||||||
if ($stateParams.status == "pause")
|
case 'resume':
|
||||||
return;
|
$rootScope.$emit('Local/Resume');
|
||||||
|
break;
|
||||||
storageService.getProfile(function(err, profile) {
|
case 'backbutton':
|
||||||
|
if (isCordova && $stateParams.isHome == 'true' && !$rootScope.modalOpened) {
|
||||||
//for compatibility
|
navigator.app.exitApp();
|
||||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
|
||||||
|
|
||||||
$log.debug('### State: ', $stateParams.status);
|
|
||||||
switch ($stateParams.status) {
|
|
||||||
case 'resume':
|
|
||||||
$rootScope.$emit('Local/Resume');
|
|
||||||
break;
|
|
||||||
case 'backbutton':
|
|
||||||
var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer || !val;
|
|
||||||
if (isCordova && shouldExit && !$rootScope.modalOpened) {
|
|
||||||
return navigator.app.exitApp();
|
|
||||||
} else {
|
|
||||||
$rootScope.$emit('closeModal');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (profile.agreeDisclaimer || val) {
|
|
||||||
go.walletHome(true);
|
|
||||||
} else {
|
} else {
|
||||||
$state.transitionTo('disclaimer');
|
$rootScope.$emit('closeModal');
|
||||||
}
|
}
|
||||||
});
|
break;
|
||||||
});
|
};
|
||||||
|
$timeout(function() {
|
||||||
|
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
||||||
|
}, 100);
|
||||||
|
go.walletHome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -57,17 +57,9 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
|
||||||
if (fc && !fc.isComplete()) {
|
if (fc && !fc.isComplete()) {
|
||||||
root.path('copayers');
|
root.path('copayers');
|
||||||
} else {
|
} else {
|
||||||
if (delayed) {
|
root.path('walletHome', function() {
|
||||||
$timeout(function() {
|
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
||||||
root.path('walletHome', function() {
|
});
|
||||||
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
} else {
|
|
||||||
root.path('walletHome', function() {
|
|
||||||
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue