Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into fix/missing-server…
Browse files Browse the repository at this point in the history
…config-crashes-cherry-pick
  • Loading branch information
saleniuk committed Jan 12, 2024
2 parents c4ada85 + e5ee064 commit 8dc5db2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.tooling.preview.Preview
import com.wire.android.R
import com.wire.android.ui.common.banner.SecurityClassificationBannerForConversation
import com.wire.android.ui.common.bottomsheet.WireModalSheetState
Expand All @@ -58,8 +57,10 @@ import com.wire.android.ui.home.messagecomposer.state.MessageComposition
import com.wire.android.ui.home.messagecomposer.state.MessageCompositionHolder
import com.wire.android.ui.home.messagecomposer.state.MessageCompositionInputStateHolder
import com.wire.android.ui.home.messagecomposer.state.Ping
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.android.util.ui.stringWithStyledArgs
import com.wire.kalium.logic.data.conversation.Conversation.TypingIndicatorMode
import com.wire.kalium.logic.data.id.ConversationId
Expand Down Expand Up @@ -109,6 +110,18 @@ fun MessageComposer(
messageListContent = messageListContent
)

InteractionAvailability.UNSUPPORTED_PROTOCOL -> DisabledInteractionMessageComposer(
conversationId = conversationId,
warningText = LocalContext.current.resources.stringWithStyledArgs(
R.string.label_system_message_unsupported_protocol,
MaterialTheme.wireTypography.body01,
MaterialTheme.wireTypography.body02,
colorsScheme().secondaryText,
colorsScheme().onBackground,
),
messageListContent = messageListContent
)

InteractionAvailability.NOT_MEMBER, InteractionAvailability.DISABLED -> DisabledInteractionMessageComposer(
conversationId = conversationId,
warningText = null,
Expand Down Expand Up @@ -195,10 +208,17 @@ private fun DisabledInteractionMessageComposer(
}
}

@Preview
@Composable
fun MessageComposerPreview() {
val messageComposerViewState = remember { mutableStateOf(MessageComposerViewState()) }
private fun BaseComposerPreview(
interactionAvailability: InteractionAvailability = InteractionAvailability.ENABLED,
) = WireTheme {
val messageComposerViewState = remember {
mutableStateOf(
MessageComposerViewState(
interactionAvailability = interactionAvailability
)
)
}
val messageComposition = remember { mutableStateOf(MessageComposition.DEFAULT) }
val selfDeletionTimer = remember { mutableStateOf(SelfDeletionTimer.Enabled(Duration.ZERO)) }

Expand Down Expand Up @@ -226,3 +246,15 @@ fun MessageComposerPreview() {
onTypingEvent = { }
)
}

@PreviewMultipleThemes
@Composable
private fun UnsupportedProtocolComposerPreview() = WireTheme {
BaseComposerPreview(interactionAvailability = InteractionAvailability.UNSUPPORTED_PROTOCOL)
}

@PreviewMultipleThemes
@Composable
private fun EnabledComposerPreview() = WireTheme {
BaseComposerPreview(interactionAvailability = InteractionAvailability.ENABLED)
}
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@
<item quantity="other">%1$s were removed from the team</item>
</plurals>
<string name="label_system_message_user_not_available">This user is no longer available</string>
<string name="label_system_message_unsupported_protocol">The conversation is using an encryption protocol that is
not supported by this device. Some devices from the involve users might need updating.
</string>
<string name="label_system_message_new_conversation_receipt_mode">Read receipts are %1$s</string>
<string name="label_system_message_read_receipt_changed_by_self">%1$s turned read receipts %2$s for everyone</string>
<string name="label_system_message_read_receipt_changed_by_other">%1$s turned read receipts %2$s for everyone</string>
Expand Down

0 comments on commit 8dc5db2

Please sign in to comment.