diff --git a/src/js/controllers/onboarding/collectEmail.js b/src/js/controllers/onboarding/collectEmail.js index ab80d215d74..a700c366223 100644 --- a/src/js/controllers/onboarding/collectEmail.js +++ b/src/js/controllers/onboarding/collectEmail.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $log, $timeout, $http, $httpParamSerializer, profileService, configService, walletService, appConfigService) { +angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $log, $timeout, $http, $httpParamSerializer, $ionicConfig, profileService, configService, walletService, appConfigService) { var wallet, walletId; $scope.data = {}; @@ -18,6 +18,14 @@ angular.module('copayApp.controllers').controller('collectEmailController', func }; }; + $scope.$on("$ionicView.beforeLeave", function() { + $ionicConfig.views.swipeBackEnabled(true); + }); + + $scope.$on("$ionicView.enter", function() { + $ionicConfig.views.swipeBackEnabled(false); + }); + $scope.$on("$ionicView.beforeEnter", function(event, data) { walletId = data.stateParams.walletId; wallet = profileService.getWallet(walletId); @@ -47,11 +55,13 @@ angular.module('copayApp.controllers').controller('collectEmailController', func walletService.updateRemotePreferences(wallet, { email: $scope.data.email, }, function(err) { - if (err) $log.warn(err); + if (err) return; configService.set(opts, function(err) { if (err) $log.warn(err); if ($scope.data.accept) collectEmail(); - $scope.goNextView(); + $timeout(function() { + $scope.goNextView(); + }, 200); }); }); };