Merge pull request #2718 from matiu/feat/splash-import
Feat/splash import
This commit is contained in:
commit
ec7a1d8338
19 changed files with 58 additions and 66 deletions
|
|
@ -721,7 +721,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.noFocusedWallet = true;
|
||||
self.isComplete = null;
|
||||
self.walletName = null;
|
||||
go.addWallet();
|
||||
go.path('import');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,13 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
isoCode: config.wallet.settings.alternativeIsoCode
|
||||
};
|
||||
var fc = profileService.focusedClient;
|
||||
$scope.encrypt = fc.hasPrivKeyEncrypted();
|
||||
if (fc)
|
||||
$scope.encrypt = fc.hasPrivKeyEncrypted();
|
||||
|
||||
var unwatch = $scope.$watch('encrypt', function(val) {
|
||||
var fc = profileService.focusedClient;
|
||||
if (!fc) return;
|
||||
|
||||
if (val && !fc.hasPrivKeyEncrypted()) {
|
||||
$rootScope.$emit('Local/NeedsPassword', true, function(err, password) {
|
||||
if (err || !password) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
|
|||
function($scope, configService, profileService, go) {
|
||||
var config = configService.getSync();
|
||||
this.colorOpts = [
|
||||
'#7A8C9E',
|
||||
'#F38F12',
|
||||
'#F4D03F',
|
||||
'#4A90E2',
|
||||
|
|
@ -11,7 +12,6 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
|
|||
'#9B59B6',
|
||||
'#E856EF',
|
||||
'#F883B4',
|
||||
'#7A8C9E',
|
||||
];
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
|
|
|
|||
|
|
@ -357,6 +357,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return;
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
if (!fc)
|
||||
return;
|
||||
|
||||
$timeout(function() {
|
||||
storageService.getLastAddress(fc.credentials.walletId, function(err, addr) {
|
||||
if (addr) {
|
||||
|
|
|
|||
|
|
@ -14,17 +14,20 @@ Profile.create = function(opts) {
|
|||
|
||||
var x = new Profile();
|
||||
x.createdOn = Date.now();
|
||||
x.credentials = opts.credentials;
|
||||
x.credentials = opts.credentials || [];
|
||||
return x;
|
||||
};
|
||||
|
||||
|
||||
Profile.fromObj = function(obj) {
|
||||
var x = new Profile();
|
||||
|
||||
x.createdOn = obj.createdOn;
|
||||
x.credentials = obj.credentials;
|
||||
|
||||
if (x.credentials[0] && typeof x.credentials[0] != 'object')
|
||||
throw ("credentials should be an object");
|
||||
|
||||
return x;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,23 +68,23 @@ angular
|
|||
needProfile: false,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/splash/1.html',
|
||||
templateUrl: 'views/splash.html',
|
||||
controller: function($scope, $timeout, $log, profileService, go) {
|
||||
if (profileService.profile) {
|
||||
go.walletHome();
|
||||
}
|
||||
|
||||
$scope.create = function() {
|
||||
$scope.create = function(noWallet) {
|
||||
$scope.creatingProfile = true;
|
||||
|
||||
profileService.create(function(err) {
|
||||
profileService.create({noWallet: noWallet}, function(err) {
|
||||
if (err) {
|
||||
$scope.creatingProfile = false;
|
||||
$log.warn(err);
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
$timeout(function() {
|
||||
$scope.create();
|
||||
$scope.create(noWallet);
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
|
|
@ -384,7 +384,7 @@ angular
|
|||
create: 12,
|
||||
join: 12,
|
||||
import: 12,
|
||||
importLegacy: 12
|
||||
importLegacy: 13
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -157,9 +157,13 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
root._createNewProfile = function(cb) {
|
||||
var walletClient = bwcService.getClient();
|
||||
root._createNewProfile = function(opts, cb) {
|
||||
|
||||
if (opts.noWallet) {
|
||||
return cb(null, Profile.create());
|
||||
}
|
||||
|
||||
var walletClient = bwcService.getClient();
|
||||
walletClient.createWallet('Personal Wallet', 'me', 1, 1, {
|
||||
network: 'livenet'
|
||||
}, function(err) {
|
||||
|
|
@ -276,13 +280,11 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
root.create = function(cb) {
|
||||
root.create = function(opts, cb) {
|
||||
$log.info('Creating profile');
|
||||
configService.get(function(err) {
|
||||
root.applyConfig();
|
||||
root._createNewProfile(function(err, p) {
|
||||
root._createNewProfile(opts, function(err, p) {
|
||||
if (err) return cb(err);
|
||||
|
||||
root.bindProfile(p, function(err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue