Mark as unread: add a feature flag, disabled on release build.
This commit is contained in:
@@ -88,36 +88,38 @@ private fun RoomListModalBottomSheetContent(
|
||||
)
|
||||
}
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text(
|
||||
text = stringResource(
|
||||
id = if (contextMenu.hasNewContent) {
|
||||
R.string.screen_roomlist_mark_as_read
|
||||
} else {
|
||||
R.string.screen_roomlist_mark_as_unread
|
||||
}
|
||||
),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
)
|
||||
},
|
||||
modifier = Modifier.clickable {
|
||||
if (contextMenu.hasNewContent) {
|
||||
onRoomMarkReadClicked()
|
||||
} else {
|
||||
onRoomMarkUnreadClicked()
|
||||
}
|
||||
},
|
||||
/* TODO Design
|
||||
leadingContent = ListItemContent.Icon(
|
||||
iconSource = IconSource.Vector(
|
||||
CompoundIcons.Settings,
|
||||
contentDescription = stringResource(id = CommonStrings.common_settings)
|
||||
)
|
||||
),
|
||||
*/
|
||||
style = ListItemStyle.Primary,
|
||||
)
|
||||
if (contextMenu.markAsUnreadFeatureFlagEnabled) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text(
|
||||
text = stringResource(
|
||||
id = if (contextMenu.hasNewContent) {
|
||||
R.string.screen_roomlist_mark_as_read
|
||||
} else {
|
||||
R.string.screen_roomlist_mark_as_unread
|
||||
}
|
||||
),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
)
|
||||
},
|
||||
modifier = Modifier.clickable {
|
||||
if (contextMenu.hasNewContent) {
|
||||
onRoomMarkReadClicked()
|
||||
} else {
|
||||
onRoomMarkUnreadClicked()
|
||||
}
|
||||
},
|
||||
/* TODO Design
|
||||
leadingContent = ListItemContent.Icon(
|
||||
iconSource = IconSource.Vector(
|
||||
CompoundIcons.Settings,
|
||||
contentDescription = stringResource(id = CommonStrings.common_settings)
|
||||
)
|
||||
),
|
||||
*/
|
||||
style = ListItemStyle.Primary,
|
||||
)
|
||||
}
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text(
|
||||
|
||||
@@ -111,6 +111,9 @@ class RoomListPresenter @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
val markAsUnreadFeatureFlagEnabled by featureFlagService.isFeatureEnabledFlow(FeatureFlags.MarkAsUnread)
|
||||
.collectAsState(initial = null)
|
||||
|
||||
// Avatar indicator
|
||||
val showAvatarIndicator by indicatorService.showRoomListTopBarIndicator()
|
||||
|
||||
@@ -135,6 +138,7 @@ class RoomListPresenter @Inject constructor(
|
||||
roomId = event.roomListRoomSummary.roomId,
|
||||
roomName = event.roomListRoomSummary.name,
|
||||
isDm = event.roomListRoomSummary.isDm,
|
||||
markAsUnreadFeatureFlagEnabled = markAsUnreadFeatureFlagEnabled == true,
|
||||
hasNewContent = event.roomListRoomSummary.hasNewContent
|
||||
)
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ data class RoomListState(
|
||||
val roomId: RoomId,
|
||||
val roomName: String,
|
||||
val isDm: Boolean,
|
||||
val markAsUnreadFeatureFlagEnabled: Boolean,
|
||||
val hasNewContent: Boolean,
|
||||
) : ContextMenu
|
||||
}
|
||||
|
||||
@@ -106,5 +106,6 @@ internal fun aContextMenuShown(
|
||||
roomId = RoomId("!aRoom:aDomain"),
|
||||
roomName = roomName,
|
||||
isDm = isDm,
|
||||
markAsUnreadFeatureFlagEnabled = true,
|
||||
hasNewContent = hasNewContent,
|
||||
)
|
||||
|
||||
@@ -356,6 +356,7 @@ class RoomListPresenterTests {
|
||||
roomId = summary.roomId,
|
||||
roomName = summary.name,
|
||||
isDm = false,
|
||||
markAsUnreadFeatureFlagEnabled = true,
|
||||
hasNewContent = false,
|
||||
)
|
||||
)
|
||||
@@ -382,6 +383,7 @@ class RoomListPresenterTests {
|
||||
roomId = summary.roomId,
|
||||
roomName = summary.name,
|
||||
isDm = false,
|
||||
markAsUnreadFeatureFlagEnabled = true,
|
||||
hasNewContent = false,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -75,4 +75,11 @@ enum class FeatureFlags(
|
||||
defaultValue = true,
|
||||
isFinished = false,
|
||||
),
|
||||
MarkAsUnread(
|
||||
key = "feature.markAsUnread",
|
||||
title = "Mark as unread",
|
||||
description = "Allow user to mark a room as unread",
|
||||
defaultValue = true,
|
||||
isFinished = false,
|
||||
),
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ class StaticFeatureFlagProvider @Inject constructor() :
|
||||
FeatureFlags.PinUnlock -> true
|
||||
FeatureFlags.Mentions -> true
|
||||
FeatureFlags.SecureStorage -> true
|
||||
FeatureFlags.MarkAsUnread -> false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user