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
parent 3e54619c97
commit 2576b3e790
7 changed files with 36 additions and 40 deletions

View File

@ -1,7 +1,8 @@
'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.openPopup = function() {
@ -18,7 +19,10 @@ angular.module('copayApp.controllers').controller('backupRequestController', fun
var cancelText = gettextCatalog.getString('Go back');
popupService.showConfirm(title, message, okText, cancelText, function(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) {
$scope.walletId = $stateParams.walletId;
$scope.fromState = $stateParams.from;
$scope.toState = $scope.fromState + ".backup";
$scope.openPopup = function() {
$ionicModal.fromTemplateUrl('views/includes/screenshotWarningModal.html', {
scope: $scope,
@ -15,24 +19,15 @@ angular.module('copayApp.controllers').controller('backupWarningController', fun
$scope.close = function() {
$scope.warningModal.hide();
$scope.warningModal.remove();
$timeout(function() {
if ($stateParams.from == 'onboarding.backupRequest') {
$state.go('onboarding.backup', {
walletId: $stateParams.walletId
});
} else {
$state.go($stateParams.from + '.backup', {
walletId: $stateParams.walletId
});
}
$state.go($scope.toState, {
walletId: $scope.walletId
});
};
}
$scope.goBack = function() {
$state.go($stateParams.from, {
walletId: $stateParams.walletId
$state.go($scope.fromState, {
walletId: $scope.walletId
});
};

View File

@ -1,7 +1,8 @@
'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 isWP = platformInfo.isWP;
var usePushNotifications = isCordova && !isWP;

View File

@ -1,10 +1,9 @@
'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) {
$scope.walletId = data.stateParams.walletId;
});
$ionicConfig.views.swipeBackEnabled(false);
$scope.walletId = $stateParams.walletId;
$scope.allowNotif = function() {
$timeout(function() {

View File

@ -1,6 +1,8 @@
'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) {
$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',
views: {
'tab-home@tabs': {
@ -904,30 +904,25 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$ionicPlatform.registerBackButtonAction(function(e) {
//from root tabs view
var fromWelcome = $ionicHistory.currentStateName().match(/welcome/) ? true : false;
var matchHome = $ionicHistory.currentStateName().match(/home/) ? 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 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
var matchWelcome = $ionicHistory.currentStateName().match(/welcome/) ? true : false;
var matchCollectEmail = $ionicHistory.currentStateName().match(/collectEmail/) ? true : false;
var matchBackupRequest = $ionicHistory.currentStateName().match(/backupRequest/) ? true : false;
var matchDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? true : false;
var matchNotifications = $ionicHistory.currentStateName().match(/notifications/) ? true : false;
var matchNotifications = $ionicHistory.currentStateName().match(/onboarding.notifications/) ? true : false;
var fromOnboarding = matchCollectEmail | matchBackupRequest | matchDisclaimer | matchNotifications;
var fromOnboarding = matchCollectEmail | matchBackupRequest | matchNotifications | matchWelcome;
if (fromOnboarding) {
e.preventDefault();
return;
}
if ($ionicHistory.backView() && !fromTabs) {
if ($ionicHistory.backView() && !fromTabs && !fromOnboarding) {
$ionicHistory.goBack();
} else
if ($rootScope.backButtonPressedOnceToExit || fromWelcome) {
if ($rootScope.backButtonPressedOnceToExit) {
ionic.Platform.exitApp();
} else {
$rootScope.backButtonPressedOnceToExit = true;

View File

@ -8,7 +8,7 @@
<div class="cta-buttons">
<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>
<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>
</div>
</ion-content>