Restore disappearing messages menu item

This commit is contained in:
charles 2022-12-19 14:59:12 +11:00
parent 9d056ff15b
commit 644484b650
4 changed files with 28 additions and 4 deletions

View File

@ -56,10 +56,12 @@ object ConversationMenuHelper {
// Base menu (options that should always be present)
inflater.inflate(R.menu.menu_conversation, menu)
// Expiring messages
if (config?.isEnabled != true && !isOpenGroup &&
(thread.hasApprovedMe() || thread.isClosedGroupRecipient || thread.isLocalNumber)
) {
inflater.inflate(R.menu.menu_conversation_expiration_off, menu)
if (!isOpenGroup && (thread.hasApprovedMe() || thread.isClosedGroupRecipient || thread.isLocalNumber)) {
if (config?.isEnabled != true) {
inflater.inflate(R.menu.menu_conversation_expiration_off, menu)
} else {
inflater.inflate(R.menu.menu_conversation_expiration_on, menu)
}
}
// One-on-one chat menu (options that should only be present for one-on-one chats)
if (thread.isContactRecipient) {
@ -131,6 +133,7 @@ object ConversationMenuHelper {
R.id.menu_view_all_media -> { showAllMedia(context, thread) }
R.id.menu_search -> { search(context) }
R.id.menu_add_shortcut -> { addShortcut(context, thread) }
R.id.menu_expiring_messages -> { showExpirationSettings(context, thread) }
R.id.menu_expiring_messages_off -> { showExpirationSettings(context, thread) }
R.id.menu_unblock -> { unblock(context, thread) }
R.id.menu_block -> { block(context, thread, deleteThread = false) }

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M15,1L9,1v2h6L15,1zM11,14h2L13,8h-2v6zM19.03,7.39l1.42,-1.42c-0.43,-0.51 -0.9,-0.99 -1.41,-1.41l-1.42,1.42C16.07,4.74 14.12,4 12,4c-4.97,0 -9,4.03 -9,9s4.02,9 9,9 9,-4.03 9,-9c0,-2.12 -0.74,-4.07 -1.97,-5.61zM12,20c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z" />
</vector>

View File

@ -211,6 +211,7 @@
android:id="@+id/outdatedBannerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_centerInParent="true"
android:layout_marginVertical="@dimen/very_small_spacing"
android:layout_marginHorizontal="@dimen/medium_spacing"

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_expiring_messages"
android:title="@string/menu_conversation_expiring_on__messages_expiring"
android:icon="@drawable/ic_baseline_timer_on_24" />
</menu>