Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ interface ChatStore : Store<ChatStore.Intent, ChatComponent.State, ChatStore.Lab
data class VideoRecorded(val file: File) : Intent()
data class ForwardMessage(val message: MessageModel) : Intent()
object ForwardSelectedMessages : Intent()
data class RepeatMessage(val message: MessageModel) : Intent()
data class DeleteMessage(val message: MessageModel, val revoke: Boolean = false) : Intent()
data class EditMessage(val message: MessageModel) : Intent()
object CancelEdit : Intent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import org.monogram.presentation.features.chats.currentChat.impl.handlePinMessag
import org.monogram.presentation.features.chats.currentChat.impl.handlePinnedMessageClick
import org.monogram.presentation.features.chats.currentChat.impl.handlePollOptionClick
import org.monogram.presentation.features.chats.currentChat.impl.handleRemoveFromAdBlockWhitelist
import org.monogram.presentation.features.chats.currentChat.impl.handleRepeatMessage
import org.monogram.presentation.features.chats.currentChat.impl.handleReplyMarkupButtonClick
import org.monogram.presentation.features.chats.currentChat.impl.handleReportMessage
import org.monogram.presentation.features.chats.currentChat.impl.handleReportReasonSelected
Expand Down Expand Up @@ -148,6 +149,7 @@ class ChatStoreFactory(
component.handleClearSelection()
}
}
is Intent.RepeatMessage -> component.handleRepeatMessage(intent.message)

is Intent.DeleteMessage -> component.handleDeleteMessage(intent.message, intent.revoke)
is Intent.EditMessage -> component._state.update {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,11 @@ fun ChatMessageOptionsMenu(
}
onDismiss()
},
onDismiss = onDismiss
onRepeat = {
component.onRepeatMessage(selectedMessage)
onDismiss()
},
onDismiss = onDismiss,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,9 @@ internal fun DefaultChatComponent.handleCopyLink(localClipboard: Clipboard) {
}
}
}

internal fun DefaultChatComponent.handleRepeatMessage(message: MessageModel) {
scope.launch {
repositoryMessage.forwardMessage(chatId, chatId, message.id)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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,
)
}

Expand All @@ -973,7 +985,8 @@ private data class MessageMenuSections(
it.hasRestrictAction,
it.hasTelegramSummaryAction,
it.hasTelegramTranslatorAction,
it.hasRestoreOriginalTextAction
it.hasRestoreOriginalTextAction,
it.hasRepeatAction,
)
},
restore = { values ->
Expand All @@ -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],
)
}
)
Expand Down Expand Up @@ -1039,7 +1053,8 @@ private fun buildMenuSections(
hasRestrictAction = canBlock && canRestrict,
hasTelegramSummaryAction = showTelegramSummary,
hasTelegramTranslatorAction = showTelegramTranslator,
hasRestoreOriginalTextAction = showRestoreOriginalText
hasRestoreOriginalTextAction = showRestoreOriginalText,
hasRepeatAction = message.canBeForwarded && canWrite,
)
}

Expand Down
7 changes: 4 additions & 3 deletions presentation/src/main/res/values-es/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
<string name="menu_pin">Fijar</string>
<string name="menu_unpin">Desfijar</string>
<string name="menu_forward">Reenviar</string>
<string name="menu_repeat">+1</string>
<string name="menu_select">Seleccionar</string>
<string name="menu_more">Más</string>
<string name="menu_delete">Eliminar</string>
Expand Down Expand Up @@ -723,7 +724,7 @@
</string>


<!-- Stickers and Emoji -->
<!-- Stickers and Emoji -->
<string name="stickers_emoji_header">Stickers y Emoji</string>
<string name="stickers_tab">Stickers</string>
<string name="emoji_tab">Emoji</string>
Expand Down Expand Up @@ -833,7 +834,7 @@
<string name="privacy_search_users_placeholder">Buscar usuarios</string>
<string name="privacy_no_users_found">No se encontraron usuarios</string>

<!-- Passcode -->
<!-- Passcode -->
<string name="passcode_change_title">Cambiar Código de Acceso</string>
<string name="passcode_set_title">Establecer Código de Acceso</string>
<string name="passcode_change_description">Tu aplicación está protegida actualmente con un código de acceso. Ingresa uno nuevo para cambiarlo.
Expand Down Expand Up @@ -949,7 +950,7 @@
<string name="add_photo_cd">Añadir foto</string>
<string name="change_photo_cd">Cambiar foto</string>

<!-- Permissions -->
<!-- Permissions -->
<string name="permissions_required_title">Permisos Requeridos</string>
<string name="permissions_required_description">Para proporcionar la mejor experiencia, MonoGram necesita los siguientes permisos.</string>
<string name="permission_notifications_title">Notificaciones</string>
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/res/values-hy/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
<string name="menu_pin">Ամրացնել</string>
<string name="menu_unpin">Ապաամրացնել</string>
<string name="menu_forward">Վերահասցեագրել</string>
<string name="menu_repeat">+1</string>
<string name="menu_select">Ընտրել</string>
<string name="menu_more">Ավելին</string>
<string name="menu_delete">Ջնջել</string>
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/res/values-pt-rBR/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
<string name="menu_pin">Fixar</string>
<string name="menu_unpin">Desafixar</string>
<string name="menu_forward">Encaminhar</string>
<string name="menu_repeat">+1</string>
<string name="menu_select">Selecionar</string>
<string name="menu_more">Mais</string>
<string name="menu_delete">Excluir</string>
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/res/values-ru-rRU/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
<string name="menu_pin">Закрепить</string>
<string name="menu_unpin">Открепить</string>
<string name="menu_forward">Переслать</string>
<string name="menu_repeat">+1</string>
<string name="menu_select">Выбрать</string>
<string name="menu_more">Ещё</string>
<string name="menu_delete">Удалить</string>
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/res/values-sk/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
<string name="menu_pin">Pripnúť</string>
<string name="menu_unpin">Odopnúť</string>
<string name="menu_forward">Preposlať</string>
<string name="menu_repeat">+1</string>
<string name="menu_select">Vybrať</string>
<string name="menu_more">Viac</string>
<string name="menu_delete">Odstrániť</string>
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/res/values-uk/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
<string name="menu_pin">Закріпити</string>
<string name="menu_unpin">Відкріпити</string>
<string name="menu_forward">Переслати</string>
<string name="menu_repeat">+1</string>
<string name="menu_select">Вибрати</string>
<string name="menu_more">Ще</string>
<string name="menu_delete">Видалити</string>
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/res/values-zh-rCN/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
<string name="menu_pin">置顶</string>
<string name="menu_unpin">取消置顶</string>
<string name="menu_forward">转发</string>
<string name="menu_repeat">+1</string>
<string name="menu_select">选择</string>
<string name="menu_more">更多</string>
<string name="menu_delete">删除</string>
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
<string name="menu_pin">Pin</string>
<string name="menu_unpin">Unpin</string>
<string name="menu_forward">Forward</string>
<string name="menu_repeat">+1</string>
<string name="menu_select">Select</string>
<string name="menu_more">More</string>
<string name="menu_delete">Delete</string>
Expand Down