summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPliablePixels <pliablepixels@gmail.com>2015-07-29 18:11:59 -0400
committerPliablePixels <pliablepixels@gmail.com>2015-07-29 18:11:59 -0400
commit806142bbcffad1d8056c7d4710be4277df8f04fb (patch)
treef764415c4ba9f4ea395c4b95e4b0ad815e460c2f
parent542305d12922c3ded15cc215ed93e1eab010bf2e (diff)
fixed back button behavior for Android - it first opens the main menu, then exits
-rw-r--r--www/js/app.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/www/js/app.js b/www/js/app.js
index 042db8e3..d90a25c0 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -10,7 +10,8 @@ angular.module('zmApp', [
'tc.chartjs',
'zmApp.controllers',
'fileLogger',
- 'angular-carousel', 'angularAwesomeSlider'
+ 'angular-carousel',
+ 'angularAwesomeSlider'
//'angularAwesomeSlider'
])
@@ -289,6 +290,8 @@ angular.module('zmApp', [
ZMDataModel.init();
+
+
var loginData = ZMDataModel.getLogin();
if (ZMDataModel.isLoggedIn()) {
@@ -300,11 +303,19 @@ angular.module('zmApp', [
}
// This code takes care of trapping the Android back button
- // and takes it to the menu. FIXME: For some reason, isOpen of Side
- // MenuDelegate always returns False, so I don't know
- // when its on or off, so can't exit the app if its on
+ // and takes it to the menu.
+ $ionicPlatform.registerBackButtonAction(function(e) {
+ e.preventDefault();
+ if (!$ionicSideMenuDelegate.isOpenLeft()) {
+ $ionicSideMenuDelegate.toggleLeft();
+ console.log ("Status of SIDE MENU IS : " + $ionicSideMenuDelegate.isOpen());
+ } else {
+ navigator.app.exitApp();
+ }
+ }, 1000);
+