reactivate swipeback when leaving a view where swipeback is not enabled

This commit is contained in:
Gabriel Bazán 2017-02-23 14:26:05 -05:00
commit 91b62bb884
8 changed files with 53 additions and 9 deletions

View file

@ -7,10 +7,15 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var countDown = null; var countDown = null;
var cachedSendMax = {}; var cachedSendMax = {};
$scope.isCordova = platformInfo.isCordova; $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) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
$ionicConfig.views.swipeBackEnabled(false);
toAmount = data.stateParams.toAmount; toAmount = data.stateParams.toAmount;
cachedSendMax = {}; cachedSendMax = {};
$scope.showFeeFiat = false; $scope.showFeeFiat = false;

View file

@ -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.$on("$ionicView.beforeEnter", function(event, data) {
$scope.score = (data.stateParams && data.stateParams.score) ? parseInt(data.stateParams.score) : null; $scope.score = (data.stateParams && data.stateParams.score) ? parseInt(data.stateParams.score) : null;
$scope.skipped = (data.stateParams && data.stateParams.skipped) ? true : false; $scope.skipped = (data.stateParams && data.stateParams.skipped) ? true : false;

View file

@ -41,6 +41,10 @@ angular.module('copayApp.controllers').controller('sendController', function($sc
if (goHome) $state.go('tabs.home'); 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.$on("$ionicView.beforeEnter", function(event, data) {
$scope.isCordova = platformInfo.isCordova; $scope.isCordova = platformInfo.isCordova;
$scope.score = (data.stateParams && data.stateParams.score) ? parseInt(data.stateParams.score) : null; $scope.score = (data.stateParams && data.stateParams.score) ? parseInt(data.stateParams.score) : null;

View file

@ -2,9 +2,16 @@
angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $stateParams, $ionicConfig, popupService, gettextCatalog) { angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $stateParams, $ionicConfig, popupService, gettextCatalog) {
$ionicConfig.views.swipeBackEnabled(false);
$scope.walletId = $stateParams.walletId; $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() { $scope.openPopup = function() {
var title = gettextCatalog.getString('Watch out!'); var title = gettextCatalog.getString('Watch out!');

View file

@ -2,7 +2,14 @@
angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, walletService, platformInfo) { 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 isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;
var usePushNotifications = isCordova && !isWP; var usePushNotifications = isCordova && !isWP;
@ -34,8 +41,7 @@ angular.module('copayApp.controllers').controller('collectEmailController', func
$state.go('onboarding.backupRequest', { $state.go('onboarding.backupRequest', {
walletId: walletId walletId: walletId
}); });
} } else if (requiresOptIn) {
else if (requiresOptIn) {
$state.go('onboarding.notifications', { $state.go('onboarding.notifications', {
walletId: walletId walletId: walletId
}); });

View file

@ -12,10 +12,15 @@ angular.module('copayApp.controllers').controller('disclaimerController', functi
$scope.accepted = {}; $scope.accepted = {};
$scope.accepted.first = $scope.accepted.second = $scope.accepted.third = false; $scope.accepted.first = $scope.accepted.second = $scope.accepted.third = false;
$scope.backedUp = $stateParams.backedUp; $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.shrinkView = false;
}); });
$scope.$on("$ionicView.beforeLeave", function() {
$ionicConfig.views.swipeBackEnabled(true);
});
$scope.confirm = function() { $scope.confirm = function() {
profileService.setDisclaimerAccepted(function(err) { profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err); if (err) $log.error(err);

View file

@ -2,7 +2,14 @@
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, $interval) { 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.walletId = $stateParams.walletId;
$scope.allowNotif = function() { $scope.allowNotif = function() {

View file

@ -2,12 +2,18 @@
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService, startupService, storageService) { 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() { $scope.$parent.$on("$ionicView.afterEnter", function() {
startupService.ready(); startupService.ready();
}); });
$scope.$on("$ionicView.beforeEnter", function() {
$ionicConfig.views.swipeBackEnabled(false);
});
$scope.$on("$ionicView.beforeLeave", function() {
$ionicConfig.views.swipeBackEnabled(true);
});
$scope.createProfile = function() { $scope.createProfile = function() {
$log.debug('Creating profile'); $log.debug('Creating profile');
profileService.createProfile(function(err) { profileService.createProfile(function(err) {