diff --git a/public/views/create.html b/public/views/create.html index e6101d1f8..ddfc90ec4 100644 --- a/public/views/create.html +++ b/public/views/create.html @@ -56,21 +56,19 @@ -
-
- -
-
- -
+
+ +
+
+
@@ -98,27 +96,25 @@
+
- -
- -
+
+ +
+
+ +
-
- -
- -
Multiple wallets accounts are supported on the device simultaneously. Select which account should be used for this wallet
- - - - +
+ + + + WARNING: Passphrase cannot be recovered. Be sure to write it down. The wallet can not be restored without the passphrase. + + +
+
+ +
-
+
+ +
-
- - - - WARNING: Passphrase cannot be recovered. Be sure to write it down. The wallet can not be restored without the passphrase. - - -
-
+
+ +
+ +
+ +
+
+
- - + + +
diff --git a/public/views/import.html b/public/views/import.html index 4a59ba493..070aa4764 100644 --- a/public/views/import.html +++ b/public/views/import.html @@ -30,8 +30,6 @@ - -
@@ -46,21 +44,21 @@
-
-
-
-
- - {{import.error|translate}} - -
+
+
+ +
+ + {{import.error|translate}} + +
-
- - -
+
+ + +
- - -
+ +
+
+
+
+
+
+ + {{import.error|translate}} + +
- -
- + +
+
+
+ + {{import.error|translate}} + +
+ +
+
+
+ No harware wallets supported on this device +
+
+
+ +
+ +
+ +
+ +
+ + +
Multiple wallets accounts are supported on the device simultaneously. Select which account should be imported
@@ -152,100 +222,16 @@
- - -
-

Have a Backup from Copay v0.9?

