Merge pull request #95 from gabrielbazan7/fix/hardwareButtonAndroid
fix transitions with android hardware button
This commit is contained in:
commit
b814db5a30
1 changed files with 12 additions and 8 deletions
|
|
@ -741,19 +741,23 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
|
|
||||||
$ionicPlatform.registerBackButtonAction(function(e) {
|
$ionicPlatform.registerBackButtonAction(function(e) {
|
||||||
|
|
||||||
var fromDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? 'true' : '';
|
var fromWelcome = $ionicHistory.currentStateName().match(/welcome/) ? true : false;
|
||||||
var fromTabs = $ionicHistory.currentStateName().match(/tabs/) ? 'true' : '';
|
var matchHome = $ionicHistory.currentStateName().match(/home/) ? true : false;
|
||||||
|
var matchReceive = $ionicHistory.currentStateName().match(/receive/) ? true : false;
|
||||||
|
var matchSend = $ionicHistory.currentStateName().match(/send/) ? true : false;
|
||||||
|
var matchSettings = $ionicHistory.currentStateName().match(/settings/) ? true : false;
|
||||||
|
var fromTabs = matchHome | matchReceive | matchSend | matchSettings;
|
||||||
|
|
||||||
if ($rootScope.backButtonPressedOnceToExit || fromDisclaimer) {
|
if ($ionicHistory.backView() && !fromTabs) {
|
||||||
ionic.Platform.exitApp();
|
|
||||||
} else if ($ionicHistory.backView() && !fromTabs) {
|
|
||||||
$ionicHistory.goBack();
|
$ionicHistory.goBack();
|
||||||
|
} else if ($rootScope.backButtonPressedOnceToExit || fromWelcome) {
|
||||||
|
ionic.Platform.exitApp();
|
||||||
} else {
|
} else {
|
||||||
$rootScope.backButtonPressedOnceToExit = true;
|
$rootScope.backButtonPressedOnceToExit = true;
|
||||||
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
|
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
|
||||||
setInterval(function() {
|
$timeout(function() {
|
||||||
$rootScope.backButtonPressedOnceToExit = false;
|
$rootScope.backButtonPressedOnceToExit = false;
|
||||||
}, 5000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}, 101);
|
}, 101);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue