Fix PR comments

This commit is contained in:
yostyle 2023-08-17 13:50:49 +02:00
parent 122d5e4239
commit a78f3430e2
3 changed files with 24 additions and 20 deletions

View file

@ -150,7 +150,7 @@ fun RoomDetailsView(
if (state.canShowNotificationSettings && state.roomNotificationSettings != null) {
NotificationSection(
state = state,
isDefaultMode = state.roomNotificationSettings.isDefault,
openRoomNotificationSettings = openRoomNotificationSettings)
}
@ -304,21 +304,23 @@ internal fun TopicSection(
}
@Composable
internal fun NotificationSection(state: RoomDetailsState, openRoomNotificationSettings: () -> Unit, modifier: Modifier = Modifier) {
state.roomNotificationSettings?.let {
val subtitle = if (it.isDefault) {
stringResource(R.string.screen_room_details_notification_mode_default)
} else {
stringResource(R.string.screen_room_details_notification_mode_custom)
}
PreferenceCategory(modifier = modifier) {
PreferenceText(
title = stringResource(R.string.screen_room_details_notification_title),
subtitle = subtitle,
icon = Icons.Outlined.Notifications,
onClick = openRoomNotificationSettings,
)
}
internal fun NotificationSection(
isDefaultMode: Boolean,
openRoomNotificationSettings: () -> Unit,
modifier: Modifier = Modifier
) {
val subtitle = if (isDefaultMode) {
stringResource(R.string.screen_room_details_notification_mode_default)
} else {
stringResource(R.string.screen_room_details_notification_mode_custom)
}
PreferenceCategory(modifier = modifier) {
PreferenceText(
title = stringResource(R.string.screen_room_details_notification_title),
subtitle = subtitle,
icon = Icons.Outlined.Notifications,
onClick = openRoomNotificationSettings,
)
}
}