- -
- -
-
- -
-
-
- - {{import.error|translate}} - -
- -
-
- - - - -
-
- - -
-
-
-
- -
-
- - -
-
- - -
-
- - - -
-
- -
+
+
+
- - +
diff --git a/public/views/includes/walletInfo.html b/public/views/includes/walletInfo.html index e1439551b..9588159de 100644 --- a/public/views/includes/walletInfo.html +++ b/public/views/includes/walletInfo.html @@ -3,4 +3,7 @@
External Private Key: {{index.externalSource}} + (Account: + #{{index.account || 0}}) +
diff --git a/public/views/join.html b/public/views/join.html index d82c6b3ba..3ec49f38a 100644 --- a/public/views/join.html +++ b/public/views/join.html @@ -32,118 +32,123 @@
-
-
+
+
+
+
+ + {{join.error|translate}} + +
-
- - {{join.error|translate}} - -
- - +
+
-
- - - - Wallet Invitation is not valid! - - +
+ + + + Wallet Invitation is not valid! + + +
+ +
+ +
+
+
-
- -
- -
-
- - +
+ - Show advanced options - Hide advanced options - - + Show advanced options + Hide advanced options + + -
-
+
- +
+
+
+ +
- +
+ +
- - - +
+ + + + WARNING: Passphrase cannot be recovered. Be sure to write it down. The wallet can not be restored without the passphrase. + + +
- - +
+ +
- -
-
+
+ +
-
- - - - WARNING: Passphrase cannot be recovered. Be sure to write it down. The wallet can not be restored without the passphrase. - - -
+
+ +
+
+
- - -
-
+ +
+
+
diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 6fe50212d..3e343eb67 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -48,9 +48,8 @@ angular.module('copayApp.controllers').controller('createController', label: gettext('Specify Seed...'), }]; $scope.seedSource = self.seedOptions[0]; - - // TODO - // if (!isChromeApp) return; +// TODO +// if (!isChromeApp) return; if (n > 1) self.seedOptions.push({ @@ -187,6 +186,7 @@ angular.module('copayApp.controllers').controller('createController', $scope.$on("$destroy", function() { $rootScope.hideWalletNavigation = false; }); + updateSeedSourceSelect(1); - self.seedSourceId = 'new' + self.setSeedSource('new'); }); diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index ef4bfb4a2..92958df0e 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('importController', - function($scope, $rootScope, $location, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor) { + function($scope, $rootScope, $location, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, isChromeApp) { var self = this; var reader = new FileReader(); @@ -15,6 +15,25 @@ angular.module('copayApp.controllers').controller('importController', }, 100); }); + var updateSeedSourceSelect = function() { + self.seedOptions = []; +// TODO +// if (!isChromeApp) return; + + self.seedOptions.push({ + id: 'ledger', + label: gettext('Ledger Hardware Wallet'), + }); + + self.seedOptions.push({ + id: 'trezor', + label: gettext('Trezor Hardware Wallet'), + }); + $scope.seedSource = self.seedOptions[0]; + }; + + + this.setType = function(type) { $scope.type = type; this.error = null; @@ -178,19 +197,8 @@ angular.module('copayApp.controllers').controller('importController', _importMnemonic(words, opts); }; - this.importTrezor = function(form) { + this.importTrezor = function(account, isMultisig) { var self = this; - if (form.$invalid) { - this.error = gettext('There is an error in the form'); - $timeout(function() { - $scope.$apply(); - }); - return; - } - self.hwWallet = 'Trezor'; - var account = form.account.$modelValue; - var isMultisig = form.isMultisig.$modelValue; - trezor.getInfoForNewWallet(isMultisig, account, function(err, lopts) { self.hwWallet = false; if (err) { @@ -219,8 +227,7 @@ angular.module('copayApp.controllers').controller('importController', }, 100); }; - this.importLedger = function(form) { - var self = this; + this.importHW = function(form) { if (form.$invalid) { this.error = gettext('There is an error in the form'); $timeout(function() { @@ -228,8 +235,40 @@ angular.module('copayApp.controllers').controller('importController', }); return; } - self.hwWallet = 'Ledger'; - var account = form.account.$modelValue; + + var account = $scope.account; + var isMultisig = form.isMultisig.$modelValue; + + switch (self.seedSourceId) { + case ('ledger'): + self.hwWallet = 'Ledger'; + self.importLedger(account); + break; + case ('trezor'): + self.hwWallet = 'Trezor'; + self.importTrezor(account, isMultisig); + break; + default: + throw ('Error: bad source id'); + }; + }; + + this.setSeedSource = function() { + if (!$scope.seedSource) return; + self.seedSourceId = $scope.seedSource.id; + + if (self.seedSourceId == 'ledger') + self.accountValues = lodash.range(0, 99); + else + self.accountValues = lodash.range(1, 100); + + $timeout(function() { + $rootScope.$apply(); + }); + }; + + this.importLedger = function(account) { + var self = this; ledger.getInfoForNewWallet(true, account, function(err, lopts) { self.hwWallet = false; if (err) { @@ -257,4 +296,6 @@ angular.module('copayApp.controllers').controller('importController', }, 100); }; + updateSeedSourceSelect(); + self.setSeedSource('new'); }); diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index df5c45a21..2e7979407 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -107,6 +107,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.canSign = fc.canSign(); self.isPrivKeyExternal = fc.isPrivKeyExternal(); self.externalSource = fc.getPrivKeyExternalSourceName(); + self.account = fc.credentials.account; + + if (self.externalSource == 'trezor') + self.account++; + self.txps = []; self.copayers = []; self.updateColor(); diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 5a4ffe4bc..40bc9806f 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('joinController', - function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, storageService, applicationService, $modal, gettext, lodash, ledger, trezor) { + function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, isChromeApp) { var self = this; var defaults = configService.getDefaults(); @@ -13,6 +13,44 @@ angular.module('copayApp.controllers').controller('joinController', $scope.joinForm.secret.$render(); }; + + var updateSeedSourceSelect = function() { + self.seedOptions = [{ + id: 'new', + label: gettext('New Random Seed'), + }, { + id: 'set', + label: gettext('Specify Seed...'), + }]; + $scope.seedSource = self.seedOptions[0]; + +// TODO +// if (!isChromeApp) return; + + self.seedOptions.push({ + id: 'ledger', + label: gettext('Ledger Hardware Wallet'), + }); + + self.seedOptions.push({ + id: 'trezor', + label: gettext('Trezor Hardware Wallet'), + }); + }; + + this.setSeedSource = function(src) { + self.seedSourceId = $scope.seedSource.id; + + if (self.seedSourceId == 'ledger') + self.accountValues = lodash.range(0, 99); + else + self.accountValues = lodash.range(1, 100); + + $timeout(function() { + $rootScope.$apply(); + }); + }; + this.join = function(form) { if (form && form.$invalid) { self.error = gettext('Please enter the required fields'); @@ -26,7 +64,7 @@ angular.module('copayApp.controllers').controller('joinController', bwsurl: $scope.bwsurl } - var setSeed = form.setSeed.$modelValue; + var setSeed = self.seedSourceId =='set'; if (setSeed) { var words = form.privateKey.$modelValue; if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) { @@ -44,10 +82,14 @@ angular.module('copayApp.controllers').controller('joinController', return; } - if (form.hwLedger.$modelValue || form.hwTrezor.$modelValue) { - self.hwWallet = form.hwLedger.$modelValue ? 'Ledger' : 'TREZOR'; - var src = form.hwLedger.$modelValue ? ledger : trezor; - var account = form.account.$modelValue; + if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') { + var account = $scope.account; + if (!account) { + this.error = gettext('Please select account'); + return; + } + self.hwWallet = self.seedSourceId == 'ledger' ? 'Ledger' : 'Trezor'; + var src = self.seedSourceId == 'ledger' ? ledger : trezor; src.getInfoForNewWallet(true, account, function(err, lopts) { self.hwWallet = false; @@ -82,4 +124,7 @@ angular.module('copayApp.controllers').controller('joinController', }); }, 100); }; + + updateSeedSourceSelect(); + self.setSeedSource('new'); }); diff --git a/src/js/services/ledger.js b/src/js/services/ledger.js index 97e61b09a..7183fdfe7 100644 --- a/src/js/services/ledger.js +++ b/src/js/services/ledger.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.services') - .factory('ledger', function($log, bwcService, gettext) { + .factory('ledger', function($log, bwcService, gettext, hwWallet) { var root = {}; var LEDGER_CHROME_ID = "kkdpmhnladdopljabkgpacgpliggeeaf";