Show relevant message when contact QR code has unknown format.

This commit is contained in:
akwizgran
2022-12-19 10:12:01 +00:00
parent 267956b36c
commit ab8734e373
2 changed files with 9 additions and 1 deletions

View File

@@ -148,7 +148,7 @@ public class AddNearbyContactActivity extends BriarActivity
} else if (state instanceof WrongQrCodeType) {
QrCodeType qrCodeType = ((WrongQrCodeType) state).qrCodeType;
if (qrCodeType == MAILBOX) onMailboxQrCodeScanned();
else showErrorFragment();
else onWrongQrCodeType();
} else if (state instanceof WrongQrCodeVersion) {
boolean qrCodeTooOld = ((WrongQrCodeVersion) state).qrCodeTooOld;
onWrongQrCodeVersion(qrCodeTooOld);
@@ -187,6 +187,13 @@ public class AddNearbyContactActivity extends BriarActivity
AddNearbyContactErrorFragment.newInstance(title, msg, false));
}
private void onWrongQrCodeType() {
String title = getString(R.string.qr_code_invalid);
String msg = getString(R.string.qr_code_format_unknown);
showNextFragment(
AddNearbyContactErrorFragment.newInstance(title, msg, false));
}
private void onWrongQrCodeVersion(boolean qrCodeTooOld) {
String title = getString(R.string.qr_code_invalid);
String msg;

View File

@@ -253,6 +253,7 @@
<string name="qr_code_too_old_1">The QR code you have scanned comes from an older version of Briar.\n\nPlease ask your contact to upgrade to the latest version and then try again.</string>
<string name="qr_code_too_new_1">The QR code you have scanned comes from a newer version of Briar.\n\nPlease upgrade to the latest version and then try again.</string>
<string name="mailbox_qr_code_for_contact">The QR code you have scanned comes from Briar Mailbox.\n\nIf you want to link a Mailbox, please choose Settings > Mailbox from the Briar menu.</string>
<string name="qr_code_format_unknown">The QR code you have scanned does not come from Briar.\n\nPlease scan the QR code shown on your contact\'s screen.</string>
<string name="camera_error">Camera error</string>
<string name="connecting_to_device">Connecting to device\u2026</string>
<string name="authenticating_with_device">Authenticating with device\u2026</string>