Browse Source

reset inputMethod settings (#25) (#26)

* reset inputMethod settings (#25)

* modify wasabi version field name
V1.2.0-btc-release
JunZhang 5 years ago
committed by GitHub
parent
commit
b631e9d6b6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/build.gradle
  2. 12
      app/src/main/java/com/cobo/cold/MainApplication.java
  3. 11
      app/src/main/java/com/cobo/cold/Utilities.java
  4. 2
      app/src/main/java/com/cobo/cold/viewmodel/GlobalViewModel.java
  5. 8
      app/src/main/res/values/strings.xml

2
app/build.gradle

@ -218,7 +218,7 @@ def getVersionProperties() {
}
def versionMajor = 1
def versionMinor = 1
def versionMinor = 2
def versionPatch = versionProps.getProperty('patch', '0').toInteger()
def isVaultRelease = false

12
app/src/main/java/com/cobo/cold/MainApplication.java

@ -24,6 +24,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.annotation.NonNull;
@ -71,6 +72,17 @@ public class MainApplication extends Application {
shouldLock = Utilities.hasVaultCreated(this);
startAttackCheckingService();
resetInputMethodSettings();
}
private void resetInputMethodSettings() {
if (!Utilities.isInputSettingsCleared(this)) {
new Thread(() -> {
PackageManager pm = getPackageManager();
pm.clearApplicationUserData("com.google.android.inputmethod.pinyin", null);
Utilities.setInputSettingsCleared(this);
}).start();
}
}
private void startAttackCheckingService() {

11
app/src/main/java/com/cobo/cold/Utilities.java

@ -53,6 +53,7 @@ public class Utilities {
public static final String PATTERN_LOCK_CLICKED = "pattern_lock_clicked";
public static final String FINGERPRINT_PASSWORD = "fingerprint_password";
public static final String ATTACK_DETECTED = "attack_detected";
public static final String INPUT_SETTINGS_CLEARED = "input_settings_cleared";
public static void alert(AppCompatActivity activity,
@Nullable String title, @NonNull String message,
@ -214,4 +215,14 @@ public class Utilities {
SharedPreferences sp = context.getSharedPreferences(PREFERENCE_SECRET, MODE_PRIVATE);
return sp.getBoolean(ATTACK_DETECTED,false);
}
public static boolean isInputSettingsCleared(Context context) {
SharedPreferences sp = context.getSharedPreferences(PREFERENCE_SECRET, MODE_PRIVATE);
return sp.getBoolean(INPUT_SETTINGS_CLEARED,false);
}
public static void setInputSettingsCleared(Context context) {
SharedPreferences sp = context.getSharedPreferences(PREFERENCE_SECRET, MODE_PRIVATE);
sp.edit().putBoolean(INPUT_SETTINGS_CLEARED,true).apply();
}
}

2
app/src/main/java/com/cobo/cold/viewmodel/GlobalViewModel.java

@ -128,7 +128,7 @@ public class GlobalViewModel extends AndroidViewModel {
try {
xpubInfo.put("ExtPubKey", xpub);
xpubInfo.put("MasterFingerprint", masterKeyFingerprint);
xpubInfo.put("CoboVaultVersion", BuildConfig.VERSION_NAME);
xpubInfo.put("CoboVaultFirmwareVersion", BuildConfig.VERSION_NAME);
} catch (JSONException e) {
e.printStackTrace();
}

8
app/src/main/res/values/strings.xml

@ -445,8 +445,8 @@
<string name="confirm_add_address">Confirm</string>
<string name="watch_wallet_not_match">Please use %s generate unsigned transaction</string>
<string name="scan_qrcode_with_generic_wallet">Please scan the QR code with the wallet that has been adapted to the Cobo vault</string>
<string name="confirm_toggle">确认是否切换</string>
<string name="toggle_address_hint">切换地址格式后,您的收款地址、导出钱包、钱包信息都将切换,您需导出该地址格式的观察钱包</string>
<string name="toggle_later">暂不切换</string>
<string name="toggle_confirm">确认切换</string>
<string name="confirm_toggle">Confirm to Toggle</string>
<string name="toggle_address_hint">Address、Export Wallet、Wallet Info will be toggled and you need export wallet of this format, confirm to toggle?</string>
<string name="toggle_later">Cancel</string>
<string name="toggle_confirm">Confirm</string>
</resources>

Loading…
Cancel
Save