refactor - add spinner

This commit is contained in:
Javier 2016-06-28 17:29:47 -03:00
commit afc2598d59
5 changed files with 29 additions and 24 deletions

View file

@ -95,8 +95,8 @@
</div> </div>
</div> </div>
<div class="containter text-center p50t" ng-show="exportQR"> <div class="containter text-center" ng-show="exportQR">
<qrcode size="220" version="10" error-correction-level="M" data="{{exportWalletInfo}}"></qrcode> <qrcode size="220" version="8" error-correction-level="M" data="{{exportWalletInfo}}"></qrcode>
<span translate></span> <span translate></span>
</div> </div>

View file

@ -69,7 +69,7 @@
<label for="passphrase" class="oh"><span translate>Password</span> <small translate>The Wallet Recovery Phrase could require a password to be imported</small> <label for="passphrase" class="oh"><span translate>Password</span> <small translate>The Wallet Recovery Phrase could require a password to be imported</small>
<div class="input"> <div class="input">
<input type="password" class="form-control" placeholder="{{'Password'|translate}}" <input type="password" class="form-control" placeholder="{{'Password'|translate}}"
name="passphrase" ng-model="import.passphrase"> name="passphrase" ng-model="passphrase">
</div> </div>
</label> </label>

View file

@ -10,7 +10,6 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.isCordova = platformInfo.isCordova; $scope.isCordova = platformInfo.isCordova;
$scope.isSafari = platformInfo.isSafari; $scope.isSafari = platformInfo.isSafari;
$scope.error = null; $scope.error = null;
console.log(fc.credentials);
$scope.init = function(state) { $scope.init = function(state) {
$scope.QROpts = false; $scope.QROpts = false;
@ -80,9 +79,7 @@ angular.module('copayApp.controllers').controller('exportController',
} }
} }
var code = info.type + '|' + c.network.charAt(0).toLowerCase() + '|' + info.data + '|' + c.account + '|' + c.derivationStrategy + return info.type + '|' + info.data;
'|' + (c.mnemonicHasPassphrase || null);
return code;
}; };
$scope.downloadWalletBackup = function() { $scope.downloadWalletBackup = function() {

View file

@ -36,35 +36,42 @@ angular.module('copayApp.controllers').controller('importController',
}; };
$scope.processCode = function(code) { $scope.processCode = function(code) {
ongoingProcess.set('processingCode', true);
self.importErr = false;
var parsedCode = code.split('|'); var parsedCode = code.split('|');
var derivationStrategy = "44'";
var networkVal; if (parsedCode.length != 2) {
ongoingProcess.set('processingCode', false);
return;
}
var info = { var info = {
type: parsedCode[0], type: parsedCode[0],
network: parsedCode[1], data: parsedCode[1],
data: parsedCode[2],
account: parsedCode[3],
derivationStrategy: parsedCode[4],
hasPassphrase: parsedCode[5]
}; };
$scope.words = info.data; var client = bwcService.getClient(null, null);
if (info.network == 't') { if (info.type == 1) {
networkVal = "1'"; client.seedFromMnemonic(info.data, {});
$scope.testnetEnabled = true; }
} else { if (info.type == 2) {
networkVal = "0'"; client.seedFromExtendedPrivateKey(info.data, {});
$scope.testnetEnabled = false; }
if (info.type == 3) {
client.seedFromExtendedPublicKey(info.data, {});
} }
if (info.derivationStrategy == 'BIP45' || info.derivationStrategy == 'BIP48') $scope.words = info.data;
derivationStrategy = info.derivationStrategy.substring(3, 5) + "'"; $scope.derivationPath = client.credentials.getBaseAddressDerivationPath();
$scope.derivationPath = "m/" + derivationStrategy + '/' + networkVal + '/' + info.account + "'"; if (client.credentials.network == 'testnet')
$scope.testnetEnabled = true;
else
$scope.testnetEnabled = false;
$timeout(function() { $timeout(function() {
ongoingProcess.set('processingCode', false);
$rootScope.$apply(); $rootScope.$apply();
}, 1); }, 1);
}; };

View file

@ -28,6 +28,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
'importingWallet': gettext('Importing Wallet...'), 'importingWallet': gettext('Importing Wallet...'),
'sweepingWallet': gettext('Sweeping Wallet...'), 'sweepingWallet': gettext('Sweeping Wallet...'),
'deletingWallet': gettext('Deleting Wallet...'), 'deletingWallet': gettext('Deleting Wallet...'),
'processingCode': gettext('Processing code...'),
}; };
root.clear = function() { root.clear = function() {