fix backup flow
This commit is contained in:
parent
ee046cde4e
commit
a978062425
3 changed files with 34 additions and 38 deletions
|
|
@ -59,9 +59,9 @@
|
||||||
<h5 translate>Enter your password</h5>
|
<h5 translate>Enter your password</h5>
|
||||||
<label class="item item-input item-stacked-label">
|
<label class="item item-input item-stacked-label">
|
||||||
<span class="input-label" transalate>In order to verify your wallet backup, please type your password:</span>
|
<span class="input-label" transalate>In order to verify your wallet backup, please type your password:</span>
|
||||||
<input type="text" id="passphrase" ng-model="passphrase" autocapitalize="off" spellcheck="false" autofocus/>
|
<input type="text" id="passphrase" ng-model="data.passphrase" autocapitalize="off" spellcheck="false" autofocus/>
|
||||||
</label>
|
</label>
|
||||||
<button ng-disabled="!passphrase" class="button button-block button-positive" ng-click="goToStep(4);" translate>Confirm
|
<button ng-disabled="!data.passphrase" class="button button-block button-positive" ng-click="goToStep(4);" translate>Confirm
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<p translate> Be sure to store your recovery phrase in a secure place. If this app is deelted, you money cannot be recoved with out it.</p>
|
<p translate> Be sure to store your recovery phrase in a secure place. If this app is deelted, you money cannot be recoved with out it.</p>
|
||||||
<button
|
<button
|
||||||
class="button button-clear expand"
|
class="button button-clear expand"
|
||||||
ng-click="closePopup(true)"
|
ng-click="closeBackupResultModal()"
|
||||||
translate>I Understand
|
translate>I Understand
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
Please review your backup and try again</p>
|
Please review your backup and try again</p>
|
||||||
<button
|
<button
|
||||||
class="button button-block button-stable"
|
class="button button-block button-stable"
|
||||||
ng-click="closePopup(false)"
|
ng-click="closeBackupResultModal()">
|
||||||
translate>Ok
|
Ok
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('backupController',
|
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);
|
var wallet = profileService.getWallet($stateParams.walletId);
|
||||||
$ionicNavBarDelegate.title(wallet.credentials.walletName);
|
$ionicNavBarDelegate.title(wallet.credentials.walletName);
|
||||||
$scope.n = wallet.n;
|
$scope.n = wallet.n;
|
||||||
|
|
@ -50,12 +50,13 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
if (!keys) return;
|
if (!keys) return;
|
||||||
|
|
||||||
var words = keys.mnemonic;
|
var words = keys.mnemonic;
|
||||||
|
$scope.data = {};
|
||||||
|
|
||||||
$scope.mnemonicWords = words.split(/[\u3000\s]+/);
|
$scope.mnemonicWords = words.split(/[\u3000\s]+/);
|
||||||
$scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords);
|
$scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords);
|
||||||
$scope.mnemonicHasPassphrase = wallet.mnemonicHasPassphrase();
|
$scope.mnemonicHasPassphrase = wallet.mnemonicHasPassphrase();
|
||||||
$scope.useIdeograms = words.indexOf("\u3000") >= 0;
|
$scope.useIdeograms = words.indexOf("\u3000") >= 0;
|
||||||
$scope.passphrase = '';
|
$scope.data.passphrase = null;
|
||||||
$scope.customWords = [];
|
$scope.customWords = [];
|
||||||
$scope.step = 1;
|
$scope.step = 1;
|
||||||
$scope.selectComplete = false;
|
$scope.selectComplete = false;
|
||||||
|
|
@ -86,44 +87,39 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
}, 1);
|
}, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
$ionicModal.fromTemplateUrl('views/includes/confirmBackupPopup.html', {
|
function openConfirmBackupModal() {
|
||||||
scope: $scope,
|
$ionicModal.fromTemplateUrl('views/includes/confirmBackupPopup.html', {
|
||||||
animation: 'slide-in-up'
|
scope: $scope,
|
||||||
}).then(function(modal) {
|
backdropClickToClose: false,
|
||||||
$scope.modal = modal;
|
hardwareBackButtonClose: false
|
||||||
});
|
}).then(function(modal) {
|
||||||
$scope.openModal = function() {
|
$scope.confirmBackupModal = modal;
|
||||||
$scope.modal.show();
|
$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) {
|
if ($scope.backupError) {
|
||||||
var title = gettextCatalog.getString('uh oh...');
|
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");
|
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() {
|
popupService.showAlert(title, message, function() {
|
||||||
$scope.goToStep(1);
|
$scope.goToStep(1);
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
openConfirmBackupModal();
|
||||||
}
|
}
|
||||||
else {
|
};
|
||||||
$scope.openModal();
|
|
||||||
$scope.closePopup = function() {
|
$scope.closeBackupResultModal = function() {
|
||||||
$scope.closeModal();
|
$scope.confirmBackupModal.hide();
|
||||||
if ($stateParams.fromOnboarding) $state.go('onboarding.disclaimer');
|
|
||||||
else {
|
if ($stateParams.fromOnboarding) {
|
||||||
$ionicHistory.clearHistory();
|
$state.go('onboarding.disclaimer');
|
||||||
$state.go('tabs.home')
|
} else {
|
||||||
}
|
$ionicHistory.clearHistory();
|
||||||
};
|
$state.go('tabs.home');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
var confirm = function(cb) {
|
var confirm = function(cb) {
|
||||||
$scope.backupError = false;
|
$scope.backupError = false;
|
||||||
|
|
@ -139,7 +135,7 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
var walletClient = bwcService.getClient();
|
var walletClient = bwcService.getClient();
|
||||||
var separator = $scope.useIdeograms ? '\u3000' : ' ';
|
var separator = $scope.useIdeograms ? '\u3000' : ' ';
|
||||||
var customSentence = customWordList.join(separator);
|
var customSentence = customWordList.join(separator);
|
||||||
var passphrase = $scope.passphrase || '';
|
var passphrase = $scope.data.passphrase || '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
walletClient.seedFromMnemonic(customSentence, {
|
walletClient.seedFromMnemonic(customSentence, {
|
||||||
|
|
@ -171,7 +167,7 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
backupError(err);
|
backupError(err);
|
||||||
}
|
}
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
openPopup();
|
showBackupResult();
|
||||||
return;
|
return;
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
|
|
@ -216,4 +212,4 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
$scope.selectComplete = false;
|
$scope.selectComplete = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue