Remove FeatureFlag.VoiceMessages
This commit is contained in:
parent
0eadf275e1
commit
be4e52e6ec
11 changed files with 19 additions and 122 deletions
|
|
@ -187,11 +187,6 @@ class MessagesPresenter @AssistedInject constructor(
|
||||||
|
|
||||||
val snackbarMessage by snackbarDispatcher.collectSnackbarMessageAsState()
|
val snackbarMessage by snackbarDispatcher.collectSnackbarMessageAsState()
|
||||||
|
|
||||||
var enableVoiceMessages by remember { mutableStateOf(false) }
|
|
||||||
LaunchedEffect(featureFlagsService) {
|
|
||||||
enableVoiceMessages = featureFlagsService.isFeatureEnabled(FeatureFlags.VoiceMessages)
|
|
||||||
}
|
|
||||||
|
|
||||||
var dmUserVerificationState by remember { mutableStateOf<IdentityState?>(null) }
|
var dmUserVerificationState by remember { mutableStateOf<IdentityState?>(null) }
|
||||||
|
|
||||||
val membersState by room.membersStateFlow.collectAsState()
|
val membersState by room.membersStateFlow.collectAsState()
|
||||||
|
|
@ -261,7 +256,6 @@ class MessagesPresenter @AssistedInject constructor(
|
||||||
showReinvitePrompt = showReinvitePrompt,
|
showReinvitePrompt = showReinvitePrompt,
|
||||||
inviteProgress = inviteProgress.value,
|
inviteProgress = inviteProgress.value,
|
||||||
enableTextFormatting = MessageComposerConfig.ENABLE_RICH_TEXT_EDITING,
|
enableTextFormatting = MessageComposerConfig.ENABLE_RICH_TEXT_EDITING,
|
||||||
enableVoiceMessages = enableVoiceMessages,
|
|
||||||
appName = buildMeta.applicationName,
|
appName = buildMeta.applicationName,
|
||||||
roomCallState = roomCallState,
|
roomCallState = roomCallState,
|
||||||
pinnedMessagesBannerState = pinnedMessagesBannerState,
|
pinnedMessagesBannerState = pinnedMessagesBannerState,
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ data class MessagesState(
|
||||||
val inviteProgress: AsyncData<Unit>,
|
val inviteProgress: AsyncData<Unit>,
|
||||||
val showReinvitePrompt: Boolean,
|
val showReinvitePrompt: Boolean,
|
||||||
val enableTextFormatting: Boolean,
|
val enableTextFormatting: Boolean,
|
||||||
val enableVoiceMessages: Boolean,
|
|
||||||
val roomCallState: RoomCallState,
|
val roomCallState: RoomCallState,
|
||||||
val appName: String,
|
val appName: String,
|
||||||
val pinnedMessagesBannerState: PinnedMessagesBannerState,
|
val pinnedMessagesBannerState: PinnedMessagesBannerState,
|
||||||
|
|
|
||||||
|
|
@ -61,14 +61,12 @@ open class MessagesStateProvider : PreviewParameterProvider<MessagesState> {
|
||||||
aMessagesState(roomName = null),
|
aMessagesState(roomName = null),
|
||||||
aMessagesState(composerState = aMessageComposerState(showTextFormatting = true)),
|
aMessagesState(composerState = aMessageComposerState(showTextFormatting = true)),
|
||||||
aMessagesState(
|
aMessagesState(
|
||||||
enableVoiceMessages = true,
|
|
||||||
voiceMessageComposerState = aVoiceMessageComposerState(showPermissionRationaleDialog = true),
|
voiceMessageComposerState = aVoiceMessageComposerState(showPermissionRationaleDialog = true),
|
||||||
),
|
),
|
||||||
aMessagesState(
|
aMessagesState(
|
||||||
roomCallState = anOngoingCallState(),
|
roomCallState = anOngoingCallState(),
|
||||||
),
|
),
|
||||||
aMessagesState(
|
aMessagesState(
|
||||||
enableVoiceMessages = true,
|
|
||||||
voiceMessageComposerState = aVoiceMessageComposerState(
|
voiceMessageComposerState = aVoiceMessageComposerState(
|
||||||
voiceMessageState = aVoiceMessagePreviewState(),
|
voiceMessageState = aVoiceMessagePreviewState(),
|
||||||
showSendFailureDialog = true
|
showSendFailureDialog = true
|
||||||
|
|
@ -113,7 +111,6 @@ fun aMessagesState(
|
||||||
reactionSummaryState: ReactionSummaryState = aReactionSummaryState(),
|
reactionSummaryState: ReactionSummaryState = aReactionSummaryState(),
|
||||||
hasNetworkConnection: Boolean = true,
|
hasNetworkConnection: Boolean = true,
|
||||||
showReinvitePrompt: Boolean = false,
|
showReinvitePrompt: Boolean = false,
|
||||||
enableVoiceMessages: Boolean = true,
|
|
||||||
roomCallState: RoomCallState = aStandByCallState(),
|
roomCallState: RoomCallState = aStandByCallState(),
|
||||||
pinnedMessagesBannerState: PinnedMessagesBannerState = aLoadedPinnedMessagesBannerState(),
|
pinnedMessagesBannerState: PinnedMessagesBannerState = aLoadedPinnedMessagesBannerState(),
|
||||||
dmUserVerificationState: IdentityState? = null,
|
dmUserVerificationState: IdentityState? = null,
|
||||||
|
|
@ -141,7 +138,6 @@ fun aMessagesState(
|
||||||
inviteProgress = AsyncData.Uninitialized,
|
inviteProgress = AsyncData.Uninitialized,
|
||||||
showReinvitePrompt = showReinvitePrompt,
|
showReinvitePrompt = showReinvitePrompt,
|
||||||
enableTextFormatting = true,
|
enableTextFormatting = true,
|
||||||
enableVoiceMessages = enableVoiceMessages,
|
|
||||||
roomCallState = roomCallState,
|
roomCallState = roomCallState,
|
||||||
appName = "Element",
|
appName = "Element",
|
||||||
pinnedMessagesBannerState = pinnedMessagesBannerState,
|
pinnedMessagesBannerState = pinnedMessagesBannerState,
|
||||||
|
|
|
||||||
|
|
@ -377,7 +377,7 @@ private fun MessagesViewContent(
|
||||||
enableTextFormatting = state.enableTextFormatting,
|
enableTextFormatting = state.enableTextFormatting,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (state.enableVoiceMessages && state.voiceMessageComposerState.showPermissionRationaleDialog) {
|
if (state.voiceMessageComposerState.showPermissionRationaleDialog) {
|
||||||
VoiceMessagePermissionRationaleDialog(
|
VoiceMessagePermissionRationaleDialog(
|
||||||
onContinue = {
|
onContinue = {
|
||||||
state.voiceMessageComposerState.eventSink(VoiceMessageComposerEvents.AcceptPermissionRationale)
|
state.voiceMessageComposerState.eventSink(VoiceMessageComposerEvents.AcceptPermissionRationale)
|
||||||
|
|
@ -388,7 +388,7 @@ private fun MessagesViewContent(
|
||||||
appName = state.appName
|
appName = state.appName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (state.enableVoiceMessages && state.voiceMessageComposerState.showSendFailureDialog) {
|
if (state.voiceMessageComposerState.showSendFailureDialog) {
|
||||||
VoiceMessageSendingFailedDialog(
|
VoiceMessageSendingFailedDialog(
|
||||||
onDismiss = { state.voiceMessageComposerState.eventSink(VoiceMessageComposerEvents.DismissSendFailureDialog) },
|
onDismiss = { state.voiceMessageComposerState.eventSink(VoiceMessageComposerEvents.DismissSendFailureDialog) },
|
||||||
)
|
)
|
||||||
|
|
@ -464,7 +464,6 @@ private fun MessagesViewComposerBottomSheetContents(
|
||||||
MessageComposerView(
|
MessageComposerView(
|
||||||
state = state.composerState,
|
state = state.composerState,
|
||||||
voiceMessageState = state.voiceMessageComposerState,
|
voiceMessageState = state.voiceMessageComposerState,
|
||||||
enableVoiceMessages = state.enableVoiceMessages,
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,6 @@ private fun AttachmentsPreviewBottomActions(
|
||||||
onResetComposerMode = {},
|
onResetComposerMode = {},
|
||||||
onAddAttachment = {},
|
onAddAttachment = {},
|
||||||
onDismissTextFormatting = {},
|
onDismissTextFormatting = {},
|
||||||
enableVoiceMessages = false,
|
|
||||||
onVoiceRecorderEvent = {},
|
onVoiceRecorderEvent = {},
|
||||||
onVoicePlayerEvent = {},
|
onVoicePlayerEvent = {},
|
||||||
onSendVoiceMessage = {},
|
onSendVoiceMessage = {},
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import kotlinx.coroutines.launch
|
||||||
internal fun MessageComposerView(
|
internal fun MessageComposerView(
|
||||||
state: MessageComposerState,
|
state: MessageComposerState,
|
||||||
voiceMessageState: VoiceMessageComposerState,
|
voiceMessageState: VoiceMessageComposerState,
|
||||||
enableVoiceMessages: Boolean,
|
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val view = LocalView.current
|
val view = LocalView.current
|
||||||
|
|
@ -104,7 +103,6 @@ internal fun MessageComposerView(
|
||||||
onResetComposerMode = ::onCloseSpecialMode,
|
onResetComposerMode = ::onCloseSpecialMode,
|
||||||
onAddAttachment = ::onAddAttachment,
|
onAddAttachment = ::onAddAttachment,
|
||||||
onDismissTextFormatting = ::onDismissTextFormatting,
|
onDismissTextFormatting = ::onDismissTextFormatting,
|
||||||
enableVoiceMessages = enableVoiceMessages,
|
|
||||||
onVoiceRecorderEvent = onVoiceRecorderEvent,
|
onVoiceRecorderEvent = onVoiceRecorderEvent,
|
||||||
onVoicePlayerEvent = onVoicePlayerEvent,
|
onVoicePlayerEvent = onVoicePlayerEvent,
|
||||||
onSendVoiceMessage = onSendVoiceMessage,
|
onSendVoiceMessage = onSendVoiceMessage,
|
||||||
|
|
@ -128,13 +126,11 @@ internal fun MessageComposerViewPreview(
|
||||||
modifier = Modifier.height(IntrinsicSize.Min),
|
modifier = Modifier.height(IntrinsicSize.Min),
|
||||||
state = state,
|
state = state,
|
||||||
voiceMessageState = aVoiceMessageComposerState(),
|
voiceMessageState = aVoiceMessageComposerState(),
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
MessageComposerView(
|
MessageComposerView(
|
||||||
modifier = Modifier.height(200.dp),
|
modifier = Modifier.height(200.dp),
|
||||||
state = state,
|
state = state,
|
||||||
voiceMessageState = aVoiceMessageComposerState(),
|
voiceMessageState = aVoiceMessageComposerState(),
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
DisabledComposerView()
|
DisabledComposerView()
|
||||||
}
|
}
|
||||||
|
|
@ -150,7 +146,6 @@ internal fun MessageComposerViewVoicePreview(
|
||||||
modifier = Modifier.height(IntrinsicSize.Min),
|
modifier = Modifier.height(IntrinsicSize.Min),
|
||||||
state = aMessageComposerState(),
|
state = aMessageComposerState(),
|
||||||
voiceMessageState = state,
|
voiceMessageState = state,
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ import io.element.android.features.messages.impl.utils.TextPillificationHelper
|
||||||
import io.element.android.libraries.androidutils.filesize.FileSizeFormatter
|
import io.element.android.libraries.androidutils.filesize.FileSizeFormatter
|
||||||
import io.element.android.libraries.androidutils.text.safeLinkify
|
import io.element.android.libraries.androidutils.text.safeLinkify
|
||||||
import io.element.android.libraries.core.mimetype.MimeTypes
|
import io.element.android.libraries.core.mimetype.MimeTypes
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
|
||||||
import io.element.android.libraries.matrix.api.core.EventId
|
import io.element.android.libraries.matrix.api.core.EventId
|
||||||
import io.element.android.libraries.matrix.api.permalink.PermalinkParser
|
import io.element.android.libraries.matrix.api.permalink.PermalinkParser
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.event.AudioMessageType
|
import io.element.android.libraries.matrix.api.timeline.item.event.AudioMessageType
|
||||||
|
|
@ -56,7 +54,6 @@ import kotlin.time.Duration
|
||||||
class TimelineItemContentMessageFactory @Inject constructor(
|
class TimelineItemContentMessageFactory @Inject constructor(
|
||||||
private val fileSizeFormatter: FileSizeFormatter,
|
private val fileSizeFormatter: FileSizeFormatter,
|
||||||
private val fileExtensionExtractor: FileExtensionExtractor,
|
private val fileExtensionExtractor: FileExtensionExtractor,
|
||||||
private val featureFlagService: FeatureFlagService,
|
|
||||||
private val htmlConverterProvider: HtmlConverterProvider,
|
private val htmlConverterProvider: HtmlConverterProvider,
|
||||||
private val permalinkParser: PermalinkParser,
|
private val permalinkParser: PermalinkParser,
|
||||||
private val textPillificationHelper: TextPillificationHelper,
|
private val textPillificationHelper: TextPillificationHelper,
|
||||||
|
|
@ -177,38 +174,20 @@ class TimelineItemContentMessageFactory @Inject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is VoiceMessageType -> {
|
is VoiceMessageType -> {
|
||||||
when (featureFlagService.isFeatureEnabled(FeatureFlags.VoiceMessages)) {
|
TimelineItemVoiceContent(
|
||||||
true -> {
|
eventId = eventId,
|
||||||
TimelineItemVoiceContent(
|
filename = messageType.filename,
|
||||||
eventId = eventId,
|
fileSize = messageType.info?.size ?: 0,
|
||||||
filename = messageType.filename,
|
caption = messageType.caption?.trimEnd(),
|
||||||
fileSize = messageType.info?.size ?: 0,
|
formattedCaption = parseHtml(messageType.formattedCaption) ?: messageType.caption?.withLinks(),
|
||||||
caption = messageType.caption?.trimEnd(),
|
isEdited = content.isEdited,
|
||||||
formattedCaption = parseHtml(messageType.formattedCaption) ?: messageType.caption?.withLinks(),
|
mediaSource = messageType.source,
|
||||||
isEdited = content.isEdited,
|
duration = messageType.info?.duration ?: Duration.ZERO,
|
||||||
mediaSource = messageType.source,
|
mimeType = messageType.info?.mimetype ?: MimeTypes.OctetStream,
|
||||||
duration = messageType.info?.duration ?: Duration.ZERO,
|
waveform = messageType.details?.waveform?.toImmutableList() ?: persistentListOf(),
|
||||||
mimeType = messageType.info?.mimetype ?: MimeTypes.OctetStream,
|
formattedFileSize = fileSizeFormatter.format(messageType.info?.size ?: 0),
|
||||||
waveform = messageType.details?.waveform?.toImmutableList() ?: persistentListOf(),
|
fileExtension = fileExtensionExtractor.extractFromName(messageType.filename)
|
||||||
formattedFileSize = fileSizeFormatter.format(messageType.info?.size ?: 0),
|
)
|
||||||
fileExtension = fileExtensionExtractor.extractFromName(messageType.filename)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
false -> {
|
|
||||||
TimelineItemAudioContent(
|
|
||||||
filename = messageType.filename,
|
|
||||||
fileSize = messageType.info?.size ?: 0,
|
|
||||||
caption = messageType.caption?.trimEnd(),
|
|
||||||
formattedCaption = parseHtml(messageType.formattedCaption) ?: messageType.caption?.withLinks(),
|
|
||||||
isEdited = content.isEdited,
|
|
||||||
mediaSource = messageType.source,
|
|
||||||
duration = messageType.info?.duration ?: Duration.ZERO,
|
|
||||||
mimeType = messageType.info?.mimetype ?: MimeTypes.OctetStream,
|
|
||||||
formattedFileSize = fileSizeFormatter.format(messageType.info?.size ?: 0),
|
|
||||||
fileExtension = fileExtensionExtractor.extractFromName(messageType.filename),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
is FileMessageType -> {
|
is FileMessageType -> {
|
||||||
val fileExtension = fileExtensionExtractor.extractFromName(messageType.filename)
|
val fileExtension = fileExtensionExtractor.extractFromName(messageType.filename)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import io.element.android.features.poll.test.pollcontent.FakePollContentStateFac
|
||||||
import io.element.android.libraries.androidutils.filesize.FakeFileSizeFormatter
|
import io.element.android.libraries.androidutils.filesize.FakeFileSizeFormatter
|
||||||
import io.element.android.libraries.dateformatter.test.FakeDateFormatter
|
import io.element.android.libraries.dateformatter.test.FakeDateFormatter
|
||||||
import io.element.android.libraries.eventformatter.api.TimelineEventFormatter
|
import io.element.android.libraries.eventformatter.api.TimelineEventFormatter
|
||||||
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.event.EventTimelineItem
|
import io.element.android.libraries.matrix.api.timeline.item.event.EventTimelineItem
|
||||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||||
import io.element.android.libraries.matrix.test.permalink.FakePermalinkParser
|
import io.element.android.libraries.matrix.test.permalink.FakePermalinkParser
|
||||||
|
|
@ -60,7 +59,6 @@ internal fun TestScope.aTimelineItemsFactory(
|
||||||
messageFactory = TimelineItemContentMessageFactory(
|
messageFactory = TimelineItemContentMessageFactory(
|
||||||
fileSizeFormatter = FakeFileSizeFormatter(),
|
fileSizeFormatter = FakeFileSizeFormatter(),
|
||||||
fileExtensionExtractor = FileExtensionExtractorWithoutValidation(),
|
fileExtensionExtractor = FileExtensionExtractorWithoutValidation(),
|
||||||
featureFlagService = FakeFeatureFlagService(),
|
|
||||||
htmlConverterProvider = FakeHtmlConverterProvider(),
|
htmlConverterProvider = FakeHtmlConverterProvider(),
|
||||||
permalinkParser = FakePermalinkParser(),
|
permalinkParser = FakePermalinkParser(),
|
||||||
textPillificationHelper = FakeTextPillificationHelper(),
|
textPillificationHelper = FakeTextPillificationHelper(),
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ import io.element.android.features.messages.impl.utils.FakeTextPillificationHelp
|
||||||
import io.element.android.features.messages.test.timeline.FakeHtmlConverterProvider
|
import io.element.android.features.messages.test.timeline.FakeHtmlConverterProvider
|
||||||
import io.element.android.libraries.androidutils.filesize.FakeFileSizeFormatter
|
import io.element.android.libraries.androidutils.filesize.FakeFileSizeFormatter
|
||||||
import io.element.android.libraries.core.mimetype.MimeTypes
|
import io.element.android.libraries.core.mimetype.MimeTypes
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
|
||||||
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
|
||||||
import io.element.android.libraries.matrix.api.media.AudioDetails
|
import io.element.android.libraries.matrix.api.media.AudioDetails
|
||||||
import io.element.android.libraries.matrix.api.media.AudioInfo
|
import io.element.android.libraries.matrix.api.media.AudioInfo
|
||||||
import io.element.android.libraries.matrix.api.media.FileInfo
|
import io.element.android.libraries.matrix.api.media.FileInfo
|
||||||
|
|
@ -430,35 +427,6 @@ class TimelineItemContentMessageFactoryTest {
|
||||||
assertThat(result).isEqualTo(expected)
|
assertThat(result).isEqualTo(expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `test create VoiceMessageType feature disabled`() = runTest {
|
|
||||||
val sut = createTimelineItemContentMessageFactory(
|
|
||||||
featureFlagService = FakeFeatureFlagService(
|
|
||||||
initialState = mapOf(
|
|
||||||
FeatureFlags.VoiceMessages.key to false,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
val result = sut.create(
|
|
||||||
content = createMessageContent(type = VoiceMessageType("filename", null, null, MediaSource("url"), null, null)),
|
|
||||||
senderDisambiguatedDisplayName = "Bob",
|
|
||||||
eventId = AN_EVENT_ID,
|
|
||||||
)
|
|
||||||
val expected = TimelineItemAudioContent(
|
|
||||||
filename = "filename",
|
|
||||||
fileSize = 0L,
|
|
||||||
caption = null,
|
|
||||||
formattedCaption = null,
|
|
||||||
isEdited = false,
|
|
||||||
duration = Duration.ZERO,
|
|
||||||
mediaSource = MediaSource(url = "url", json = null),
|
|
||||||
mimeType = MimeTypes.OctetStream,
|
|
||||||
formattedFileSize = "0 Bytes",
|
|
||||||
fileExtension = ""
|
|
||||||
)
|
|
||||||
assertThat(result).isEqualTo(expected)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test create ImageMessageType`() = runTest {
|
fun `test create ImageMessageType`() = runTest {
|
||||||
val sut = createTimelineItemContentMessageFactory()
|
val sut = createTimelineItemContentMessageFactory()
|
||||||
|
|
@ -794,13 +762,11 @@ class TimelineItemContentMessageFactoryTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createTimelineItemContentMessageFactory(
|
private fun createTimelineItemContentMessageFactory(
|
||||||
featureFlagService: FeatureFlagService = FakeFeatureFlagService(),
|
|
||||||
htmlConverterTransform: (String) -> CharSequence = { it },
|
htmlConverterTransform: (String) -> CharSequence = { it },
|
||||||
permalinkParser: FakePermalinkParser = FakePermalinkParser(),
|
permalinkParser: FakePermalinkParser = FakePermalinkParser(),
|
||||||
) = TimelineItemContentMessageFactory(
|
) = TimelineItemContentMessageFactory(
|
||||||
fileSizeFormatter = FakeFileSizeFormatter(),
|
fileSizeFormatter = FakeFileSizeFormatter(),
|
||||||
fileExtensionExtractor = FileExtensionExtractorWithoutValidation(),
|
fileExtensionExtractor = FileExtensionExtractorWithoutValidation(),
|
||||||
featureFlagService = featureFlagService,
|
|
||||||
htmlConverterProvider = FakeHtmlConverterProvider(htmlConverterTransform),
|
htmlConverterProvider = FakeHtmlConverterProvider(htmlConverterTransform),
|
||||||
permalinkParser = permalinkParser,
|
permalinkParser = permalinkParser,
|
||||||
textPillificationHelper = FakeTextPillificationHelper(),
|
textPillificationHelper = FakeTextPillificationHelper(),
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,6 @@ enum class FeatureFlags(
|
||||||
override val defaultValue: (BuildMeta) -> Boolean,
|
override val defaultValue: (BuildMeta) -> Boolean,
|
||||||
override val isFinished: Boolean,
|
override val isFinished: Boolean,
|
||||||
) : Feature {
|
) : Feature {
|
||||||
VoiceMessages(
|
|
||||||
key = "feature.voicemessages",
|
|
||||||
title = "Voice messages",
|
|
||||||
description = "Send and receive voice messages",
|
|
||||||
defaultValue = { true },
|
|
||||||
isFinished = true,
|
|
||||||
),
|
|
||||||
MarkAsUnread(
|
MarkAsUnread(
|
||||||
key = "feature.markAsUnread",
|
key = "feature.markAsUnread",
|
||||||
title = "Mark as unread",
|
title = "Mark as unread",
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,6 @@ fun TextComposer(
|
||||||
state: TextEditorState,
|
state: TextEditorState,
|
||||||
voiceMessageState: VoiceMessageState,
|
voiceMessageState: VoiceMessageState,
|
||||||
composerMode: MessageComposerMode,
|
composerMode: MessageComposerMode,
|
||||||
enableVoiceMessages: Boolean,
|
|
||||||
onRequestFocus: () -> Unit,
|
onRequestFocus: () -> Unit,
|
||||||
onSendMessage: () -> Unit,
|
onSendMessage: () -> Unit,
|
||||||
onResetComposerMode: () -> Unit,
|
onResetComposerMode: () -> Unit,
|
||||||
|
|
@ -273,7 +272,7 @@ fun TextComposer(
|
||||||
}
|
}
|
||||||
|
|
||||||
val sendOrRecordButton = when {
|
val sendOrRecordButton = when {
|
||||||
enableVoiceMessages && !canSendMessage ->
|
!canSendMessage ->
|
||||||
when (voiceMessageState) {
|
when (voiceMessageState) {
|
||||||
VoiceMessageState.Idle,
|
VoiceMessageState.Idle,
|
||||||
is VoiceMessageState.Recording -> recordVoiceButton
|
is VoiceMessageState.Recording -> recordVoiceButton
|
||||||
|
|
@ -288,7 +287,6 @@ fun TextComposer(
|
||||||
val endButtonA11y = endButtonA11y(
|
val endButtonA11y = endButtonA11y(
|
||||||
composerMode = composerMode,
|
composerMode = composerMode,
|
||||||
voiceMessageState = voiceMessageState,
|
voiceMessageState = voiceMessageState,
|
||||||
enableVoiceMessages = enableVoiceMessages,
|
|
||||||
canSendMessage = canSendMessage,
|
canSendMessage = canSendMessage,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -341,7 +339,6 @@ fun TextComposer(
|
||||||
} else {
|
} else {
|
||||||
StandardLayout(
|
StandardLayout(
|
||||||
voiceMessageState = voiceMessageState,
|
voiceMessageState = voiceMessageState,
|
||||||
enableVoiceMessages = enableVoiceMessages,
|
|
||||||
isRoomEncrypted = state.isRoomEncrypted,
|
isRoomEncrypted = state.isRoomEncrypted,
|
||||||
modifier = layoutModifier,
|
modifier = layoutModifier,
|
||||||
composerOptionsButton = composerOptionsButton,
|
composerOptionsButton = composerOptionsButton,
|
||||||
|
|
@ -378,12 +375,11 @@ fun TextComposer(
|
||||||
private fun endButtonA11y(
|
private fun endButtonA11y(
|
||||||
composerMode: MessageComposerMode,
|
composerMode: MessageComposerMode,
|
||||||
voiceMessageState: VoiceMessageState,
|
voiceMessageState: VoiceMessageState,
|
||||||
enableVoiceMessages: Boolean,
|
|
||||||
canSendMessage: Boolean,
|
canSendMessage: Boolean,
|
||||||
): (SemanticsPropertyReceiver) -> Unit {
|
): (SemanticsPropertyReceiver) -> Unit {
|
||||||
val a11ySendButtonDescription = stringResource(
|
val a11ySendButtonDescription = stringResource(
|
||||||
id = when {
|
id = when {
|
||||||
enableVoiceMessages && !canSendMessage ->
|
!canSendMessage ->
|
||||||
when (voiceMessageState) {
|
when (voiceMessageState) {
|
||||||
VoiceMessageState.Idle,
|
VoiceMessageState.Idle,
|
||||||
is VoiceMessageState.Recording -> if (voiceMessageState is VoiceMessageState.Recording) {
|
is VoiceMessageState.Recording -> if (voiceMessageState is VoiceMessageState.Recording) {
|
||||||
|
|
@ -410,7 +406,6 @@ private fun endButtonA11y(
|
||||||
@Composable
|
@Composable
|
||||||
private fun StandardLayout(
|
private fun StandardLayout(
|
||||||
voiceMessageState: VoiceMessageState,
|
voiceMessageState: VoiceMessageState,
|
||||||
enableVoiceMessages: Boolean,
|
|
||||||
isRoomEncrypted: Boolean?,
|
isRoomEncrypted: Boolean?,
|
||||||
textInput: @Composable () -> Unit,
|
textInput: @Composable () -> Unit,
|
||||||
composerOptionsButton: @Composable () -> Unit,
|
composerOptionsButton: @Composable () -> Unit,
|
||||||
|
|
@ -427,7 +422,7 @@ private fun StandardLayout(
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
}
|
}
|
||||||
Row(verticalAlignment = Alignment.Bottom) {
|
Row(verticalAlignment = Alignment.Bottom) {
|
||||||
if (enableVoiceMessages && voiceMessageState !is VoiceMessageState.Idle) {
|
if (voiceMessageState !is VoiceMessageState.Idle) {
|
||||||
if (voiceMessageState is VoiceMessageState.Preview || voiceMessageState is VoiceMessageState.Recording) {
|
if (voiceMessageState is VoiceMessageState.Preview || voiceMessageState is VoiceMessageState.Recording) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
@ -636,7 +631,6 @@ internal fun TextComposerSimplePreview() = ElementPreview {
|
||||||
state = textEditorState,
|
state = textEditorState,
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
composerMode = MessageComposerMode.Normal,
|
composerMode = MessageComposerMode.Normal,
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -651,7 +645,6 @@ internal fun TextComposerSimpleNotEncryptedPreview() = ElementPreview {
|
||||||
state = textEditorState,
|
state = textEditorState,
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
composerMode = MessageComposerMode.Normal,
|
composerMode = MessageComposerMode.Normal,
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -667,7 +660,6 @@ internal fun TextComposerFormattingPreview() = ElementPreview {
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
showTextFormatting = true,
|
showTextFormatting = true,
|
||||||
composerMode = MessageComposerMode.Normal,
|
composerMode = MessageComposerMode.Normal,
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -683,7 +675,6 @@ internal fun TextComposerFormattingNotEncryptedPreview() = ElementPreview {
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
showTextFormatting = true,
|
showTextFormatting = true,
|
||||||
composerMode = MessageComposerMode.Normal,
|
composerMode = MessageComposerMode.Normal,
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -698,7 +689,6 @@ internal fun TextComposerEditPreview() = ElementPreview {
|
||||||
state = textEditorState,
|
state = textEditorState,
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
composerMode = aMessageComposerModeEdit(),
|
composerMode = aMessageComposerModeEdit(),
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -713,7 +703,6 @@ internal fun TextComposerEditNotEncryptedPreview() = ElementPreview {
|
||||||
state = textEditorState,
|
state = textEditorState,
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
composerMode = aMessageComposerModeEdit(),
|
composerMode = aMessageComposerModeEdit(),
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -731,7 +720,6 @@ internal fun TextComposerEditCaptionPreview() = ElementPreview {
|
||||||
// Set an existing caption so that the UI will be in edit caption mode
|
// Set an existing caption so that the UI will be in edit caption mode
|
||||||
content = "An existing caption",
|
content = "An existing caption",
|
||||||
),
|
),
|
||||||
enableVoiceMessages = false,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -750,7 +738,6 @@ internal fun TextComposerAddCaptionPreview() = ElementPreview {
|
||||||
content = "",
|
content = "",
|
||||||
showCompatibilityWarning = index == 0,
|
showCompatibilityWarning = index == 0,
|
||||||
),
|
),
|
||||||
enableVoiceMessages = false,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -765,7 +752,6 @@ internal fun MarkdownTextComposerEditPreview() = ElementPreview {
|
||||||
state = textEditorState,
|
state = textEditorState,
|
||||||
voiceMessageState = VoiceMessageState.Idle,
|
voiceMessageState = VoiceMessageState.Idle,
|
||||||
composerMode = aMessageComposerModeEdit(),
|
composerMode = aMessageComposerModeEdit(),
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -782,7 +768,6 @@ internal fun TextComposerReplyPreview(@PreviewParameter(InReplyToDetailsProvider
|
||||||
composerMode = aMessageComposerModeReply(
|
composerMode = aMessageComposerModeReply(
|
||||||
replyToDetails = inReplyToDetails,
|
replyToDetails = inReplyToDetails,
|
||||||
),
|
),
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -807,7 +792,6 @@ internal fun TextComposerReplyNotEncryptedPreview(@PreviewParameter(InReplyToDet
|
||||||
composerMode = aMessageComposerModeReply(
|
composerMode = aMessageComposerModeReply(
|
||||||
replyToDetails = inReplyToDetails,
|
replyToDetails = inReplyToDetails,
|
||||||
),
|
),
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -826,7 +810,6 @@ internal fun TextComposerCaptionPreview() = ElementPreview {
|
||||||
allowCaption = index < list.size,
|
allowCaption = index < list.size,
|
||||||
showCaptionCompatibilityWarning = index == 0,
|
showCaptionCompatibilityWarning = index == 0,
|
||||||
),
|
),
|
||||||
enableVoiceMessages = false,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -867,7 +850,6 @@ internal fun TextComposerVoicePreview() = ElementPreview {
|
||||||
state = aTextEditorStateRich(initialFocus = true),
|
state = aTextEditorStateRich(initialFocus = true),
|
||||||
voiceMessageState = voiceMessageState,
|
voiceMessageState = voiceMessageState,
|
||||||
composerMode = MessageComposerMode.Normal,
|
composerMode = MessageComposerMode.Normal,
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -908,7 +890,6 @@ internal fun TextComposerVoiceNotEncryptedPreview() = ElementPreview {
|
||||||
state = aTextEditorStateRich(initialFocus = true, isRoomEncrypted = false),
|
state = aTextEditorStateRich(initialFocus = true, isRoomEncrypted = false),
|
||||||
voiceMessageState = voiceMessageState,
|
voiceMessageState = voiceMessageState,
|
||||||
composerMode = MessageComposerMode.Normal,
|
composerMode = MessageComposerMode.Normal,
|
||||||
enableVoiceMessages = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -935,7 +916,6 @@ private fun ATextComposer(
|
||||||
state: TextEditorState,
|
state: TextEditorState,
|
||||||
voiceMessageState: VoiceMessageState,
|
voiceMessageState: VoiceMessageState,
|
||||||
composerMode: MessageComposerMode,
|
composerMode: MessageComposerMode,
|
||||||
enableVoiceMessages: Boolean,
|
|
||||||
showTextFormatting: Boolean = false,
|
showTextFormatting: Boolean = false,
|
||||||
) {
|
) {
|
||||||
TextComposer(
|
TextComposer(
|
||||||
|
|
@ -943,7 +923,6 @@ private fun ATextComposer(
|
||||||
showTextFormatting = showTextFormatting,
|
showTextFormatting = showTextFormatting,
|
||||||
voiceMessageState = voiceMessageState,
|
voiceMessageState = voiceMessageState,
|
||||||
composerMode = composerMode,
|
composerMode = composerMode,
|
||||||
enableVoiceMessages = enableVoiceMessages,
|
|
||||||
onRequestFocus = {},
|
onRequestFocus = {},
|
||||||
onSendMessage = {},
|
onSendMessage = {},
|
||||||
onResetComposerMode = {},
|
onResetComposerMode = {},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue