CWA-175 | added seed language parameter to wallet manager and wallet list service, created seed_language_page and seed_language_store, applied seed language page before create and restore wallet, added mnemonics

This commit is contained in:
Oleksandr Sobol
2020-02-28 22:16:39 +02:00
parent ed31909694
commit cb4fff7aec
40 changed files with 11769 additions and 400 deletions
@@ -0,0 +1,38 @@
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/routes.dart';
part 'seed_language_store.g.dart';
const List<String> seedLanguages = [
'English',
'Chinese (simplified)',
'Dutch',
'German',
'Japanese',
'Portuguese',
'Russian',
'Spanish'
];
class SeedLanguageStore = SeedLanguageStoreBase with _$SeedLanguageStore;
abstract class SeedLanguageStoreBase with Store {
SeedLanguageStoreBase() {
selectedSeedLanguage = seedLanguages[0];
currentRoute = Routes.newWallet;
}
@observable
String selectedSeedLanguage;
String currentRoute;
@action
void setSelectedSeedLanguage(String seedLanguage) {
selectedSeedLanguage = seedLanguage;
}
void setCurrentRoute(String route) {
currentRoute = route;
}
}
@@ -32,12 +32,12 @@ abstract class WalletCreationStoreBase with Store {
bool isValid;
@action
Future create({String name}) async {
Future create({String name, String language}) async {
state = WalletCreationStateInitial();
try {
state = WalletIsCreating();
await walletListService.create(name);
await walletListService.create(name, language);
authStore.created();
state = WalletCreatedSuccessfully();
} catch (e) {
@@ -56,6 +56,7 @@ abstract class WalleRestorationStoreBase with Store {
@action
Future restoreFromKeys(
{String name,
String language,
String address,
String viewKey,
String spendKey,
@@ -65,7 +66,7 @@ abstract class WalleRestorationStoreBase with Store {
try {
state = WalletIsRestoring();
await walletListService.restoreFromKeys(
name, restoreHeight, address, viewKey, spendKey);
name, language, restoreHeight, address, viewKey, spendKey);
authStore.restored();
state = WalletRestoredSuccessfully();
} catch (e) {