Skip to content

Commit

Permalink
Fix asyncstorage limit (#2034)
Browse files Browse the repository at this point in the history
* fix asyncstorage limit

* add version check

* Update error message

* remove version check

* toLowerCase not toLocaleLowerCase

* loading: false
  • Loading branch information
rickycodes authored Dec 2, 2020
1 parent bb429ed commit 2940f7f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions android/app/src/main/java/io/metamask/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import androidx.multidex.MultiDexApplication;

import android.database.CursorWindow;
import java.lang.reflect.Field;

public class MainApplication extends MultiDexApplication implements ShareApplication, ReactApplication {

Expand Down Expand Up @@ -55,6 +57,15 @@ 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);
Expand Down
9 changes: 9 additions & 0 deletions app/components/Views/Login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -234,6 +238,11 @@ 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.toLowerCase()) {
this.setState({
loading: false,
error: CLEAN_VAULT_ERROR
});
} else {
this.setState({ loading: false, error });
}
Expand Down

0 comments on commit 2940f7f

Please sign in to comment.