refactor ux language handling
This commit is contained in:
parent
39e6a81b62
commit
55afc4d9d4
8 changed files with 125 additions and 81 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, storageService, bwcService, configService, notificationService, isChromeApp, isCordova, gettext, nodeWebkit, bwsError, ledger) {
|
||||
.factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, storageService, bwcService, configService, notificationService, isChromeApp, isCordova, gettext, nodeWebkit, bwsError, ledger, uxLanguage) {
|
||||
|
||||
var root = {};
|
||||
|
||||
|
|
@ -165,11 +165,20 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
root._seedWallet = function(walletClient) {
|
||||
var config = configService.getSync().wallet.settings;
|
||||
console.log('[profileService.js.169:config:]',config); //TODO
|
||||
asdd;
|
||||
walletClient.seedFromRandomWithMnemonic('livenet',null, mnemonicLang);
|
||||
root._seedWallet = function(walletClient, network) {
|
||||
var lang = uxLanguage.getCurrentLanguage();
|
||||
|
||||
try {
|
||||
walletClient.seedFromRandomWithMnemonic(network, null, lang);
|
||||
} catch (e) {
|
||||
$log.info('Error creating seed: ' + e.message);
|
||||
if (e.message.indexOf('language') > 0) {
|
||||
$log.info('Using default language for mnemonic');
|
||||
walletClient.seedFromRandomWithMnemonic(network);
|
||||
} else {
|
||||
throw (e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
root._createNewProfile = function(opts, cb) {
|
||||
|
|
@ -179,7 +188,7 @@ asdd;
|
|||
}
|
||||
|
||||
var walletClient = bwcService.getClient();
|
||||
this._seedWallet(walletClient);
|
||||
root._seedWallet(walletClient, 'livenet');
|
||||
|
||||
walletClient.createWallet('Personal Wallet', 'me', 1, 1, {
|
||||
network: 'livenet'
|
||||
|
|
@ -209,10 +218,7 @@ asdd;
|
|||
return cb(gettext('Could not create using the specified extended public key'));
|
||||
}
|
||||
}
|
||||
// TODO LANG...
|
||||
// TODO...
|
||||
$log.warn("TODO LANG!")
|
||||
walletClient.seedFromRandomWithMnemonic(opts.networkName);
|
||||
root._seedWallet(walletClient, opts.networkName);
|
||||
|
||||
walletClient.createWallet(opts.name, opts.myName || 'me', opts.m, opts.n, {
|
||||
network: opts.networkName
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue