From 984c713a6d8c87b379a5af1f9db6aa97e87d9e2c Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Mon, 12 Sep 2016 10:14:06 -0400 Subject: [PATCH 01/12] finish initial backup phrase view where phrase is shown to user --- public/views/backup.html | 30 +++++++++++--------- src/sass/main.scss | 1 + src/sass/views/wallet-backup-phrase.scss | 36 ++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 src/sass/views/wallet-backup-phrase.scss diff --git a/public/views/backup.html b/public/views/backup.html index 66dddae7e..39df36761 100644 --- a/public/views/backup.html +++ b/public/views/backup.html @@ -1,4 +1,4 @@ - + @@ -14,13 +14,14 @@ ## STEP 1 -->
-
Backup Phrase
-
+
{{word}} 
- - Please carefully write down this phrase - +
+

+ Please carefully write down this phrase +

+
@@ -28,14 +29,15 @@ This recovery phrase was created with a password. To recover this wallet both the recovery phrase and password are needed.
- - +
+ +
-
-
- {{word}}  -
-
-

- Please carefully write down this phrase -

-
- -
- - - This recovery phrase was created with a password. To recover this wallet both the recovery phrase and password are needed. - -
-
- -
+ --> +
+
+ {{word}} 
- - - -
-
Let's verify your backup phrase
- - - -

- Please tap the words in order to confirm your backup phrase is correctly written. -

- - - - -
- - +
+
+ + + +
+
+

+ Please tap each word in the correct order. +

