diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index a0120d1da..0ed405ec9 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -7,10 +7,15 @@ angular.module('copayApp.controllers').controller('confirmController', function( var countDown = null; var cachedSendMax = {}; $scope.isCordova = platformInfo.isCordova; - $ionicConfig.views.swipeBackEnabled(false); + + $scope.$on("$ionicView.beforeLeave", function(event, data) { + $ionicConfig.views.swipeBackEnabled(true); + }); $scope.$on("$ionicView.beforeEnter", function(event, data) { + $ionicConfig.views.swipeBackEnabled(false); + toAmount = data.stateParams.toAmount; cachedSendMax = {}; $scope.showFeeFiat = false; diff --git a/src/js/controllers/feedback/complete.js b/src/js/controllers/feedback/complete.js index 7832393c0..2c72c7c95 100644 --- a/src/js/controllers/feedback/complete.js +++ b/src/js/controllers/feedback/complete.js @@ -46,6 +46,10 @@ angular.module('copayApp.controllers').controller('completeController', function }); }; + $scope.$on("$ionicView.beforeLeave", function() { + $ionicConfig.views.swipeBackEnabled(true); + }); + $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.score = (data.stateParams && data.stateParams.score) ? parseInt(data.stateParams.score) : null; $scope.skipped = (data.stateParams && data.stateParams.skipped) ? true : false; diff --git a/src/js/controllers/feedback/send.js b/src/js/controllers/feedback/send.js index 1ad539a94..ed363612d 100644 --- a/src/js/controllers/feedback/send.js +++ b/src/js/controllers/feedback/send.js @@ -41,6 +41,10 @@ angular.module('copayApp.controllers').controller('sendController', function($sc if (goHome) $state.go('tabs.home'); }; + $scope.$on("$ionicView.beforeLeave", function(event, data) { + $ionicConfig.views.swipeBackEnabled(true); + }); + $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.isCordova = platformInfo.isCordova; $scope.score = (data.stateParams && data.stateParams.score) ? parseInt(data.stateParams.score) : null; diff --git a/src/js/controllers/onboarding/backupRequest.js b/src/js/controllers/onboarding/backupRequest.js index ca2de91df..53f1d4cc4 100644 --- a/src/js/controllers/onboarding/backupRequest.js +++ b/src/js/controllers/onboarding/backupRequest.js @@ -2,9 +2,16 @@ angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $stateParams, $ionicConfig, popupService, gettextCatalog) { - $ionicConfig.views.swipeBackEnabled(false); $scope.walletId = $stateParams.walletId; + $scope.$on("$ionicView.beforeLeave", function(event, data) { + $ionicConfig.views.swipeBackEnabled(true); + }); + + $scope.$on("$ionicView.beforeEnter", function(event, data) { + $ionicConfig.views.swipeBackEnabled(false); + }); + $scope.openPopup = function() { var title = gettextCatalog.getString('Watch out!'); diff --git a/src/js/controllers/onboarding/collectEmail.js b/src/js/controllers/onboarding/collectEmail.js index ce38b2dc4..2cfaed7b9 100644 --- a/src/js/controllers/onboarding/collectEmail.js +++ b/src/js/controllers/onboarding/collectEmail.js @@ -2,7 +2,14 @@ angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, walletService, platformInfo) { - $ionicConfig.views.swipeBackEnabled(false); + $scope.$on("$ionicView.beforeLeave", function() { + $ionicConfig.views.swipeBackEnabled(true); + }); + + $scope.$on("$ionicView.beforeEnter", function() { + $ionicConfig.views.swipeBackEnabled(false); + }); + var isCordova = platformInfo.isCordova; var isWP = platformInfo.isWP; var usePushNotifications = isCordova && !isWP; @@ -34,8 +41,7 @@ angular.module('copayApp.controllers').controller('collectEmailController', func $state.go('onboarding.backupRequest', { walletId: walletId }); - } - else if (requiresOptIn) { + } else if (requiresOptIn) { $state.go('onboarding.notifications', { walletId: walletId }); diff --git a/src/js/controllers/onboarding/disclaimer.js b/src/js/controllers/onboarding/disclaimer.js index 1f428d356..573cb2ab6 100644 --- a/src/js/controllers/onboarding/disclaimer.js +++ b/src/js/controllers/onboarding/disclaimer.js @@ -12,10 +12,15 @@ angular.module('copayApp.controllers').controller('disclaimerController', functi $scope.accepted = {}; $scope.accepted.first = $scope.accepted.second = $scope.accepted.third = false; $scope.backedUp = $stateParams.backedUp; - $scope.resume = $stateParams.resume; + $scope.resume = $stateParams.resume || false; + if ($scope.backedUp || $scope.resume) $ionicConfig.views.swipeBackEnabled(false); $scope.shrinkView = false; }); + $scope.$on("$ionicView.beforeLeave", function() { + $ionicConfig.views.swipeBackEnabled(true); + }); + $scope.confirm = function() { profileService.setDisclaimerAccepted(function(err) { if (err) $log.error(err); diff --git a/src/js/controllers/onboarding/notifications.js b/src/js/controllers/onboarding/notifications.js index 0b315608f..e6df0bfbf 100644 --- a/src/js/controllers/onboarding/notifications.js +++ b/src/js/controllers/onboarding/notifications.js @@ -2,7 +2,14 @@ angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, $interval) { - $ionicConfig.views.swipeBackEnabled(false); + $scope.$on("$ionicView.beforeEnter", function() { + $ionicConfig.views.swipeBackEnabled(false); + }); + + $scope.$on("$ionicView.beforeLeave", function() { + $ionicConfig.views.swipeBackEnabled(true); + }); + $scope.walletId = $stateParams.walletId; $scope.allowNotif = function() { diff --git a/src/js/controllers/onboarding/welcomeController.js b/src/js/controllers/onboarding/welcomeController.js index 0c76a18b6..3a81fc2f8 100644 --- a/src/js/controllers/onboarding/welcomeController.js +++ b/src/js/controllers/onboarding/welcomeController.js @@ -2,12 +2,18 @@ angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService, startupService, storageService) { - $ionicConfig.views.swipeBackEnabled(false); - $scope.$parent.$on("$ionicView.afterEnter", function() { startupService.ready(); }); + $scope.$on("$ionicView.beforeEnter", function() { + $ionicConfig.views.swipeBackEnabled(false); + }); + + $scope.$on("$ionicView.beforeLeave", function() { + $ionicConfig.views.swipeBackEnabled(true); + }); + $scope.createProfile = function() { $log.debug('Creating profile'); profileService.createProfile(function(err) {