From a978062425a08b9657cbda5f9bf6e25d24c735db Mon Sep 17 00:00:00 2001
From: Javier
Date: Tue, 13 Sep 2016 17:00:27 -0300
Subject: [PATCH 1/3] fix backup flow
---
public/views/backup.html | 4 +-
public/views/includes/confirmBackupPopup.html | 6 +-
src/js/controllers/backup.js | 62 +++++++++----------
3 files changed, 34 insertions(+), 38 deletions(-)
diff --git a/public/views/backup.html b/public/views/backup.html
index 7ee507cba..54878d0b6 100644
--- a/public/views/backup.html
+++ b/public/views/backup.html
@@ -59,9 +59,9 @@
Enter your password
-
Ok
+ ng-click="closeBackupResultModal()">
+ Ok
diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js
index 1cf2cc0ed..68aa23a66 100644
--- a/src/js/controllers/backup.js
+++ b/src/js/controllers/backup.js
@@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('backupController',
- function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, $ionicNavBarDelegate, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, bwcService, walletService, ongoingProcess, storageService, popupService, gettextCatalog, $ionicModal) {
+ function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, $ionicHistory, $ionicNavBarDelegate, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, bwcService, walletService, ongoingProcess, storageService, popupService, gettextCatalog, $ionicModal) {
var wallet = profileService.getWallet($stateParams.walletId);
$ionicNavBarDelegate.title(wallet.credentials.walletName);
$scope.n = wallet.n;
@@ -50,12 +50,13 @@ angular.module('copayApp.controllers').controller('backupController',
if (!keys) return;
var words = keys.mnemonic;
+ $scope.data = {};
$scope.mnemonicWords = words.split(/[\u3000\s]+/);
$scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords);
$scope.mnemonicHasPassphrase = wallet.mnemonicHasPassphrase();
$scope.useIdeograms = words.indexOf("\u3000") >= 0;
- $scope.passphrase = '';
+ $scope.data.passphrase = null;
$scope.customWords = [];
$scope.step = 1;
$scope.selectComplete = false;
@@ -86,44 +87,39 @@ angular.module('copayApp.controllers').controller('backupController',
}, 1);
};
- $ionicModal.fromTemplateUrl('views/includes/confirmBackupPopup.html', {
- scope: $scope,
- animation: 'slide-in-up'
- }).then(function(modal) {
- $scope.modal = modal;
- });
- $scope.openModal = function() {
- $scope.modal.show();
+ function openConfirmBackupModal() {
+ $ionicModal.fromTemplateUrl('views/includes/confirmBackupPopup.html', {
+ scope: $scope,
+ backdropClickToClose: false,
+ hardwareBackButtonClose: false
+ }).then(function(modal) {
+ $scope.confirmBackupModal = modal;
+ $scope.confirmBackupModal.show();
+ });
};
- $scope.closeModal = function() {
- $scope.modal.hide();
- };
- // Cleanup the modal when we're done with it!
- $scope.$on('$destroy', function() {
- $scope.modal.remove();
- });
-
- var openPopup = function() {
+ var showBackupResult = function() {
if ($scope.backupError) {
var title = gettextCatalog.getString('uh oh...');
var message = gettextCatalog.getString("It's importante that you write your backup phrase down correctly. If something happens to your wallet, you'll need this backup to recover your money Please review your backup and try again");
popupService.showAlert(title, message, function() {
$scope.goToStep(1);
})
+ } else {
+ openConfirmBackupModal();
}
- else {
- $scope.openModal();
- $scope.closePopup = function() {
- $scope.closeModal();
- if ($stateParams.fromOnboarding) $state.go('onboarding.disclaimer');
- else {
- $ionicHistory.clearHistory();
- $state.go('tabs.home')
- }
- };
+ };
+
+ $scope.closeBackupResultModal = function() {
+ $scope.confirmBackupModal.hide();
+
+ if ($stateParams.fromOnboarding) {
+ $state.go('onboarding.disclaimer');
+ } else {
+ $ionicHistory.clearHistory();
+ $state.go('tabs.home');
}
- }
+ };
var confirm = function(cb) {
$scope.backupError = false;
@@ -139,7 +135,7 @@ angular.module('copayApp.controllers').controller('backupController',
var walletClient = bwcService.getClient();
var separator = $scope.useIdeograms ? '\u3000' : ' ';
var customSentence = customWordList.join(separator);
- var passphrase = $scope.passphrase || '';
+ var passphrase = $scope.data.passphrase || '';
try {
walletClient.seedFromMnemonic(customSentence, {
@@ -171,7 +167,7 @@ angular.module('copayApp.controllers').controller('backupController',
backupError(err);
}
$timeout(function() {
- openPopup();
+ showBackupResult();
return;
}, 1);
});
@@ -216,4 +212,4 @@ angular.module('copayApp.controllers').controller('backupController',
$scope.selectComplete = false;
};
- });
\ No newline at end of file
+ });
From 88c9e48ad93492e7fb83345edc7fda27866f7d29 Mon Sep 17 00:00:00 2001
From: Javier
Date: Tue, 13 Sep 2016 17:44:06 -0300
Subject: [PATCH 2/3] fix title
---
src/js/controllers/backup.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js
index 68aa23a66..44a5f4536 100644
--- a/src/js/controllers/backup.js
+++ b/src/js/controllers/backup.js
@@ -3,7 +3,7 @@
angular.module('copayApp.controllers').controller('backupController',
function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, $ionicHistory, $ionicNavBarDelegate, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, bwcService, walletService, ongoingProcess, storageService, popupService, gettextCatalog, $ionicModal) {
var wallet = profileService.getWallet($stateParams.walletId);
- $ionicNavBarDelegate.title(wallet.credentials.walletName);
+ $scope.viewTitle = wallet.name || wallet.credentials.walletName;
$scope.n = wallet.n;
var keys;
From da5b7d6aff1be1dca4d94ce2d705571fe259e8e9 Mon Sep 17 00:00:00 2001
From: Javier
Date: Tue, 13 Sep 2016 17:51:05 -0300
Subject: [PATCH 3/3] clean unused services
---
src/js/controllers/backup.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js
index 44a5f4536..aed2ee4df 100644
--- a/src/js/controllers/backup.js
+++ b/src/js/controllers/backup.js
@@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('backupController',
- function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, $ionicHistory, $ionicNavBarDelegate, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, bwcService, walletService, ongoingProcess, storageService, popupService, gettextCatalog, $ionicModal) {
+ function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, lodash, profileService, bwcService, walletService, ongoingProcess, popupService, gettextCatalog, $ionicModal) {
var wallet = profileService.getWallet($stateParams.walletId);
$scope.viewTitle = wallet.name || wallet.credentials.walletName;
$scope.n = wallet.n;