Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asyncstorage limit #2034

Merged
merged 6 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 8 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,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 });
}
Expand Down