Handle back-button on Android devices
This commit is contained in:
parent
504a8b10dd
commit
9d816c20f5
3 changed files with 60 additions and 10 deletions
|
|
@ -444,13 +444,20 @@ angular
|
|||
}
|
||||
})
|
||||
.state('cordova', {
|
||||
url: '/cordova/:status',
|
||||
url: '/cordova/:status/:isHome',
|
||||
views: {
|
||||
'main': {
|
||||
controller: function($rootScope, $stateParams, $timeout, go) {
|
||||
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) {
|
||||
switch ($stateParams.status) {
|
||||
case 'resume':
|
||||
$rootScope.$emit('Local/Resume');
|
||||
$rootScope.$emit('Local/Resume');
|
||||
break;
|
||||
case 'backbutton':
|
||||
if (isCordova && $stateParams.isHome == 'true' && !$rootScope.modalOpened) {
|
||||
navigator.app.exitApp();
|
||||
} else {
|
||||
$rootScope.$emit('closeModal');
|
||||
}
|
||||
break;
|
||||
};
|
||||
$timeout(function() {
|
||||
|
|
@ -528,7 +535,6 @@ angular
|
|||
|
||||
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
||||
|
||||
|
||||
if (!profileService.profile && toState.needProfile) {
|
||||
|
||||
// Give us time to open / create the profile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue