Browse Source

show se update fail page (#10)

* show se update fail page

* fix some UI issue

* fix UI issue
V1.1.0-release
JunZhang 5 years ago
committed by GitHub
parent
commit
9f32732d68
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/src/main/java/com/cobo/cold/selfcheck/SecurityCheck.java
  2. 8
      app/src/main/java/com/cobo/cold/ui/fragment/AttackWarningFragment.java
  3. 13
      app/src/main/java/com/cobo/cold/ui/fragment/main/TxFragment.java
  4. 1
      app/src/main/res/layout/qrcode_scan_fragment.xml
  5. 2
      app/src/main/res/values-zh-rCN/strings.xml
  6. 18
      app/src/main/res/values/strings.xml

3
app/src/main/java/com/cobo/cold/selfcheck/SecurityCheck.java

@ -52,6 +52,7 @@ public class SecurityCheck {
private static final int CODE_FW_STATUS_NOT_FOUND = 0x0200;
private static final int CODE_FW_STATUS_ATTACKED = 0x0300;
private static final int CODE_FW_ERT_ATTACKED = 0x0400;
public static final int CODE_FW_IN_BOOTMODE = 0x0500;
public CheckResult doSelfCheck(AppCompatActivity context) {
Log.i(TAG, "start self checking...");
@ -124,7 +125,7 @@ public class SecurityCheck {
}
} else {
// has not 0102 tag ,is in boot mode
return CODE_FW_OK;
return CODE_FW_IN_BOOTMODE;
}
} catch (EncryptionCoreException e) {
Log.e(TAG, e.toString());

8
app/src/main/java/com/cobo/cold/ui/fragment/AttackWarningFragment.java

@ -34,6 +34,7 @@ import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.Executors;
import static com.cobo.cold.selfcheck.SecurityCheck.CODE_FW_IN_BOOTMODE;
import static com.cobo.cold.ui.fragment.setting.MainPreferenceFragment.removeAllFingerprint;
public class AttackWarningFragment extends BaseFragment<AttackWarningBinding> {
@ -54,6 +55,13 @@ public class AttackWarningFragment extends BaseFragment<AttackWarningBinding> {
Bundle data = Objects.requireNonNull(getArguments());
mBinding.hint.setText(getString(R.string.attack_warning,
formatErrorCode(data)));
int firmware = data.getInt("firmware");
if (firmware == CODE_FW_IN_BOOTMODE) {
mBinding.text1.setText(R.string.update_failed);
mBinding.hint.setText(getString(R.string.contact_cobo_service,formatErrorCode(data)));
}
mBinding.powerOff.setOnClickListener(v -> handleAttack(mActivity));
mBinding.serialno.setText(getString(R.string.serialno, SystemProperties.get("persist.sys.serialno")));
mBinding.icon.setOnClickListener(new AboutFragment.ExportLogHandler(mActivity, Executors.newSingleThreadExecutor()));

13
app/src/main/java/com/cobo/cold/ui/fragment/main/TxFragment.java

@ -124,8 +124,19 @@ public class TxFragment extends BaseFragment<TxBinding> {
if (output.optBoolean("isChange")) {
continue;
}
long value;
Object valueObj = output.get("value");
if (valueObj instanceof Long) {
value = (Long) valueObj;
} else if(valueObj instanceof Integer) {
value = ((Integer) valueObj).longValue();
} else {
double satoshi = Double.parseDouble(((String) valueObj).split(" ")[0]);
value = (long) (satoshi * Math.pow(10,8));
}
items.add(new TransactionItem(i,
output.getLong("value"),
value,
output.getString("address")
));
}

1
app/src/main/res/layout/qrcode_scan_fragment.xml

@ -94,6 +94,7 @@
android:layout_marginHorizontal="16dp"
android:textColor="@android:color/white"
android:textSize="12sp"
android:gravity="center"
android:text="@string/scan_electrum_hint"/>
</RelativeLayout>

2
app/src/main/res/values-zh-rCN/strings.xml

@ -308,4 +308,6 @@
<string name="electrum_compatibility">适配 Electrum</string>
<string name="identification_failed">交易识别失败</string>
<string name="from_electrum">来自Electrum</string>
<string name="update_failed">升级失败</string>
<string name="contact_cobo_service">您可邮件联系客服:support@cobo.com\n 状态码:%s</string>
</resources>

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

@ -218,7 +218,7 @@
<string name="tx_to">To</string>
<string name="tx_fee">Fee</string>
<string name="tx_memo">Memo</string>
<string name="tx_confirm">Confirm Transaction</string>
<string name="tx_confirm">Confirm Transaction Details</string>
<string name="sign">Sign</string>
<string name="find_password">Forgot Password</string>
<string name="update_hint">Only install firmware upgrades downloaded from the official Cobo Vault website.</string>
@ -293,7 +293,7 @@
<string name="export_to_electrum_guide">1. Open Electrum and create a new wallet. \n2. Choose “Standard wallet”. \n3. Choose “Use a master key”. \n4. Touch “Show Master Public Key” below then click the camera icon in the “Create keystore from a master key” window in Electrum to scan the QR code that displays on Cobo Vault.
\n5. Set a password. \n6. Enter the watch-only wallet.</string>
<string name="export_xpub">Show Master Public Key</string>
<string name="export_to_electrum_guide_hint">How to create watch-only wallet in Electrum</string>
<string name="export_to_electrum_guide_hint">How to create a watch-only wallet in Electrum:</string>
<string name="send_address">From %d</string>
<string name="input">Input %d</string>
<string name="output">Output %d</string>
@ -305,10 +305,10 @@
<string name="no_unsigned_txn_hint">Please make sure the file you wish to sign was successfully saved to your microSD card.</string>
<string name="electrum_broadcast_guide">How to Broadcast</string>
<string name="electrum_broadcast_action_guide">In Electrum, go to Tools > Load Transaction > From QR Code\n\nDifficulty scanning? You can export the signed transaction data as a file using a microSD card and broadcast the transaction from a file with Electrum.</string>
<string name="electrum_decode_txn_fail">Parsing Failed</string>
<string name="electrum_decode_txn_fail">Read Error</string>
<string name="electrum_import_xpub_guide_title">How to scan QR code</string>
<string name="electrum_import_xpub_action_guide">1. Open Electrumand and create a new wallet.\n2. Choose “Standard wallet”.\n3. Choose “Use a master key”. \n4. Click the camera icon in the “Create keystore from a master key” window in Electrum to scan the QR code that displays on Cobo Vault.\n\nDifficulty scanning? You can also export the master public key file using a microSD card.</string>
<string name="error_txn_file">Unable to parse file, please try exporting again.</string>
<string name="error_txn_file">Unable to read file, please try importing again.</string>
<string name="export_signed_txn">Export File to Broadcast</string>
<string name="electrum_import_signed_txn">In Electrum, go to Tools > Load Transaction > From File to open the file. </string>
<string name="insert_sdcard_hint">Please make sure you have inserted a FAT32 format microSD card with capacity 32GB or less.</string>
@ -325,11 +325,13 @@
<string name="file_name_label">File name:</string>
<string name="master_xpub">Master Public Key (Nested SegWit)</string>
<string name="electrum_qrcode_hint"><![CDATA[Difficulty scanning?Tap the QR code to enlarge<br>or <u>touch here to export via microSD.</u>]]></string>
<string name="scan_electrum_hint">Difficulty scanning Electrum? You can export the pending transactions as a file using a microSD card (Menu > MicroSD Card)</string>
<string name="sign_txn_in_sdcard">Files Awaiting Signature</string>
<string name="master_pubkey_not_match">This transaction can\'t be recognized, your Cobo Vault doesn’t match the watch-only wallet. </string>
<string name="scan_electrum_hint">Difficulty scanning? You can import pending transactions from Electrum using a microSD card (Menu > MicroSD Card).</string>
<string name="sign_txn_in_sdcard">Unsigned Transaction Files</string>
<string name="master_pubkey_not_match">Transaction not recognized. Your Cobo Vault has not been successfully paired with the watch-only wallet.</string>
<string name="change">Change</string>
<string name="electrum_compatibility">Electrum Compatibility</string>
<string name="electrum_compatibility">Electrum Watch-Only Wallet</string>
<string name="identification_failed">Identification Failed</string>
<string name="from_electrum">From Electrum</string>
<string name="update_failed">Update failed</string>
<string name="contact_cobo_service">contact us: support@cobo.com\n Status Code:%s</string>
</resources>

Loading…
Cancel
Save