From 09116b956b3daa81d68a72e588ca5795a7a1187c Mon Sep 17 00:00:00 2001
From: poka <poka@p2p.legal>
Date: Wed, 1 Jun 2022 07:33:56 +0200
Subject: [PATCH] fix: lowercase for mnemonic words; set pin cache choice to
 false as default

---
 lib/main.dart                               | 3 +--
 lib/providers/generate_wallets.dart         | 4 ++--
 lib/providers/wallet_options.dart           | 2 +-
 lib/screens/myWallets/restore_chest.dart    | 2 +-
 lib/screens/myWallets/unlocking_wallet.dart | 2 +-
 5 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/main.dart b/lib/main.dart
index 7bb8f98d..9ae14938 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -73,12 +73,11 @@ Future<void> main() async {
   g1WalletsBox = await Hive.openBox<G1WalletsList>("g1WalletsBox");
 
   await _homeProvider.getValidEndpoints();
+  // await configBox.delete('isCacheChecked');
   // log.d(await configBox.get('endpoint'));
 
   HttpOverrides.global = MyHttpOverrides();
 
-
-
   if (kReleaseMode && enableSentry) {
     // CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [
     //   SentryHandler(SentryClient(SentryOptions(
diff --git a/lib/providers/generate_wallets.dart b/lib/providers/generate_wallets.dart
index b0176ff5..763fc934 100644
--- a/lib/providers/generate_wallets.dart
+++ b/lib/providers/generate_wallets.dart
@@ -283,7 +283,7 @@ class GenerateWalletsProvider with ChangeNotifier {
     // Needed for bad encoding of UTF-8
     word = word.replaceAll('é', 'é');
     word = word.replaceAll('è', 'è');
-    return bip39Words(appLang).contains(word);
+    return bip39Words(appLang).contains(word.toLowerCase());
   }
 
   bool isBipWordsList(List<String> words) {
@@ -292,7 +292,7 @@ class GenerateWalletsProvider with ChangeNotifier {
       // Needed for bad encoding of UTF-8
       word = word.replaceAll('é', 'é');
       word = word.replaceAll('è', 'è');
-      if (!bip39Words(appLang).contains(word)) {
+      if (!bip39Words(appLang).contains(word.toLowerCase())) {
         isValid = false;
       }
     }
diff --git a/lib/providers/wallet_options.dart b/lib/providers/wallet_options.dart
index 7f3f33df..df905a22 100644
--- a/lib/providers/wallet_options.dart
+++ b/lib/providers/wallet_options.dart
@@ -233,7 +233,7 @@ class WalletOptionsProvider with ChangeNotifier {
   }
 
   Future changePinCacheChoice() async {
-    bool isCacheChecked = configBox.get('isCacheChecked') ?? true;
+    bool isCacheChecked = configBox.get('isCacheChecked') ?? false;
     await configBox.put('isCacheChecked', !isCacheChecked);
     notifyListeners();
   }
diff --git a/lib/screens/myWallets/restore_chest.dart b/lib/screens/myWallets/restore_chest.dart
index f87601fc..212e7b3d 100644
--- a/lib/screens/myWallets/restore_chest.dart
+++ b/lib/screens/myWallets/restore_chest.dart
@@ -180,7 +180,7 @@ class RestoreChest extends StatelessWidget {
         textInputAction: TextInputAction.next,
         onChanged: (v) {
           bool isValid = generateWalletProvider.isBipWord(v);
-
+          if (isValid) cellCtl.text = cellCtl.text.toLowerCase();
           if (isValid && generateWalletProvider.cellController11.text.isEmpty) {
             FocusScope.of(context).nextFocus();
           }
diff --git a/lib/screens/myWallets/unlocking_wallet.dart b/lib/screens/myWallets/unlocking_wallet.dart
index e5749e19..0237aa3d 100644
--- a/lib/screens/myWallets/unlocking_wallet.dart
+++ b/lib/screens/myWallets/unlocking_wallet.dart
@@ -38,7 +38,7 @@ class UnlockingWallet extends StatelessWidget {
     currentChest = chestBox.get(currentChestNumber)!;
 
     if (configBox.get('isCacheChecked') == null) {
-      configBox.put('isCacheChecked', true);
+      configBox.put('isCacheChecked', false);
     }
 
     int _pinLenght = _walletOptions.getPinLenght(wallet!.number);
-- 
GitLab