Merge pull request #3645 from gabrielbazan7/fix/disclaimerBackButton

fix backbutton in disclaimer page
This commit is contained in:
Gustavo Maximiliano Cortez 2015-12-10 16:02:10 -03:00
commit 9895e82f76
2 changed files with 11 additions and 8 deletions

View file

@ -33,7 +33,7 @@ angular.element(document).ready(function() {
document.addEventListener('pause', function() {
if (!window.ignoreMobilePause) {
setTimeout(function() {
window.location = '#/cordova/pause//';
window.location = '#/cordova/pause///';
}, 100);
}
}, false);
@ -41,7 +41,7 @@ angular.element(document).ready(function() {
document.addEventListener('resume', function() {
if (!window.ignoreMobilePause) {
setTimeout(function() {
window.location = '#/cordova/resume//';
window.location = '#/cordova/resume///';
}, 100);
}
setTimeout(function() {
@ -54,11 +54,10 @@ angular.element(document).ready(function() {
document.addEventListener('backbutton', function() {
var loc = window.location;
var exit = loc.toString().match(/disclaimer/) ? 'true' : '';
if (exit != 'true')
var exit = loc.toString().match(/index\.html#\/$/) ? 'true' : '';
var fromDisclaimer = loc.toString().match(/disclaimer/) ? 'true' : '';
var fromHome = loc.toString().match(/index\.html#\/$/) ? 'true' : '';
if (!window.ignoreMobilePause) {
window.location = '#/cordova/backbutton/' + exit + '/' + secondBackButtonPress;
window.location = '#/cordova/backbutton/' + fromHome + '/' + fromDisclaimer + '/' + secondBackButtonPress;
if (secondBackButtonPress == 'true') {
clearInterval(intval);
} else {

View file

@ -475,7 +475,7 @@ angular
}
})
.state('cordova', {
url: '/cordova/:status/:exit/:secondBackButtonPress',
url: '/cordova/:status/:fromHome/:fromDisclaimer/:secondBackButtonPress',
views: {
'main': {
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova) {
@ -485,7 +485,11 @@ angular
$rootScope.$emit('Local/Resume');
break;
case 'backbutton':
if (isCordova && $stateParams.exit == 'true' && !$rootScope.modalOpened) {
if ($stateParams.fromDisclaimer == 'true')
navigator.app.exitApp();
if (isCordova && $stateParams.fromHome == 'true' && !$rootScope.modalOpened) {
if ($stateParams.secondBackButtonPress == 'true') {
navigator.app.exitApp();
} else {