+ + + + +
+
+ - + -->
Enter your password
-
- diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js index ce0cba754..cf0b20c9b 100644 --- a/src/js/controllers/backup.js +++ b/src/js/controllers/backup.js @@ -47,7 +47,7 @@ angular.module('copayApp.controllers').controller('backupController', $scope.initFlow = function() { if (!keys) return; - + $scope.viewTitle = "Backup Phrase"; var words = keys.mnemonic; $scope.mnemonicWords = words.split(/[\u3000\s]+/); @@ -158,8 +158,10 @@ angular.module('copayApp.controllers').controller('backupController', $scope.goToStep = function(n) { if (n == 1) $scope.initFlow(); - if (n == 2) + if (n == 2){ $scope.step = 2; + $scope.viewTitle = "Let's verify your backup phrase"; + } if (n == 3) { if (!$scope.mnemonicHasPassphrase) finalStep(); diff --git a/src/sass/views/wallet-backup-phrase.scss b/src/sass/views/wallet-backup-phrase.scss index 16525bb66..a68f69a5c 100644 --- a/src/sass/views/wallet-backup-phrase.scss +++ b/src/sass/views/wallet-backup-phrase.scss @@ -3,11 +3,17 @@ & ion-content, & ion-content .scroll { height: 100%; + overflow-y: hidden; + } + .bar.bar-royal { + .title { + font-size: 1rem; + } } background: #fff; .backup-phrase { background: rgba(246, 246, 246, 0.87); - padding: 1.5rem 1rem; + padding: .5rem .5rem 1.7rem; border: 2px dashed rgb(206, 206, 206); width: 80%; margin: 2rem auto; @@ -33,4 +39,35 @@ max-width: 400px; } } + .select-word { + background: #fff; + box-shadow: 0px 4px 5px 0px rgba(50, 50, 50, 0.37); + margin: 1rem 0 0; + display: inline-block; + padding: 0 5px; + } + #select-phrase { + background: rgba(246, 246, 246, 0.87); + width: 100%; + text-align: center; + position: absolute; + bottom: 43px; + padding-bottom: 20px; + p { + font-weight: bold; + font-weight: bold; + padding-top: .7rem; + margin-bottom: 0.9rem; + float: left; + width: 100%; + } + .select-word { + &.button[disabled] { + background: transparent !important; + box-shadow: none !important; + color: transparent; + border: 1px solid rgb(211, 211, 211); + } + } + } } From 294b4200f4f680653c6ad20c21b863571acf0945 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Mon, 12 Sep 2016 12:39:29 -0400 Subject: [PATCH 03/12] reduced spring between words in phrase --- src/sass/views/wallet-backup-phrase.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sass/views/wallet-backup-phrase.scss b/src/sass/views/wallet-backup-phrase.scss index a68f69a5c..22794cd53 100644 --- a/src/sass/views/wallet-backup-phrase.scss +++ b/src/sass/views/wallet-backup-phrase.scss @@ -42,7 +42,7 @@ .select-word { background: #fff; box-shadow: 0px 4px 5px 0px rgba(50, 50, 50, 0.37); - margin: 1rem 0 0; + margin: .5rem 0 0; display: inline-block; padding: 0 5px; } From 8b24adb53ceaade78980982e35b904955f9cb98d Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Tue, 13 Sep 2016 14:05:49 -0400 Subject: [PATCH 04/12] added basic modal class styling, styled success modal --- public/views/includes/confirmBackupPopup.html | 43 +- src/js/controllers/backup.js | 374 +++++++++--------- src/sass/forms.scss | 3 + src/sass/main.scss | 1 + .../includes/modals/backup-confirm-modal.scss | 3 + src/sass/views/includes/modals/modals.scss | 47 +++ src/sass/views/wallet-backup-phrase.scss | 2 +- 7 files changed, 272 insertions(+), 201 deletions(-) create mode 100644 src/sass/views/includes/modals/backup-confirm-modal.scss create mode 100644 src/sass/views/includes/modals/modals.scss diff --git a/public/views/includes/confirmBackupPopup.html b/public/views/includes/confirmBackupPopup.html index 5dc2d2eeb..eb60681f7 100644 --- a/public/views/includes/confirmBackupPopup.html +++ b/public/views/includes/confirmBackupPopup.html @@ -1,19 +1,26 @@ -
-
Your bitcoin wallet is backed up!
-

Be sure to store your recovery phrase in a secure place. If this app is deelted, you money coont be recovered with out it.

- -
-
-
uh oh...
-

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

- + diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js index cf0b20c9b..cec5dd02f 100644 --- a/src/js/controllers/backup.js +++ b/src/js/controllers/backup.js @@ -1,199 +1,209 @@ '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) { - var wallet = profileService.getWallet($stateParams.walletId); - $ionicNavBarDelegate.title(wallet.credentials.walletName); - $scope.n = wallet.n; - var keys; + function($rootScope, $scope, $timeout, $log, $state, $stateParams, $ionicPopup, $ionicModal, $ionicNavBarDelegate, uxLanguage, lodash, fingerprintService, platformInfo, configService, profileService, bwcService, walletService, ongoingProcess, storageService) { + var wallet = profileService.getWallet($stateParams.walletId); + $ionicNavBarDelegate.title(wallet.credentials.walletName); + $scope.n = wallet.n; + var keys; - $scope.credentialsEncrypted = wallet.isPrivKeyEncrypted(); + $scope.credentialsEncrypted = wallet.isPrivKeyEncrypted(); - var isDeletedSeed = function() { - if (!wallet.credentials.mnemonic && !wallet.credentials.mnemonicEncrypted) - return true; + var isDeletedSeed = function() { + if (!wallet.credentials.mnemonic && !wallet.credentials.mnemonicEncrypted) + return true; - return false; - }; + return false; + }; - $scope.init = function() { - $scope.deleted = isDeletedSeed(); - if ($scope.deleted) { - $log.debug('no mnemonics'); - return; - } - - walletService.getKeys(wallet, function(err, k) { - if (err || !k) { - $state.go('wallet.preferences'); - return; - } - $scope.credentialsEncrypted = false; - keys = k; - $scope.initFlow(); - }); - }; - - var shuffledWords = function(words) { - var sort = lodash.sortBy(words); - - return lodash.map(sort, function(w) { - return { - word: w, - selected: false - }; - }); - }; - - $scope.initFlow = function() { - if (!keys) return; - $scope.viewTitle = "Backup Phrase"; - var words = keys.mnemonic; - - $scope.mnemonicWords = words.split(/[\u3000\s]+/); - $scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords); - $scope.mnemonicHasPassphrase = wallet.mnemonicHasPassphrase(); - $scope.useIdeograms = words.indexOf("\u3000") >= 0; - $scope.passphrase = ''; - $scope.customWords = []; - $scope.step = 1; - $scope.selectComplete = false; - $scope.backupError = false; - - words = lodash.repeat('x', 300); - $timeout(function() { - $scope.$apply(); - }, 10); - }; - - $scope.goBack = function() { - if ($scope.step == 1) { - if ($stateParams.fromOnboarding) $state.go('onboarding.backupRequest'); - else $state.go('wallet.preferences'); - } else { - $scope.goToStep($scope.step - 1); - } - }; - - var backupError = function(err) { - ongoingProcess.set('validatingWords', false); - $log.debug('Failed to verify backup: ', err); - $scope.backupError = true; - - $timeout(function() { - $scope.$apply(); - }, 1); - }; - - var openPopup = function() { - var confirmBackupPopup = $ionicPopup.show({ - templateUrl: "views/includes/confirmBackupPopup.html", - scope: $scope, - }); - - $scope.closePopup = function(val) { - if (val) { - confirmBackupPopup.close(); - if ($stateParams.fromOnboarding) $state.go('onboarding.disclaimer'); - else $state.go('tabs.home') - } else { - confirmBackupPopup.close(); - $scope.goToStep(1); - } - }; + $scope.init = function() { + $scope.deleted = isDeletedSeed(); + if ($scope.deleted) { + $log.debug('no mnemonics'); + return; } - var confirm = function(cb) { - $scope.backupError = false; - - var customWordList = lodash.pluck($scope.customWords, 'word'); - - if (!lodash.isEqual($scope.mnemonicWords, customWordList)) { - return cb('Mnemonic string mismatch'); + walletService.getKeys(wallet, function(err, k) { + if (err || !k) { + $state.go('wallet.preferences'); + return; } + $scope.credentialsEncrypted = false; + keys = k; + $scope.initFlow(); + }); + }; - $timeout(function() { - if ($scope.mnemonicHasPassphrase) { - var walletClient = bwcService.getClient(); - var separator = $scope.useIdeograms ? '\u3000' : ' '; - var customSentence = customWordList.join(separator); - var passphrase = $scope.passphrase || ''; + var shuffledWords = function(words) { + var sort = lodash.sortBy(words); - try { - walletClient.seedFromMnemonic(customSentence, { - network: wallet.credentials.network, - passphrase: passphrase, - account: wallet.credentials.account - }); - } catch (err) { - walletClient.credentials.xPrivKey = lodash.repeat('x', 64); - return cb(err); - } - - if (walletClient.credentials.xPrivKey.substr(walletClient.credentials.xPrivKey) != keys.xPrivKey) { - delete walletClient.credentials; - return cb('Private key mismatch'); - } - } - - profileService.setBackupFlag(wallet.credentials.walletId); - return cb(); - }, 1); - }; - - var finalStep = function() { - ongoingProcess.set('validatingWords', true); - confirm(function(err) { - ongoingProcess.set('validatingWords', false); - if (err) { - backupError(err); - } - $timeout(function() { - openPopup(); - return; - }, 1); - }); - }; - - $scope.goToStep = function(n) { - if (n == 1) - $scope.initFlow(); - if (n == 2){ - $scope.step = 2; - $scope.viewTitle = "Let's verify your backup phrase"; - } - if (n == 3) { - if (!$scope.mnemonicHasPassphrase) - finalStep(); - else - $scope.step = 3; - } - if (n == 4) - finalStep(); - }; - - $scope.addButton = function(index, item) { - var newWord = { - word: item.word, - prevIndex: index + return lodash.map(sort, function(w) { + return { + word: w, + selected: false }; - $scope.customWords.push(newWord); - $scope.shuffledMnemonicWords[index].selected = true; - $scope.shouldContinue(); - }; + }); + }; - $scope.removeButton = function(index, item) { - if ($scope.loading) return; - $scope.customWords.splice(index, 1); - $scope.shuffledMnemonicWords[item.prevIndex].selected = false; - $scope.shouldContinue(); - }; + $scope.initFlow = function() { + if (!keys) return; + $scope.viewTitle = "Backup Phrase"; + var words = keys.mnemonic; - $scope.shouldContinue = function() { - if ($scope.customWords.length == $scope.shuffledMnemonicWords.length) - $scope.selectComplete = true; - else - $scope.selectComplete = false; - }; + $scope.mnemonicWords = words.split(/[\u3000\s]+/); + $scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords); + $scope.mnemonicHasPassphrase = wallet.mnemonicHasPassphrase(); + $scope.useIdeograms = words.indexOf("\u3000") >= 0; + $scope.passphrase = ''; + $scope.customWords = []; + $scope.step = 1; + $scope.selectComplete = false; + $scope.backupError = false; + words = lodash.repeat('x', 300); + $timeout(function() { + $scope.$apply(); + }, 10); + }; + + $scope.goBack = function() { + if ($scope.step == 1) { + if ($stateParams.fromOnboarding) $state.go('onboarding.backupRequest'); + else $state.go('wallet.preferences'); + } else { + $scope.goToStep($scope.step - 1); + } + }; + + var backupError = function(err) { + ongoingProcess.set('validatingWords', false); + $log.debug('Failed to verify backup: ', err); + $scope.backupError = true; + + $timeout(function() { + $scope.$apply(); + }, 1); + }; + + $scope.closePopup = function(val) { + if (val) { + $scope.closeModal(); + if ($stateParams.fromOnboarding) $state.go('onboarding.disclaimer'); + else $state.go('tabs.home') + } else { + confirmBackupPopup.close(); + $scope.goToStep(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(); + }; + $scope.closeModal = function() { + $scope.modal.hide(); + }; + // Cleanup the modal when we're done with it! + $scope.$on('$destroy', function() { + $scope.modal.remove(); + }); + + var confirm = function(cb) { + $scope.backupError = false; + + var customWordList = lodash.pluck($scope.customWords, 'word'); + + if (!lodash.isEqual($scope.mnemonicWords, customWordList)) { + return cb('Mnemonic string mismatch'); + } + + $timeout(function() { + if ($scope.mnemonicHasPassphrase) { + var walletClient = bwcService.getClient(); + var separator = $scope.useIdeograms ? '\u3000' : ' '; + var customSentence = customWordList.join(separator); + var passphrase = $scope.passphrase || ''; + + try { + walletClient.seedFromMnemonic(customSentence, { + network: wallet.credentials.network, + passphrase: passphrase, + account: wallet.credentials.account + }); + } catch (err) { + walletClient.credentials.xPrivKey = lodash.repeat('x', 64); + return cb(err); + } + + if (walletClient.credentials.xPrivKey.substr(walletClient.credentials.xPrivKey) != keys.xPrivKey) { + delete walletClient.credentials; + return cb('Private key mismatch'); + } + } + + profileService.setBackupFlag(wallet.credentials.walletId); + return cb(); + }, 1); + }; + + var finalStep = function() { + ongoingProcess.set('validatingWords', true); + confirm(function(err) { + ongoingProcess.set('validatingWords', false); + if (err) { + backupError(err); + } + $timeout(function() { + $scope.openModal(); + return; + }, 1); + }); + }; + + $scope.goToStep = function(n) { + if (n == 1) + $scope.initFlow(); + if (n == 2) { + $scope.step = 2; + $scope.viewTitle = "Let's verify your backup phrase"; + } + if (n == 3) { + if (!$scope.mnemonicHasPassphrase) + finalStep(); + else + $scope.step = 3; + } + if (n == 4) + finalStep(); + }; + + $scope.addButton = function(index, item) { + var newWord = { + word: item.word, + prevIndex: index + }; + $scope.customWords.push(newWord); + $scope.shuffledMnemonicWords[index].selected = true; + $scope.shouldContinue(); + }; + + $scope.removeButton = function(index, item) { + if ($scope.loading) return; + $scope.customWords.splice(index, 1); + $scope.shuffledMnemonicWords[item.prevIndex].selected = false; + $scope.shouldContinue(); + }; + + $scope.shouldContinue = function() { + if ($scope.customWords.length == $scope.shuffledMnemonicWords.length) + $scope.selectComplete = true; + else + $scope.selectComplete = false; + }; + +}); diff --git a/src/sass/forms.scss b/src/sass/forms.scss index e69de29bb..2c725b7fd 100644 --- a/src/sass/forms.scss +++ b/src/sass/forms.scss @@ -0,0 +1,3 @@ +.button-clear{ + background: none !important; +} \ No newline at end of file diff --git a/src/sass/main.scss b/src/sass/main.scss index 50c0d36a2..4fe7e362f 100644 --- a/src/sass/main.scss +++ b/src/sass/main.scss @@ -970,3 +970,4 @@ input[type=number] { @import 'views/onboarding/onboarding'; @import "views/includes/walletActivity"; @import "views/includes/wallets"; +@import "views/includes/modals/modals"; diff --git a/src/sass/views/includes/modals/backup-confirm-modal.scss b/src/sass/views/includes/modals/backup-confirm-modal.scss new file mode 100644 index 000000000..430d8cb5c --- /dev/null +++ b/src/sass/views/includes/modals/backup-confirm-modal.scss @@ -0,0 +1,3 @@ +#backup-confirm-modal{ + +} \ No newline at end of file diff --git a/src/sass/views/includes/modals/modals.scss b/src/sass/views/includes/modals/modals.scss new file mode 100644 index 000000000..9a129bacd --- /dev/null +++ b/src/sass/views/includes/modals/modals.scss @@ -0,0 +1,47 @@ +.popup-modal { + background: #fff; + top: 20%; + position: absolute; + z-index: 10; + width: 90%; + left: 5%; + border-radius: .25rem; + &-header { + background: rgb(1, 209, 162); + padding: 1rem; + border-radius: .25rem .25rem 0 0; + min-height: 120px; + &-success { + background: url('../img/onboarding-success.svg') no-repeat center; + height: 6rem; + background-size: contain; + margin-top: .3rem; + } + } + &-content { + padding: .5rem .8rem; + h5,p{ + margin:0 0 1rem; + } + h5 { + color: rgb(74, 74, 74); + font-weight: bold; + font-size: 1.3rem; + margin-top:1rem; + } + p{ + font-weight: 200; + } + } + &-content-success{ + button{ + color:rgb(23, 174, 140) !important; + } + } +} + +.modal-backdrop.active { + background: rgba(0, 0, 0, .5); +} + +@import "backup-confirm-modal"; diff --git a/src/sass/views/wallet-backup-phrase.scss b/src/sass/views/wallet-backup-phrase.scss index 22794cd53..f075dc32f 100644 --- a/src/sass/views/wallet-backup-phrase.scss +++ b/src/sass/views/wallet-backup-phrase.scss @@ -15,7 +15,7 @@ background: rgba(246, 246, 246, 0.87); padding: .5rem .5rem 1.7rem; border: 2px dashed rgb(206, 206, 206); - width: 80%; + width: 90%; margin: 2rem auto; color: rgb(43, 43, 43); text-align: center; From 13c56798fedb8af29d288beb8db995bed20bc2f4 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Tue, 13 Sep 2016 14:15:51 -0400 Subject: [PATCH 05/12] updated language and position on confirm on backup file --- public/views/backup.html | 2 +- public/views/includes/confirmBackupPopup.html | 2 +- src/sass/views/wallet-backup-phrase.scss | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/views/backup.html b/public/views/backup.html index b7c306dd3..7ee507cba 100644 --- a/public/views/backup.html +++ b/public/views/backup.html @@ -44,7 +44,7 @@

Please tap each word in the correct order.

- + diff --git a/public/views/includes/confirmBackupPopup.html b/public/views/includes/confirmBackupPopup.html index eb60681f7..1cb7dfaf6 100644 --- a/public/views/includes/confirmBackupPopup.html +++ b/public/views/includes/confirmBackupPopup.html @@ -9,7 +9,7 @@
diff --git a/src/sass/views/wallet-backup-phrase.scss b/src/sass/views/wallet-backup-phrase.scss index f075dc32f..94c7b5a8d 100644 --- a/src/sass/views/wallet-backup-phrase.scss +++ b/src/sass/views/wallet-backup-phrase.scss @@ -16,7 +16,7 @@ padding: .5rem .5rem 1.7rem; border: 2px dashed rgb(206, 206, 206); width: 90%; - margin: 2rem auto; + margin: 1rem auto; color: rgb(43, 43, 43); text-align: center; span { From ee046cde4e54ef1cbfb3f6e0e4a948c069b84b07 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Tue, 13 Sep 2016 14:35:27 -0400 Subject: [PATCH 06/12] increased modal backdrop opacity with what found in zeplin --- src/sass/views/includes/modals/modals.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sass/views/includes/modals/modals.scss b/src/sass/views/includes/modals/modals.scss index 9a129bacd..ced60fd17 100644 --- a/src/sass/views/includes/modals/modals.scss +++ b/src/sass/views/includes/modals/modals.scss @@ -41,7 +41,7 @@ } .modal-backdrop.active { - background: rgba(0, 0, 0, .5); + background: rgba(0, 0, 0, .8); } @import "backup-confirm-modal"; From a978062425a08b9657cbda5f9bf6e25d24c735db Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 13 Sep 2016 17:00:27 -0300 Subject: [PATCH 07/12] 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
-
diff --git a/public/views/includes/confirmBackupPopup.html b/public/views/includes/confirmBackupPopup.html index 1cb7dfaf6..efe63ee09 100644 --- a/public/views/includes/confirmBackupPopup.html +++ b/public/views/includes/confirmBackupPopup.html @@ -8,7 +8,7 @@

Be sure to store your recovery phrase in a secure place. If this app is deelted, you money cannot be recoved with out it.

@@ -18,8 +18,8 @@ Please review your backup and try again

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 08/12] 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 09/12] 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; From 2a55e3f2327f0fc38cc538ac057ff7b4f37cf8aa Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Wed, 14 Sep 2016 08:29:57 -0400 Subject: [PATCH 10/12] backup view when header is present fixes --- public/views/backup.html | 2 +- src/sass/views/wallet-backup-phrase.scss | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/public/views/backup.html b/public/views/backup.html index 7ee507cba..75225fcf7 100644 --- a/public/views/backup.html +++ b/public/views/backup.html @@ -49,7 +49,7 @@ ng-disabled="shuffledWord.selected">{{shuffledWord.word}} - +