Skip to content

Commit 9f63371

Browse files
committed
feat: Adapt to channel-invite QR codes
1 parent 5716372 commit 9f63371

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/main/java/com/b44t/messenger/DcContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class DcContext {
4949

5050
public final static int DC_QR_ASK_VERIFYCONTACT = 200;
5151
public final static int DC_QR_ASK_VERIFYGROUP = 202;
52+
public final static int DC_QR_ASK_JOIN_BROADCAST= 204;
5253
public final static int DC_QR_FPR_OK = 210;
5354
public final static int DC_QR_FPR_MISMATCH = 220;
5455
public final static int DC_QR_FPR_WITHOUT_ADDR = 230;

src/main/java/org/thoughtcrime/securesms/ProfileAdapter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,7 @@ public void changeData(@Nullable int[] memberList, @Nullable DcContact dcContact
314314
if (dcChat != null) {
315315
if (dcChat.canSend() && dcChat.isEncrypted()) {
316316
itemData.add(new ItemData(ITEM_MEMBERS, DcContact.DC_CONTACT_ID_ADD_MEMBER, 0));
317-
if (!isOutBroadcast) {
318-
itemData.add(new ItemData(ITEM_MEMBERS, DcContact.DC_CONTACT_ID_QR_INVITE, 0));
319-
}
317+
itemData.add(new ItemData(ITEM_MEMBERS, DcContact.DC_CONTACT_ID_QR_INVITE, 0));
320318
}
321319
}
322320
for (int value : memberList) {

src/main/java/org/thoughtcrime/securesms/qr/QrCodeHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public void handleQrData(String rawString) {
4343
switch (qrParsed.getState()) {
4444
case DcContext.DC_QR_ASK_VERIFYCONTACT:
4545
case DcContext.DC_QR_ASK_VERIFYGROUP:
46+
case DcContext.DC_QR_ASK_JOIN_BROADCAST:
4647
showVerifyContactOrGroup(activity, builder, rawString, qrParsed, name);
4748
break;
4849

@@ -225,6 +226,9 @@ private void showVerifyContactOrGroup(Activity activity, AlertDialog.Builder bui
225226
case DcContext.DC_QR_ASK_VERIFYGROUP:
226227
msg = activity.getString(R.string.qrscan_ask_join_group, qrParsed.getText1());
227228
break;
229+
case DcContext.DC_QR_ASK_JOIN_BROADCAST:
230+
msg = activity.getString(R.string.qrscan_ask_join_channel, qrParsed.getText1());
231+
break;
228232
default:
229233
msg = activity.getString(R.string.ask_start_chat_with, name);
230234
break;

src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@
10051005
<string name="qrscan_hint_desktop">Move the QR code to the camera</string>
10061006
<string name="qrscan_failed">QR code could not be decoded</string>
10071007
<string name="qrscan_ask_join_group">Do you want to join the group \"%1$s\"?</string>
1008+
<string name="qrscan_ask_join_channel">Do you want to join the channel \"%1$s\"?</string>
10081009
<string name="qrscan_fingerprint_mismatch">The scanned fingerprint does not match the last seen for %1$s.</string>
10091010
<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>
10101011
<string name="qrscan_contains_text">Scanned QR code text:\n\n%1$s</string>

0 commit comments

Comments
 (0)