Merge pull request #4295 from matiu/bug/angular-twice
Bug/angular twice
This commit is contained in:
commit
5558e91387
10 changed files with 100 additions and 51 deletions
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('importController',
|
||||
function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo) {
|
||||
function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo, bwsError, bwcService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -9,9 +9,11 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
var self = this;
|
||||
var reader = new FileReader();
|
||||
var defaults = configService.getDefaults();
|
||||
var errors = bwcService.getErrors();
|
||||
$scope.bwsurl = defaults.bws.url;
|
||||
$scope.derivationPath = derivationPathHelper.default;
|
||||
$scope.account = 1;
|
||||
self.importErr = false;
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
$scope.$on('$destroy', function() {
|
||||
|
|
@ -20,6 +22,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
}, 100);
|
||||
});
|
||||
|
||||
|
||||
var updateSeedSourceSelect = function() {
|
||||
self.seedOptions = [];
|
||||
|
||||
|
|
@ -52,7 +55,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
try {
|
||||
str2 = sjcl.decrypt(self.password, str);
|
||||
} catch (e) {
|
||||
err = gettext('Could not decrypt file, check your spending password');
|
||||
err = gettext('Could not decrypt file, check your password');
|
||||
$log.warn(e);
|
||||
};
|
||||
|
||||
|
|
@ -91,12 +94,17 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
profileService.importExtendedPrivateKey(xPrivKey, opts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
self.importErr = true;
|
||||
} else {
|
||||
self.error = err;
|
||||
}
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
return $timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
|
|
@ -110,13 +118,19 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$timeout(function() {
|
||||
profileService.importMnemonic(words, opts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
|
||||
if (err) {
|
||||
self.error = err;
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
self.importErr = true;
|
||||
} else {
|
||||
self.error = err;
|
||||
}
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
return $timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
|
|
@ -265,6 +279,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
return;
|
||||
}
|
||||
this.error = '';
|
||||
this.importErr = false;
|
||||
|
||||
var account = +$scope.account;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue