From b631e9d6b6a124ec4f5712330ffdde1632776a61 Mon Sep 17 00:00:00 2001 From: JunZhang Date: Mon, 8 Jun 2020 14:34:09 +0800 Subject: [PATCH] reset inputMethod settings (#25) (#26) * reset inputMethod settings (#25) * modify wasabi version field name --- app/build.gradle | 2 +- app/src/main/java/com/cobo/cold/MainApplication.java | 12 ++++++++++++ app/src/main/java/com/cobo/cold/Utilities.java | 11 +++++++++++ .../com/cobo/cold/viewmodel/GlobalViewModel.java | 2 +- app/src/main/res/values/strings.xml | 8 ++++---- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c44be28..6775bab 100644 --- a/app/build.gradle +++ b/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 diff --git a/app/src/main/java/com/cobo/cold/MainApplication.java b/app/src/main/java/com/cobo/cold/MainApplication.java index 8fd261e..a986684 100644 --- a/app/src/main/java/com/cobo/cold/MainApplication.java +++ b/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() { diff --git a/app/src/main/java/com/cobo/cold/Utilities.java b/app/src/main/java/com/cobo/cold/Utilities.java index de22877..04c8980 100644 --- a/app/src/main/java/com/cobo/cold/Utilities.java +++ b/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(); + } } diff --git a/app/src/main/java/com/cobo/cold/viewmodel/GlobalViewModel.java b/app/src/main/java/com/cobo/cold/viewmodel/GlobalViewModel.java index 2452276..0b9e6fe 100644 --- a/app/src/main/java/com/cobo/cold/viewmodel/GlobalViewModel.java +++ b/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(); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c2fb2e6..15c1864 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -445,8 +445,8 @@ Confirm Please use %s generate unsigned transaction Please scan the QR code with the wallet that has been adapted to the Cobo vault - 确认是否切换 - 切换地址格式后,您的收款地址、导出钱包、钱包信息都将切换,您需导出该地址格式的观察钱包 - 暂不切换 - 确认切换 + Confirm to Toggle + Address、Export Wallet、Wallet Info will be toggled and you need export wallet of this format, confirm to toggle? + Cancel + Confirm