disable hardware backbutton (android) and back swipe (ios) and more fixes

This commit is contained in:
Gabriel Bazán 2016-10-10 17:12:14 -03:00
commit 2576b3e790
7 changed files with 36 additions and 40 deletions

View file

@ -1,7 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $stateParams, 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.openPopup = function() { $scope.openPopup = function() {
@ -18,7 +19,10 @@ angular.module('copayApp.controllers').controller('backupRequestController', fun
var cancelText = gettextCatalog.getString('Go back'); var cancelText = gettextCatalog.getString('Go back');
popupService.showConfirm(title, message, okText, cancelText, function(val) { popupService.showConfirm(title, message, okText, cancelText, function(val) {
if (val) { if (val) {
$state.go('onboarding.disclaimer', {walletId: $scope.walletId, backedUp: false}); $state.go('onboarding.disclaimer', {
walletId: $scope.walletId,
backedUp: false
});
} }
}); });
} }

View file

@ -2,6 +2,10 @@
angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $timeout, $stateParams, $ionicModal) { angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $timeout, $stateParams, $ionicModal) {
$scope.walletId = $stateParams.walletId;
$scope.fromState = $stateParams.from;
$scope.toState = $scope.fromState + ".backup";
$scope.openPopup = function() { $scope.openPopup = function() {
$ionicModal.fromTemplateUrl('views/includes/screenshotWarningModal.html', { $ionicModal.fromTemplateUrl('views/includes/screenshotWarningModal.html', {
scope: $scope, scope: $scope,
@ -15,24 +19,15 @@ angular.module('copayApp.controllers').controller('backupWarningController', fun
$scope.close = function() { $scope.close = function() {
$scope.warningModal.hide(); $scope.warningModal.hide();
$scope.warningModal.remove(); $scope.warningModal.remove();
$state.go($scope.toState, {
$timeout(function() { walletId: $scope.walletId
if ($stateParams.from == 'onboarding.backupRequest') {
$state.go('onboarding.backup', {
walletId: $stateParams.walletId
});
} else {
$state.go($stateParams.from + '.backup', {
walletId: $stateParams.walletId
});
}
}); });
}; };
} }
$scope.goBack = function() { $scope.goBack = function() {
$state.go($stateParams.from, { $state.go($scope.fromState, {
walletId: $stateParams.walletId walletId: $scope.walletId
}); });
}; };

View file

@ -1,7 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $timeout, $stateParams, profileService, configService, walletService, platformInfo) { angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, walletService, platformInfo) {
$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;

View file

@ -1,10 +1,9 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, profileService, configService) { angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService) {
$scope.$on("$ionicView.enter", function(event, data) { $ionicConfig.views.swipeBackEnabled(false);
$scope.walletId = data.stateParams.walletId; $scope.walletId = $stateParams.walletId;
});
$scope.allowNotif = function() { $scope.allowNotif = function() {
$timeout(function() { $timeout(function() {

View file

@ -1,6 +1,8 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $log, profileService) { angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService) {
$ionicConfig.views.swipeBackEnabled(false);
$scope.goImport = function(code) { $scope.goImport = function(code) {
$state.go('onboarding.import', { $state.go('onboarding.import', {

View file

@ -832,13 +832,13 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} }
}) })
/* /*
* *
* BitPay Card * BitPay Card
* *
*/ */
.state('tabs.bitpayCard', { .state('tabs.bitpayCard', {
url: '/bitpay-card', url: '/bitpay-card',
views: { views: {
'tab-home@tabs': { 'tab-home@tabs': {
@ -904,30 +904,25 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$ionicPlatform.registerBackButtonAction(function(e) { $ionicPlatform.registerBackButtonAction(function(e) {
//from root tabs view //from root tabs view
var fromWelcome = $ionicHistory.currentStateName().match(/welcome/) ? true : false;
var matchHome = $ionicHistory.currentStateName().match(/home/) ? true : false; var matchHome = $ionicHistory.currentStateName().match(/home/) ? true : false;
var matchReceive = $ionicHistory.currentStateName().match(/receive/) ? true : false; var matchReceive = $ionicHistory.currentStateName().match(/receive/) ? true : false;
var matchScan = $ionicHistory.currentStateName().match(/scan/) ? true : false;
var matchSend = $ionicHistory.currentStateName().match(/send/) ? true : false; var matchSend = $ionicHistory.currentStateName().match(/send/) ? true : false;
var matchSettings = $ionicHistory.currentStateName().match(/settings/) ? true : false; var matchSettings = $ionicHistory.currentStateName().match(/settings/) ? true : false;
var fromTabs = matchHome | matchReceive | matchSend | matchSettings; var fromTabs = matchHome | matchReceive | matchScan | matchSend | matchSettings;
//onboarding with no back views //onboarding with no back views
var matchWelcome = $ionicHistory.currentStateName().match(/welcome/) ? true : false;
var matchCollectEmail = $ionicHistory.currentStateName().match(/collectEmail/) ? true : false; var matchCollectEmail = $ionicHistory.currentStateName().match(/collectEmail/) ? true : false;
var matchBackupRequest = $ionicHistory.currentStateName().match(/backupRequest/) ? true : false; var matchBackupRequest = $ionicHistory.currentStateName().match(/backupRequest/) ? true : false;
var matchDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? true : false; var matchNotifications = $ionicHistory.currentStateName().match(/onboarding.notifications/) ? true : false;
var matchNotifications = $ionicHistory.currentStateName().match(/notifications/) ? true : false;
var fromOnboarding = matchCollectEmail | matchBackupRequest | matchDisclaimer | matchNotifications; var fromOnboarding = matchCollectEmail | matchBackupRequest | matchNotifications | matchWelcome;
if (fromOnboarding) { if ($ionicHistory.backView() && !fromTabs && !fromOnboarding) {
e.preventDefault();
return;
}
if ($ionicHistory.backView() && !fromTabs) {
$ionicHistory.goBack(); $ionicHistory.goBack();
} else } else
if ($rootScope.backButtonPressedOnceToExit || fromWelcome) { if ($rootScope.backButtonPressedOnceToExit) {
ionic.Platform.exitApp(); ionic.Platform.exitApp();
} else { } else {
$rootScope.backButtonPressedOnceToExit = true; $rootScope.backButtonPressedOnceToExit = true;

View file

@ -8,7 +8,7 @@
<div class="cta-buttons"> <div class="cta-buttons">
<i class="ion-ios-arrow-thin-down" id="arrow-down"></i> <i class="ion-ios-arrow-thin-down" id="arrow-down"></i>
<div class="onboarding-tldr" id="backup-tldr" translate>Your wallet is never saved to cloud storage or standard device backups.</div> <div class="onboarding-tldr" id="backup-tldr" translate>Your wallet is never saved to cloud storage or standard device backups.</div>
<button class="button button-standard button-primary" ui-sref="onboarding.backupWarning({from: 'onboarding.backupRequest', walletId: walletId})" translate>Backup wallet</button> <button class="button button-standard button-primary" ui-sref="onboarding.backupWarning({from: 'onboarding', walletId: walletId})" translate>Backup wallet</button>
<button class="button button-standard button-secondary button-clear" ng-click="openPopup()" translate>I'll backup my wallet later</button> <button class="button button-standard button-secondary button-clear" ng-click="openPopup()" translate>I'll backup my wallet later</button>
</div> </div>
</ion-content> </ion-content>