mirror of
https://github.com/moparisthebest/mail
synced 2024-12-24 08:18:48 -05:00
Set back button event in navigation.js
This commit is contained in:
parent
3a713180f1
commit
9e1a402b94
@ -24,7 +24,6 @@ define(function(require) {
|
||||
InvitationDAO = require('js/dao/invitation-dao'),
|
||||
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
|
||||
UpdateHandler = require('js/util/update/update-handler'),
|
||||
backBtnHandler = require('js/util/backbutton-handler'),
|
||||
config = appConfig.config,
|
||||
str = appConfig.string;
|
||||
|
||||
@ -55,7 +54,6 @@ define(function(require) {
|
||||
function onDeviceReady() {
|
||||
axe.debug('Starting app.');
|
||||
|
||||
backBtnHandler.start();
|
||||
self.buildModules();
|
||||
|
||||
// Handle offline and online gracefully
|
||||
|
@ -5,6 +5,7 @@ define(function(require) {
|
||||
appController = require('js/app-controller'),
|
||||
config = require('js/app-config').config,
|
||||
notification = require('js/util/notification'),
|
||||
backBtnHandler = require('js/util/backbutton-handler'),
|
||||
_ = require('underscore'),
|
||||
emailDao, outboxBo;
|
||||
|
||||
@ -54,6 +55,8 @@ define(function(require) {
|
||||
// Start
|
||||
//
|
||||
|
||||
// handle back button
|
||||
backBtnHandler.start();
|
||||
// init folders
|
||||
initializeFolders();
|
||||
|
||||
|
@ -34,25 +34,30 @@ define(function(require) {
|
||||
|
||||
if (backBtnHandler.scope.state.lightbox) {
|
||||
// closes the lightbox (error msgs, writer, ...)
|
||||
backBtnHandler.scope.$apply(function() {
|
||||
backBtnHandler.scope.state.lightbox = undefined;
|
||||
});
|
||||
axe.debug(DEBUG_TAG, 'lightbox closed');
|
||||
backBtnHandler.scope.$apply();
|
||||
|
||||
} else if (backBtnHandler.scope.state.read && backBtnHandler.scope.state.read.open) {
|
||||
// closes the reader
|
||||
backBtnHandler.scope.$apply(function() {
|
||||
backBtnHandler.scope.state.read.toggle(false);
|
||||
});
|
||||
axe.debug(DEBUG_TAG, 'reader closed');
|
||||
backBtnHandler.scope.$apply();
|
||||
|
||||
} else if (backBtnHandler.scope.state.nav && backBtnHandler.scope.state.nav.open) {
|
||||
// closes the navigation
|
||||
backBtnHandler.scope.$apply(function() {
|
||||
backBtnHandler.scope.state.nav.toggle(false);
|
||||
});
|
||||
axe.debug(DEBUG_TAG, 'navigation closed');
|
||||
backBtnHandler.scope.$apply();
|
||||
|
||||
} else {
|
||||
// exits the app
|
||||
navigator.app.exitApp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return backBtnHandler;
|
||||
});
|
Loading…
Reference in New Issue
Block a user