mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 14:48:26 +00:00
Hide reply button in MessageDetails for group invitations
This commit is contained in:
parent
1d9ac6ac10
commit
22660fd49c
@ -123,7 +123,7 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
AppTheme {
|
AppTheme {
|
||||||
MessageDetails(
|
MessageDetails(
|
||||||
state = state,
|
state = state,
|
||||||
onReply = { setResultAndFinish(ON_REPLY) },
|
onReply = if (state.canReply) { { setResultAndFinish(ON_REPLY) } } else null,
|
||||||
onResend = state.error?.let { { setResultAndFinish(ON_RESEND) } },
|
onResend = state.error?.let { { setResultAndFinish(ON_RESEND) } },
|
||||||
onDelete = { setResultAndFinish(ON_DELETE) },
|
onDelete = { setResultAndFinish(ON_DELETE) },
|
||||||
onClickImage = { viewModel.onClickImage(it) },
|
onClickImage = { viewModel.onClickImage(it) },
|
||||||
@ -145,7 +145,7 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
@Composable
|
@Composable
|
||||||
fun MessageDetails(
|
fun MessageDetails(
|
||||||
state: MessageDetailsState,
|
state: MessageDetailsState,
|
||||||
onReply: () -> Unit = {},
|
onReply: (() -> Unit)? = null,
|
||||||
onResend: (() -> Unit)? = null,
|
onResend: (() -> Unit)? = null,
|
||||||
onDelete: () -> Unit = {},
|
onDelete: () -> Unit = {},
|
||||||
onClickImage: (Int) -> Unit = {},
|
onClickImage: (Int) -> Unit = {},
|
||||||
@ -214,18 +214,20 @@ fun CellMetadata(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CellButtons(
|
fun CellButtons(
|
||||||
onReply: () -> Unit = {},
|
onReply: (() -> Unit)? = null,
|
||||||
onResend: (() -> Unit)? = null,
|
onResend: (() -> Unit)? = null,
|
||||||
onDelete: () -> Unit = {},
|
onDelete: () -> Unit = {},
|
||||||
) {
|
) {
|
||||||
Cell {
|
Cell {
|
||||||
Column {
|
Column {
|
||||||
ItemButton(
|
onReply?.let {
|
||||||
stringResource(R.string.reply),
|
ItemButton(
|
||||||
R.drawable.ic_message_details__reply,
|
stringResource(R.string.reply),
|
||||||
onClick = onReply
|
R.drawable.ic_message_details__reply,
|
||||||
)
|
onClick = it
|
||||||
Divider()
|
)
|
||||||
|
Divider()
|
||||||
|
}
|
||||||
onResend?.let {
|
onResend?.let {
|
||||||
ItemButton(
|
ItemButton(
|
||||||
stringResource(R.string.resend),
|
stringResource(R.string.resend),
|
||||||
|
@ -117,7 +117,7 @@ class MessageDetailsViewModel @Inject constructor(
|
|||||||
Attachment(slide.details, slide.fileName.orNull(), slide.uri, slide is ImageSlide)
|
Attachment(slide.details, slide.fileName.orNull(), slide.uri, slide is ImageSlide)
|
||||||
|
|
||||||
fun onClickImage(index: Int) {
|
fun onClickImage(index: Int) {
|
||||||
val state = state.value ?: return
|
val state = state.value
|
||||||
val mmsRecord = state.mmsRecord ?: return
|
val mmsRecord = state.mmsRecord ?: return
|
||||||
val slide = mmsRecord.slideDeck.slides[index] ?: return
|
val slide = mmsRecord.slideDeck.slides[index] ?: return
|
||||||
// only open to downloaded images
|
// only open to downloaded images
|
||||||
@ -158,6 +158,7 @@ data class MessageDetailsState(
|
|||||||
val thread: Recipient? = null,
|
val thread: Recipient? = null,
|
||||||
) {
|
) {
|
||||||
val fromTitle = GetString(R.string.message_details_header__from)
|
val fromTitle = GetString(R.string.message_details_header__from)
|
||||||
|
val canReply = record?.isOpenGroupInvitation != true
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Attachment(
|
data class Attachment(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user