feat: Adapt to channel-invite QR codes

This commit is contained in:
Hocuri 2025-08-15 20:11:56 +02:00
parent 5716372453
commit 9f63371909
No known key found for this signature in database
GPG key ID: 0D45AD9007D18DCD
4 changed files with 7 additions and 3 deletions

View file

@ -49,6 +49,7 @@ public class DcContext {
public final static int DC_QR_ASK_VERIFYCONTACT = 200; public final static int DC_QR_ASK_VERIFYCONTACT = 200;
public final static int DC_QR_ASK_VERIFYGROUP = 202; public final static int DC_QR_ASK_VERIFYGROUP = 202;
public final static int DC_QR_ASK_JOIN_BROADCAST= 204;
public final static int DC_QR_FPR_OK = 210; public final static int DC_QR_FPR_OK = 210;
public final static int DC_QR_FPR_MISMATCH = 220; public final static int DC_QR_FPR_MISMATCH = 220;
public final static int DC_QR_FPR_WITHOUT_ADDR = 230; public final static int DC_QR_FPR_WITHOUT_ADDR = 230;

View file

@ -314,9 +314,7 @@ public class ProfileAdapter extends RecyclerView.Adapter
if (dcChat != null) { if (dcChat != null) {
if (dcChat.canSend() && dcChat.isEncrypted()) { if (dcChat.canSend() && dcChat.isEncrypted()) {
itemData.add(new ItemData(ITEM_MEMBERS, DcContact.DC_CONTACT_ID_ADD_MEMBER, 0)); itemData.add(new ItemData(ITEM_MEMBERS, DcContact.DC_CONTACT_ID_ADD_MEMBER, 0));
if (!isOutBroadcast) { itemData.add(new ItemData(ITEM_MEMBERS, DcContact.DC_CONTACT_ID_QR_INVITE, 0));
itemData.add(new ItemData(ITEM_MEMBERS, DcContact.DC_CONTACT_ID_QR_INVITE, 0));
}
} }
} }
for (int value : memberList) { for (int value : memberList) {

View file

@ -43,6 +43,7 @@ public class QrCodeHandler {
switch (qrParsed.getState()) { switch (qrParsed.getState()) {
case DcContext.DC_QR_ASK_VERIFYCONTACT: case DcContext.DC_QR_ASK_VERIFYCONTACT:
case DcContext.DC_QR_ASK_VERIFYGROUP: case DcContext.DC_QR_ASK_VERIFYGROUP:
case DcContext.DC_QR_ASK_JOIN_BROADCAST:
showVerifyContactOrGroup(activity, builder, rawString, qrParsed, name); showVerifyContactOrGroup(activity, builder, rawString, qrParsed, name);
break; break;
@ -225,6 +226,9 @@ public class QrCodeHandler {
case DcContext.DC_QR_ASK_VERIFYGROUP: case DcContext.DC_QR_ASK_VERIFYGROUP:
msg = activity.getString(R.string.qrscan_ask_join_group, qrParsed.getText1()); msg = activity.getString(R.string.qrscan_ask_join_group, qrParsed.getText1());
break; break;
case DcContext.DC_QR_ASK_JOIN_BROADCAST:
msg = activity.getString(R.string.qrscan_ask_join_channel, qrParsed.getText1());
break;
default: default:
msg = activity.getString(R.string.ask_start_chat_with, name); msg = activity.getString(R.string.ask_start_chat_with, name);
break; break;

View file

@ -1005,6 +1005,7 @@
<string name="qrscan_hint_desktop">Move the QR code to the camera</string> <string name="qrscan_hint_desktop">Move the QR code to the camera</string>
<string name="qrscan_failed">QR code could not be decoded</string> <string name="qrscan_failed">QR code could not be decoded</string>
<string name="qrscan_ask_join_group">Do you want to join the group \"%1$s\"?</string> <string name="qrscan_ask_join_group">Do you want to join the group \"%1$s\"?</string>
<string name="qrscan_ask_join_channel">Do you want to join the channel \"%1$s\"?</string>
<string name="qrscan_fingerprint_mismatch">The scanned fingerprint does not match the last seen for %1$s.</string> <string name="qrscan_fingerprint_mismatch">The scanned fingerprint does not match the last seen for %1$s.</string>
<string name="qrscan_no_addr_found">This QR code contains a fingerprint but no address.\n\nFor an out-of-band-verification, please establish an encrypted connection to the recipient first.</string> <string name="qrscan_no_addr_found">This QR code contains a fingerprint but no address.\n\nFor an out-of-band-verification, please establish an encrypted connection to the recipient first.</string>
<string name="qrscan_contains_text">Scanned QR code text:\n\n%1$s</string> <string name="qrscan_contains_text">Scanned QR code text:\n\n%1$s</string>