diff --git a/CHANGELOG-upstream.md b/CHANGELOG-upstream.md index f9627a1f1..52bb99220 100644 --- a/CHANGELOG-upstream.md +++ b/CHANGELOG-upstream.md @@ -10,9 +10,12 @@ * Allow to share location for 24 hours * Allow mini-apps to play audio without user interaction * Mark chats as unread (long tap a chat and select the corresponding option from the three-dot-menu) +* Add "Mark all as read" option to profile menu in the profile switcher * Fix process of upgrading from a very old version of the app * Show more recent added stickers at the top of the sticker picker +* Allow to open links in messages via actions in TalkBack menu * Allow to open map if user clicks "Location streaming enabled" system message +* Fix: do not accidentally set draft in chats that don't allow sending messages ## v2.49.0 2026-04 diff --git a/src/main/java/org/thoughtcrime/securesms/ConversationActivity.java b/src/main/java/org/thoughtcrime/securesms/ConversationActivity.java index 038512368..0ddff4391 100644 --- a/src/main/java/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/main/java/org/thoughtcrime/securesms/ConversationActivity.java @@ -676,8 +676,14 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity } public void setDraftText(String txt) { - composeText.setText(txt); - composeText.setSelection(composeText.getText().length()); + try { + if (rpc.canSend(rpc.getSelectedAccountId(), chatId)) { + composeText.setText(txt); + composeText.setSelection(composeText.getText().length()); + } + } catch (RpcException e) { + Log.e(TAG, "Rpc error", e); + } } public void hideSoftKeyboard() { @@ -1123,6 +1129,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity if (chatId == DcChat.DC_CHAT_NO_CHAT) throw new IllegalStateException("can't display a conversation for no chat."); dcChat = DcHelper.getContext(context).getChat(chatId); + attachmentTypeSelector = null; recipient = new Recipient(this, dcChat); glideRequests = GlideApp.with(this); @@ -1271,6 +1278,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity DcContext dcContext = DcHelper.getContext(context); final int currentChatId = dcChat.getId(); + final boolean canSend = dcChat.canSend(); Util.runOnAnyBackgroundThread( () -> { DcMsg msg = null; @@ -1393,7 +1401,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity } } } else { - dcContext.setDraft(currentChatId, msg); + // set or clear draft if user can't send in chat since they can't delete it otherwise + dcContext.setDraft(currentChatId, canSend ? msg : null); } future.set(currentChatId); }); diff --git a/src/main/java/org/thoughtcrime/securesms/ConversationItem.java b/src/main/java/org/thoughtcrime/securesms/ConversationItem.java index ede78e8a4..98fe156da 100644 --- a/src/main/java/org/thoughtcrime/securesms/ConversationItem.java +++ b/src/main/java/org/thoughtcrime/securesms/ConversationItem.java @@ -24,6 +24,7 @@ import android.graphics.PorterDuff; import android.graphics.Rect; import android.os.Build; import android.text.Spannable; +import android.text.Spanned; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; @@ -36,6 +37,7 @@ import androidx.annotation.DimenRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; +import androidx.core.view.ViewCompat; import chat.delta.rpc.RpcException; import chat.delta.rpc.types.CallInfo; import chat.delta.rpc.types.CallState; @@ -44,6 +46,7 @@ import chat.delta.rpc.types.VcardContact; import com.b44t.messenger.DcChat; import com.b44t.messenger.DcContact; import com.b44t.messenger.DcMsg; +import java.util.ArrayList; import java.util.List; import java.util.Set; import org.thoughtcrime.securesms.calls.CallCoordinator; @@ -72,6 +75,7 @@ import org.thoughtcrime.securesms.mms.VcardSlide; import org.thoughtcrime.securesms.reactions.ReactionsConversationView; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.util.Linkifier; +import org.thoughtcrime.securesms.util.LongClickCopySpan; import org.thoughtcrime.securesms.util.LongClickMovementMethod; import org.thoughtcrime.securesms.util.MarkdownUtil; import org.thoughtcrime.securesms.util.MediaUtil; @@ -120,6 +124,9 @@ public class ConversationItem extends BaseConversationItem { private Stub callViewStub; private @Nullable EventListener eventListener; + // IDs of accessibility actions registered via ViewCompat.addAccessibilityAction + private final List linkActionIds = new ArrayList<>(); + private int measureCalls; private int incomingBubbleColor; @@ -424,6 +431,12 @@ public class ConversationItem extends BaseConversationItem { bodyText.setClickable(false); bodyText.setFocusable(false); + // Remove any link actions registered for the previous message binding + for (int id : linkActionIds) { + ViewCompat.removeAccessibilityAction(this, id); + } + linkActionIds.clear(); + String subject = messageRecord.getSubject(); String text = messageRecord.getText(); @@ -433,12 +446,33 @@ public class ConversationItem extends BaseConversationItem { if (messageRecord.getType() == DcMsg.DC_MSG_CALL || text.isEmpty()) { bodyText.setVisibility(View.GONE); } else { - Spannable spannable = (Spannable) MarkdownUtil.toMarkdown(context, text); + Spannable spannable = MarkdownUtil.toMarkdown(context, text); if (batchSelected.isEmpty()) { - spannable = Linkifier.linkify(spannable); + Linkifier.linkify(spannable); } bodyText.setText(spannable); bodyText.setVisibility(View.VISIBLE); + + // Register a TalkBack "Actions" entry for each link in the message + Spanned spanned = (Spanned) spannable; + final TextView tv = bodyText; + for (LongClickCopySpan span : + spanned.getSpans(0, spanned.length(), LongClickCopySpan.class)) { + int start = spanned.getSpanStart(span); + int end = spanned.getSpanEnd(span); + if (start >= 0 && end > start && end <= spanned.length()) { + String linkText = spanned.subSequence(start, end).toString(); + String label = context.getString(R.string.accessibility_link_action, linkText); + linkActionIds.add( + ViewCompat.addAccessibilityAction( + this, + label, + (v, args) -> { + span.onClick(tv); + return true; + })); + } + } } int downloadState = messageRecord.getDownloadState(); diff --git a/src/main/java/org/thoughtcrime/securesms/accounts/AccountSelectionListFragment.java b/src/main/java/org/thoughtcrime/securesms/accounts/AccountSelectionListFragment.java index bd96b0848..c40891add 100644 --- a/src/main/java/org/thoughtcrime/securesms/accounts/AccountSelectionListFragment.java +++ b/src/main/java/org/thoughtcrime/securesms/accounts/AccountSelectionListFragment.java @@ -157,6 +157,12 @@ public class AccountSelectionListFragment extends DialogFragment onSetTag(accountId); } else if (itemId == R.id.menu_move_to_top) { onMoveToTop(accountId); + } else if (itemId == R.id.menu_mark_all_as_read) { + try { + DcHelper.getRpc(requireActivity()).marknoticedAllChats(accountId); + } catch (RpcException e) { + Log.e(TAG, "Error calling rpc.marknoticedAllChats()", e); + } } } diff --git a/src/main/java/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java b/src/main/java/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java index 0bca69cea..6992b1e54 100644 --- a/src/main/java/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java +++ b/src/main/java/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java @@ -92,6 +92,10 @@ public class AttachmentTypeSelector extends PopupWindow { ViewUtil.findById(layout, R.id.location_linear_layout).setVisibility(View.GONE); } + if (DcHelper.getContext(context).getChat(chatId).isOutBroadcast()) { + ViewUtil.findById(layout, R.id.webxdc_linear_layout).setVisibility(View.GONE); + } + setLocationButtonImage(context); setContentView(layout); diff --git a/src/main/res/layout/attachment_type_selector.xml b/src/main/res/layout/attachment_type_selector.xml index eaaeca1f7..a65c37a9d 100644 --- a/src/main/res/layout/attachment_type_selector.xml +++ b/src/main/res/layout/attachment_type_selector.xml @@ -126,6 +126,7 @@ + + diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 6c4b5b29a..f38eccf08 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -814,16 +814,23 @@ Wallpaper Use Default Image Select From Gallery + If you change this option, make sure, your server and your other clients are configured accordingly.\n\nOtherwise things may not work at all. Multi-Device Mode Synchronize your messages with your other devices. Automatically enabled on adding a second device Multi-Device Mode must be enabled when using the same profile on multiple devices. Only disable this setting if you have removed this profile from all your other devices.\n\nDisabling Multi-Device Mode while using the profile on multiple devices will result in missed messages and other problems. + Move automatically to DeltaChat Folder + Only Fetch from DeltaChat Folder + Show Classic Emails + No, chats only + For accepted contacts + All Experimental Features These features may be unstable and may be changed or removed @@ -878,14 +885,17 @@ Delete Old Messages Delete Messages from Device + Delete Messages from Server Do you want to delete %1$d messages now and all newly fetched messages \"%2$s\" in the future?\n\n• This includes all media\n\n• Messages will be deleted whether they were seen or not\n\n• \"Saved messages\" will be skipped from local deletion - + Do you want to delete %1$d messages now and all newly fetched messages \"%2$s\" in the future?\n\n⚠️ This includes emails, media and \"Saved messages\" in all server folders\n\n⚠️ Do not use this function if you want to keep data on the server or if you use classic email clients as well - + This includes emails, media and \"Saved messages\" in all server folders. Do not use this function if you want to keep data on the server or if you use classic email clients as well + Turn on at-once deletion + If you enable at-once deletion you cannot use multiple devices on this profile. I understand, delete all these messages @@ -1217,6 +1227,9 @@ Tap here to receive messages while Delta Chat is in the background. You already allowed Delta Chat to receive messages in the background.\n\nIf messages still do not arrive in background, please also check your system settings. + + Open %1$s + What\'s new?\n\n💯 End-to-end encryption is reliable and forever now. Padlocks 🔒 are gone!\n\n✉️ Classic email without end-to-end encryption is marked with a letter symbol\n\n😻 New enhanced profile screen for all your contacts\n\n🔲 New button for quick access to apps used in a chat\n\n❤️ Please donate to help us remain independent and continue to bring improvements: %1$s