Create-Join-Import
This commit is contained in:
parent
4ee69ce0a1
commit
855b22a113
10 changed files with 53 additions and 46 deletions
|
|
@ -1,9 +1,11 @@
|
|||
<ion-view view-title="Create new wallet" ng-controller="createController as create" ng-init="create.setTotalCopayers(1)">
|
||||
<ion-nav-buttons side="primary">
|
||||
<a href ui-sref="add" class="button icon-left ion-chevron-left button-clear button-dark">Add</a>
|
||||
</ion-nav-buttons>
|
||||
<ion-view view-title="Create new wallet">
|
||||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-buttons side="primary">
|
||||
<a href ui-sref="add" class="button icon-left ion-chevron-left button-clear button-dark">Add</a>
|
||||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content>
|
||||
<ion-content ng-controller="createController as create" ng-init="create.setTotalCopayers(1)">
|
||||
|
||||
<div class="row" ng-hide="create.hideTabs">
|
||||
<div class="col">
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
<ion-view view-title="Import wallet" ng-controller="importController" ng-init="type='12'">
|
||||
<ion-nav-buttons side="primary">
|
||||
<a href ui-sref="add" class="button icon-left ion-chevron-left button-clear button-dark">Add</a>
|
||||
</ion-nav-buttons>
|
||||
<ion-nav-buttons side="secondary">
|
||||
<qr-scanner class="button button-clear button-positive" on-scan="processWalletInfo(data)"></qr-scanner>
|
||||
</ion-nav-buttons>
|
||||
<ion-view view-title="Import wallet">
|
||||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-buttons side="primary">
|
||||
<a href ui-sref="add" class="button icon-left ion-chevron-left button-clear button-dark">Add</a>
|
||||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content>
|
||||
<ion-content ng-controller="importController" ng-init="type='12'">
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
|
@ -57,6 +56,7 @@
|
|||
|
||||
<form name="importForm12" ng-submit="importMnemonic(importForm12)" novalidate>
|
||||
<div class="list">
|
||||
<qr-scanner class="button button-clear button-positive" on-scan="processWalletInfo(data)"></qr-scanner>
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label" translate>Type the Recovery Phrase (usually 12 words)</span>
|
||||
<textarea name="words"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<ion-view view-title="Join shared wallet" ng-controller="joinController as join">
|
||||
<ion-nav-buttons side="primary">
|
||||
<a href ui-sref="add" class="button icon-left ion-chevron-left button-clear button-dark">Add</a>
|
||||
</ion-nav-buttons>
|
||||
<ion-nav-buttons side="secondary">
|
||||
<qr-scanner class="button button-clear button-positive" on-scan="join.onQrCodeScanned(data)"></qr-scanner>
|
||||
</ion-nav-buttons>
|
||||
<ion-view view-title="Join shared wallet">
|
||||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-buttons side="primary">
|
||||
<a href ui-sref="add" class="button icon-left ion-chevron-left button-clear button-dark">Add</a>
|
||||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content>
|
||||
|
||||
<ion-content ng-controller="joinController as join">
|
||||
|
||||
<div class="padding assertive" ng-show="join.error">
|
||||
{{join.error|translate}}
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
ng-required="true">
|
||||
</label>
|
||||
|
||||
<qr-scanner class="button button-clear button-positive" on-scan="join.onQrCodeScanned(data)"></qr-scanner>
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label">
|
||||
Wallet Invitation
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ angular.module('copayApp.controllers').controller('copayersController',
|
|||
}
|
||||
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var secret = wallet.status.wallet.secret;
|
||||
var secret;
|
||||
try {
|
||||
secret = wallet.status.wallet.secret;
|
||||
} catch (e) {};
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
ongoingProcess.set('creatingWallet', true);
|
||||
$timeout(function() {
|
||||
|
||||
profileService.createWallet(opts, function(err, wallet) {
|
||||
profileService.createWallet(opts, function(err, client) {
|
||||
ongoingProcess.set('creatingWallet', false);
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
|
|
@ -177,8 +177,8 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
return;
|
||||
}
|
||||
|
||||
walletService.updateRemotePreferences(wallet, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + wallet.walletId)
|
||||
walletService.updateRemotePreferences(client, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('importController',
|
||||
function($scope, $rootScope, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess) {
|
||||
function($scope, $rootScope, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -95,7 +95,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
opts.password = null;
|
||||
|
||||
$timeout(function() {
|
||||
profileService.importWallet(str2, opts, function(err, wallet) {
|
||||
profileService.importWallet(str2, opts, function(err, client) {
|
||||
ongoingProcess.set('importingWallet', false);
|
||||
if (err) {
|
||||
$scope.error = err;
|
||||
|
|
@ -103,11 +103,11 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
|
||||
}
|
||||
|
||||
walletService.updateRemotePreferences(wallet, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + wallet.walletId)
|
||||
walletService.updateRemotePreferences(client, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
|
||||
});
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', wallet.walletId);
|
||||
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
});
|
||||
|
|
@ -117,7 +117,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
var _importExtendedPrivateKey = function(xPrivKey, opts) {
|
||||
ongoingProcess.set('importingWallet', true);
|
||||
$timeout(function() {
|
||||
profileService.importExtendedPrivateKey(xPrivKey, opts, function(err, wallet) {
|
||||
profileService.importExtendedPrivateKey(xPrivKey, opts, function(err, client) {
|
||||
ongoingProcess.set('importingWallet', false);
|
||||
if (err) {
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
|
|
@ -131,11 +131,11 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
}
|
||||
|
||||
|
||||
walletService.updateRemotePreferences(wallet, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + wallet.walletId)
|
||||
walletService.updateRemotePreferences(client, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
|
||||
});
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', wallet.walletId);
|
||||
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
});
|
||||
|
|
@ -168,7 +168,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
ongoingProcess.set('importingWallet', true);
|
||||
|
||||
$timeout(function() {
|
||||
profileService.importMnemonic(words, opts, function(err, wallet) {
|
||||
profileService.importMnemonic(words, opts, function(err, client) {
|
||||
ongoingProcess.set('importingWallet', false);
|
||||
|
||||
if (err) {
|
||||
|
|
@ -182,11 +182,11 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
});
|
||||
}
|
||||
|
||||
walletService.updateRemotePreferences(wallet, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + wallet.walletId)
|
||||
walletService.updateRemotePreferences(client, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
|
||||
});
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', wallet.walletId);
|
||||
$rootScope.$emit('Local/WalletImported', client.credentials.walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1061,6 +1061,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
|
||||
$rootScope.$on('Local/WalletImported', function(event, walletId) {
|
||||
console.log('[index.js:1063] walletImported'); //TODO
|
||||
return;
|
||||
self.needsBackup = false;
|
||||
storageService.setBackupFlag(walletId, function() {
|
||||
$log.debug('Backup done stored');
|
||||
|
|
@ -1322,6 +1324,8 @@ return;
|
|||
|
||||
lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
console.log('[index.js:1324] NewCopayer, CopayerUpdated'); //TODO
|
||||
return;
|
||||
// Re try to open wallet (will triggers)
|
||||
self.setFocusedWallet();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('joinController',
|
||||
function($scope, $rootScope, $timeout, go, notification, profileService, configService, storageService, applicationService, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess) {
|
||||
function($scope, $rootScope, $timeout, go, notification, profileService, configService, storageService, applicationService, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -128,7 +128,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
this._join = function(opts) {
|
||||
ongoingProcess.set('joiningWallet', true);
|
||||
$timeout(function() {
|
||||
profileService.joinWallet(opts, function(err, wallet) {
|
||||
profileService.joinWallet(opts, function(err, client) {
|
||||
ongoingProcess.set('joiningWallet', false);
|
||||
if (err) {
|
||||
self.error = err;
|
||||
|
|
@ -136,8 +136,8 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
return;
|
||||
}
|
||||
|
||||
walletService.updateRemotePreferences(wallet, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + wallet.walletId)
|
||||
walletService.updateRemotePreferences(client, {}, function() {
|
||||
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
|
||||
});
|
||||
|
||||
go.walletHome();
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ angular.module('copayApp.services').factory('go', function($window, $ionicSideMe
|
|||
root.walletHome = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
if (fc && !fc.isComplete()) {
|
||||
$log.debug("Wallet not complete at startup... redirecting")
|
||||
root.path('copayers');
|
||||
$log.debug("Wallet not complete at startup... redirecting");
|
||||
$state.transitionTo('wallet.details', {walletId: fc.credentials.walletId})
|
||||
} else {
|
||||
root.path('tabs.home');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ angular.module('copayApp.services')
|
|||
var config = configService.getSync();
|
||||
if (config.pushNotifications.enabled)
|
||||
pushNotificationsService.enableNotifications(root.wallet);
|
||||
return cb(err, walletClient);
|
||||
return cb(err, client);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue