From 7c5caf09128c4c1811854f48d23443437b3f35b0 Mon Sep 17 00:00:00 2001 From: rickycodes Date: Wed, 2 Dec 2020 14:20:15 -0500 Subject: [PATCH 1/6] fix asyncstorage limit --- .../app/src/main/java/io/metamask/MainApplication.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android/app/src/main/java/io/metamask/MainApplication.java b/android/app/src/main/java/io/metamask/MainApplication.java index 371820484ee..671266cade6 100644 --- a/android/app/src/main/java/io/metamask/MainApplication.java +++ b/android/app/src/main/java/io/metamask/MainApplication.java @@ -20,6 +20,9 @@ import androidx.multidex.MultiDexApplication; +import android.database.CursorWindow; +import java.lang.reflect.Field; + public class MainApplication extends MultiDexApplication implements ShareApplication, ReactApplication { @@ -55,6 +58,13 @@ public ReactNativeHost getReactNativeHost() { @Override public void onCreate() { super.onCreate(); + try { + Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize"); + field.setAccessible(true); + field.set(null, 10 * 1024 * 1024); //the 10MB is the new size + } catch (Exception e) { + e.printStackTrace(); + } if (BuildConfig.DEBUG) { WebView.setWebContentsDebuggingEnabled(true); } SoLoader.init(this, /* native exopackage */ false); From f5e7f02351e491bb9df6c631c02e2a5b041d68cb Mon Sep 17 00:00:00 2001 From: rickycodes Date: Wed, 2 Dec 2020 15:04:27 -0500 Subject: [PATCH 2/6] add version check --- .../main/java/io/metamask/MainApplication.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/java/io/metamask/MainApplication.java b/android/app/src/main/java/io/metamask/MainApplication.java index 671266cade6..77af5ced1ee 100644 --- a/android/app/src/main/java/io/metamask/MainApplication.java +++ b/android/app/src/main/java/io/metamask/MainApplication.java @@ -22,7 +22,7 @@ import android.database.CursorWindow; import java.lang.reflect.Field; - +import android.os.Build; public class MainApplication extends MultiDexApplication implements ShareApplication, ReactApplication { @@ -58,13 +58,17 @@ public ReactNativeHost getReactNativeHost() { @Override public void onCreate() { super.onCreate(); - try { - Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize"); - field.setAccessible(true); - field.set(null, 10 * 1024 * 1024); //the 10MB is the new size - } catch (Exception e) { - e.printStackTrace(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + try { + Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize"); + field.setAccessible(true); + field.set(null, 10 * 1024 * 1024); //the 10MB is the new size + } catch (Exception e) { + e.printStackTrace(); + } } + if (BuildConfig.DEBUG) { WebView.setWebContentsDebuggingEnabled(true); } SoLoader.init(this, /* native exopackage */ false); From 2709da0be657a775c293aa9289b1df63a8269523 Mon Sep 17 00:00:00 2001 From: rickycodes Date: Wed, 2 Dec 2020 15:57:35 -0500 Subject: [PATCH 3/6] Update error message --- app/components/Views/Login/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/components/Views/Login/index.js b/app/components/Views/Login/index.js index 9cc01080f07..f5b087f4dce 100644 --- a/app/components/Views/Login/index.js +++ b/app/components/Views/Login/index.js @@ -101,9 +101,13 @@ const styles = StyleSheet.create({ } }); +/* TODO: we should have translation strings for these */ const PASSCODE_NOT_SET_ERROR = 'Error: Passcode not set.'; const WRONG_PASSWORD_ERROR = 'Error: Decrypt failed'; const WRONG_PASSWORD_ERROR_ANDROID = 'Error: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT'; +const VAULT_ERROR = 'Error: Cannot unlock without a previous vault.'; +const CLEAN_VAULT_ERROR = + 'An error has occurred due to storage limit. Your funds are safe. Please re-install the app and import your wallet using your seed phrase.'; /** * View where returning users can authenticate @@ -234,6 +238,10 @@ class Login extends PureComponent { 'In order to proceed, you need to turn Passcode on or any biometrics authentication method supported in your device (FaceID, TouchID or Fingerprint)' ); this.setState({ loading: false }); + } else if (error.toLowerCase() === VAULT_ERROR.toLocaleLowerCase()) { + this.setState({ + error: CLEAN_VAULT_ERROR + }); } else { this.setState({ loading: false, error }); } From b915017cf6b20d2fdfa6815ff8cc69d7f50d9bc9 Mon Sep 17 00:00:00 2001 From: rickycodes Date: Wed, 2 Dec 2020 16:08:49 -0500 Subject: [PATCH 4/6] remove version check --- .../main/java/io/metamask/MainApplication.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/android/app/src/main/java/io/metamask/MainApplication.java b/android/app/src/main/java/io/metamask/MainApplication.java index 77af5ced1ee..36dab198fe5 100644 --- a/android/app/src/main/java/io/metamask/MainApplication.java +++ b/android/app/src/main/java/io/metamask/MainApplication.java @@ -22,7 +22,6 @@ import android.database.CursorWindow; import java.lang.reflect.Field; -import android.os.Build; public class MainApplication extends MultiDexApplication implements ShareApplication, ReactApplication { @@ -59,14 +58,12 @@ public ReactNativeHost getReactNativeHost() { public void onCreate() { super.onCreate(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - try { - Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize"); - field.setAccessible(true); - field.set(null, 10 * 1024 * 1024); //the 10MB is the new size - } catch (Exception e) { - e.printStackTrace(); - } + try { + Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize"); + field.setAccessible(true); + field.set(null, 10 * 1024 * 1024); //the 10MB is the new size + } catch (Exception e) { + e.printStackTrace(); } if (BuildConfig.DEBUG) From 6a39619fab82ab6acaa388f2f1fec9ea0aa6bb4a Mon Sep 17 00:00:00 2001 From: rickycodes Date: Wed, 2 Dec 2020 16:39:51 -0500 Subject: [PATCH 5/6] toLowerCase not toLocaleLowerCase --- app/components/Views/Login/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/Views/Login/index.js b/app/components/Views/Login/index.js index f5b087f4dce..64fe61f4839 100644 --- a/app/components/Views/Login/index.js +++ b/app/components/Views/Login/index.js @@ -238,7 +238,7 @@ class Login extends PureComponent { 'In order to proceed, you need to turn Passcode on or any biometrics authentication method supported in your device (FaceID, TouchID or Fingerprint)' ); this.setState({ loading: false }); - } else if (error.toLowerCase() === VAULT_ERROR.toLocaleLowerCase()) { + } else if (error.toLowerCase() === VAULT_ERROR.toLowerCase()) { this.setState({ error: CLEAN_VAULT_ERROR }); From 91fbfaee08314252912683811ca43c4ab0a27ffc Mon Sep 17 00:00:00 2001 From: rickycodes Date: Wed, 2 Dec 2020 16:41:03 -0500 Subject: [PATCH 6/6] loading: false --- app/components/Views/Login/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/components/Views/Login/index.js b/app/components/Views/Login/index.js index 64fe61f4839..2dad116b037 100644 --- a/app/components/Views/Login/index.js +++ b/app/components/Views/Login/index.js @@ -240,6 +240,7 @@ class Login extends PureComponent { this.setState({ loading: false }); } else if (error.toLowerCase() === VAULT_ERROR.toLowerCase()) { this.setState({ + loading: false, error: CLEAN_VAULT_ERROR }); } else {