diff --git a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/ChatComponent.kt b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/ChatComponent.kt index 21e95bf8..cec5e0f9 100644 --- a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/ChatComponent.kt +++ b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/ChatComponent.kt @@ -84,6 +84,7 @@ interface ChatComponent { fun onVideoRecorded(file: File) fun onForwardMessage(message: MessageModel) fun onForwardSelectedMessages() + fun onRepeatMessage(message: MessageModel) fun onDeleteMessage(message: MessageModel, revoke: Boolean = false) fun onEditMessage(message: MessageModel) fun onCancelEdit() diff --git a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/ChatStore.kt b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/ChatStore.kt index d4ad132a..91760061 100644 --- a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/ChatStore.kt +++ b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/ChatStore.kt @@ -66,6 +66,7 @@ interface ChatStore : Store component.handleRepeatMessage(intent.message) is Intent.DeleteMessage -> component.handleDeleteMessage(intent.message, intent.revoke) is Intent.EditMessage -> component._state.update { diff --git a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/DefaultChatComponent.kt b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/DefaultChatComponent.kt index de33f752..88174293 100644 --- a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/DefaultChatComponent.kt +++ b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/DefaultChatComponent.kt @@ -376,6 +376,8 @@ class DefaultChatComponent( override fun onForwardSelectedMessages() = store.accept(ChatStore.Intent.ForwardSelectedMessages) + override fun onRepeatMessage(message: MessageModel) = store.accept(ChatStore.Intent.RepeatMessage(message)) + override fun onDeleteMessage(message: MessageModel, revoke: Boolean) = store.accept(ChatStore.Intent.DeleteMessage(message, revoke)) diff --git a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/chatContent/ChatMessageOptionsMenu.kt b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/chatContent/ChatMessageOptionsMenu.kt index 9b63400b..a19d3279 100644 --- a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/chatContent/ChatMessageOptionsMenu.kt +++ b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/chatContent/ChatMessageOptionsMenu.kt @@ -423,7 +423,11 @@ fun ChatMessageOptionsMenu( } onDismiss() }, - onDismiss = onDismiss + onRepeat = { + component.onRepeatMessage(selectedMessage) + onDismiss() + }, + onDismiss = onDismiss, ) } diff --git a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/impl/MessageActions.kt b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/impl/MessageActions.kt index 49085ce5..adf33516 100644 --- a/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/impl/MessageActions.kt +++ b/presentation/src/main/java/org/monogram/presentation/features/chats/currentChat/impl/MessageActions.kt @@ -341,3 +341,9 @@ internal fun DefaultChatComponent.handleCopyLink(localClipboard: Clipboard) { } } } + +internal fun DefaultChatComponent.handleRepeatMessage(message: MessageModel) { + scope.launch { + repositoryMessage.forwardMessage(chatId, chatId, message.id) + } +} diff --git a/presentation/src/main/java/org/monogram/presentation/features/stickers/ui/menu/MessageOptionsMenu.kt b/presentation/src/main/java/org/monogram/presentation/features/stickers/ui/menu/MessageOptionsMenu.kt index 574d9e4d..851278be 100644 --- a/presentation/src/main/java/org/monogram/presentation/features/stickers/ui/menu/MessageOptionsMenu.kt +++ b/presentation/src/main/java/org/monogram/presentation/features/stickers/ui/menu/MessageOptionsMenu.kt @@ -67,6 +67,7 @@ import androidx.compose.material.icons.rounded.Edit import androidx.compose.material.icons.rounded.Gavel import androidx.compose.material.icons.rounded.Link import androidx.compose.material.icons.rounded.MoreHoriz +import androidx.compose.material.icons.rounded.PlusOne import androidx.compose.material.icons.rounded.PushPin import androidx.compose.material.icons.rounded.Report import androidx.compose.material.icons.rounded.Translate @@ -188,7 +189,8 @@ fun MessageOptionsMenu( onReport: () -> Unit = {}, onBlock: () -> Unit = {}, onRestrict: () -> Unit = {}, - onDismiss: () -> Unit + onRepeat: () -> Unit, + onDismiss: () -> Unit, ) { val density = LocalDensity.current val haptic = LocalHapticFeedback.current @@ -759,6 +761,14 @@ fun MessageOptionsMenu( ) } + if (sections.hasRepeatAction) { + InternalMenuOptionItem( + icon = Icons.Rounded.PlusOne, + text = stringResource(R.string.menu_repeat), + onClick = { animateOutAndDismiss(onRepeat) } + ) + } + if (sections.hasDownloadAction) { InternalMenuOptionItem( icon = Icons.Rounded.Download, @@ -927,7 +937,8 @@ private data class MessageMenuSections( val hasRestrictAction: Boolean, val hasTelegramSummaryAction: Boolean, val hasTelegramTranslatorAction: Boolean, - val hasRestoreOriginalTextAction: Boolean + val hasRestoreOriginalTextAction: Boolean, + val hasRepeatAction: Boolean, ) { fun merge(other: MessageMenuSections): MessageMenuSections { return MessageMenuSections( @@ -948,7 +959,8 @@ private data class MessageMenuSections( hasRestrictAction = hasRestrictAction || other.hasRestrictAction, hasTelegramSummaryAction = hasTelegramSummaryAction || other.hasTelegramSummaryAction, hasTelegramTranslatorAction = hasTelegramTranslatorAction || other.hasTelegramTranslatorAction, - hasRestoreOriginalTextAction = hasRestoreOriginalTextAction || other.hasRestoreOriginalTextAction + hasRestoreOriginalTextAction = hasRestoreOriginalTextAction || other.hasRestoreOriginalTextAction, + hasRepeatAction = hasRepeatAction || other.hasRepeatAction, ) } @@ -973,7 +985,8 @@ private data class MessageMenuSections( it.hasRestrictAction, it.hasTelegramSummaryAction, it.hasTelegramTranslatorAction, - it.hasRestoreOriginalTextAction + it.hasRestoreOriginalTextAction, + it.hasRepeatAction, ) }, restore = { values -> @@ -995,7 +1008,8 @@ private data class MessageMenuSections( hasRestrictAction = values[14], hasTelegramSummaryAction = values[15], hasTelegramTranslatorAction = values[16], - hasRestoreOriginalTextAction = values[17] + hasRestoreOriginalTextAction = values[17], + hasRepeatAction = values[18], ) } ) @@ -1039,7 +1053,8 @@ private fun buildMenuSections( hasRestrictAction = canBlock && canRestrict, hasTelegramSummaryAction = showTelegramSummary, hasTelegramTranslatorAction = showTelegramTranslator, - hasRestoreOriginalTextAction = showRestoreOriginalText + hasRestoreOriginalTextAction = showRestoreOriginalText, + hasRepeatAction = message.canBeForwarded && canWrite, ) } diff --git a/presentation/src/main/res/values-es/string.xml b/presentation/src/main/res/values-es/string.xml index b711dec4..edcd602a 100644 --- a/presentation/src/main/res/values-es/string.xml +++ b/presentation/src/main/res/values-es/string.xml @@ -232,6 +232,7 @@ Fijar Desfijar Reenviar + +1 Seleccionar Más Eliminar @@ -723,7 +724,7 @@ - + Stickers y Emoji Stickers Emoji @@ -833,7 +834,7 @@ Buscar usuarios No se encontraron usuarios - + Cambiar Código de Acceso Establecer Código de Acceso Tu aplicación está protegida actualmente con un código de acceso. Ingresa uno nuevo para cambiarlo. @@ -949,7 +950,7 @@ Añadir foto Cambiar foto - + Permisos Requeridos Para proporcionar la mejor experiencia, MonoGram necesita los siguientes permisos. Notificaciones diff --git a/presentation/src/main/res/values-hy/string.xml b/presentation/src/main/res/values-hy/string.xml index 6cb51871..e93956a9 100644 --- a/presentation/src/main/res/values-hy/string.xml +++ b/presentation/src/main/res/values-hy/string.xml @@ -223,6 +223,7 @@ Ամրացնել Ապաամրացնել Վերահասցեագրել + +1 Ընտրել Ավելին Ջնջել diff --git a/presentation/src/main/res/values-pt-rBR/string.xml b/presentation/src/main/res/values-pt-rBR/string.xml index 07b62519..7090ef0e 100644 --- a/presentation/src/main/res/values-pt-rBR/string.xml +++ b/presentation/src/main/res/values-pt-rBR/string.xml @@ -233,6 +233,7 @@ Fixar Desafixar Encaminhar + +1 Selecionar Mais Excluir diff --git a/presentation/src/main/res/values-ru-rRU/string.xml b/presentation/src/main/res/values-ru-rRU/string.xml index 34907cfc..b3771e5f 100644 --- a/presentation/src/main/res/values-ru-rRU/string.xml +++ b/presentation/src/main/res/values-ru-rRU/string.xml @@ -231,6 +231,7 @@ Закрепить Открепить Переслать + +1 Выбрать Ещё Удалить diff --git a/presentation/src/main/res/values-sk/string.xml b/presentation/src/main/res/values-sk/string.xml index 6a4edc6a..0d8bd0bd 100644 --- a/presentation/src/main/res/values-sk/string.xml +++ b/presentation/src/main/res/values-sk/string.xml @@ -241,6 +241,7 @@ Pripnúť Odopnúť Preposlať + +1 Vybrať Viac Odstrániť diff --git a/presentation/src/main/res/values-uk/string.xml b/presentation/src/main/res/values-uk/string.xml index ab87273f..329a52ec 100644 --- a/presentation/src/main/res/values-uk/string.xml +++ b/presentation/src/main/res/values-uk/string.xml @@ -231,6 +231,7 @@ Закріпити Відкріпити Переслати + +1 Вибрати Ще Видалити diff --git a/presentation/src/main/res/values-zh-rCN/string.xml b/presentation/src/main/res/values-zh-rCN/string.xml index 4a11de8a..41833daa 100644 --- a/presentation/src/main/res/values-zh-rCN/string.xml +++ b/presentation/src/main/res/values-zh-rCN/string.xml @@ -231,6 +231,7 @@ 置顶 取消置顶 转发 + +1 选择 更多 删除 diff --git a/presentation/src/main/res/values/string.xml b/presentation/src/main/res/values/string.xml index d300c61d..3f20c15c 100644 --- a/presentation/src/main/res/values/string.xml +++ b/presentation/src/main/res/values/string.xml @@ -233,6 +233,7 @@ Pin Unpin Forward + +1 Select More Delete