Skip to content

Commit

Permalink
working back button
Browse files Browse the repository at this point in the history
  • Loading branch information
rajivramv committed Jun 4, 2015
1 parent 6c1ed42 commit 23b4a7c
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 15 deletions.
Binary file modified docs/task-it.apk
Binary file not shown.
Binary file not shown.
Binary file modified platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion platforms/android/assets/www/app.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/main/js/config/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// The root state, just to plugin the other state and not have the default nameles state of ui-router.
angular.module('main')
.config(['$stateProvider','$urlRouterProvider',function($stateProvider,$urlRouterProvider){
$urlRouterProvider.otherwise('/');
$stateProvider.state('root',{
abstract: true,
views: {
'body': {
templateUrl: 'partials/body.html'
Expand Down
1 change: 1 addition & 0 deletions src/components/main/js/factory/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// A simple factory to show a toast
angular.module('main')
.factory('notify',['$timeout',function($timeout){
return function(msg){
Expand Down
25 changes: 13 additions & 12 deletions src/components/main/js/run/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// Initialize kinvey and route the app to either the login page or the tasks page based on whether
// an active user is present or not.
angular.module('main')
.run(['$kinvey','$state','$rootScope','$document','$timeout','notify',function($kinvey,$state,$rootScope,$document,$timeout,notify){
// TODO Check if the app exit code works once the kinvey is up
// var shouldExitApp = false;
// $document[0].addEventListener('backbutton',function(){
// if (shouldExitApp) return navigator.app.exitApp();
// else if ($state.$current.parent.name ==='root') {
// shouldExitApp = true;
// notify('Press back one more time to exit');
// $timeout(function(){
// shouldExitApp = false;
// },2800);
// } else return $state.go('^');
// },false);
var shouldExitApp = false;
$document[0].addEventListener('backbutton',function(){
if (shouldExitApp) return navigator.app.exitApp();
else if ($state.$current.parent.name ==='root') {
shouldExitApp = true;
notify('Press back one more time to exit');
$timeout(function(){
shouldExitApp = false;
},2800);
} else return $state.go('^');
},false);

$kinvey.init({
appKey: 'kid_Wk8MsXwikg',
Expand Down
Loading

0 comments on commit 23b4a7c

Please sign in to comment.