mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user