Merge pull request #2922 from element-hq/feature/bma/iterateOnPreferenceDesign2
Iterate on preference design
This commit is contained in:
commit
d0b2233a7b
129 changed files with 484 additions and 497 deletions
|
|
@ -48,7 +48,10 @@ fun DeveloperSettingsView(
|
|||
title = stringResource(id = CommonStrings.common_developer_options)
|
||||
) {
|
||||
// Note: this is OK to hardcode strings in this debug screen.
|
||||
PreferenceCategory(title = "Feature flags") {
|
||||
PreferenceCategory(
|
||||
title = "Feature flags",
|
||||
showTopDivider = false,
|
||||
) {
|
||||
FeatureListContent(state)
|
||||
}
|
||||
ElementCallCategory(state = state)
|
||||
|
|
@ -67,14 +70,14 @@ fun DeveloperSettingsView(
|
|||
RageshakePreferencesView(
|
||||
state = state.rageshakeState,
|
||||
)
|
||||
PreferenceCategory(title = "Crash", showDivider = false) {
|
||||
PreferenceCategory(title = "Crash", showTopDivider = false) {
|
||||
PreferenceText(
|
||||
title = "Crash the app 💥",
|
||||
onClick = { error("This crash is a test.") }
|
||||
)
|
||||
}
|
||||
val cache = state.cacheSize
|
||||
PreferenceCategory(title = "Cache", showDivider = false) {
|
||||
PreferenceCategory(title = "Cache", showTopDivider = false) {
|
||||
PreferenceText(
|
||||
title = "Clear cache",
|
||||
currentValue = cache.dataOrNull(),
|
||||
|
|
@ -93,11 +96,12 @@ fun DeveloperSettingsView(
|
|||
private fun ElementCallCategory(
|
||||
state: DeveloperSettingsState,
|
||||
) {
|
||||
PreferenceCategory(title = "Element Call", showDivider = true) {
|
||||
PreferenceCategory(title = "Element Call", showTopDivider = true) {
|
||||
val callUrlState = state.customElementCallBaseUrlState
|
||||
fun isUsingDefaultUrl(value: String?): Boolean {
|
||||
return value.isNullOrEmpty() || value == callUrlState.defaultUrl
|
||||
}
|
||||
|
||||
val supportingText = if (isUsingDefaultUrl(callUrlState.baseUrl)) {
|
||||
stringResource(R.string.screen_advanced_settings_element_call_base_url_description)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package io.element.android.features.preferences.impl.notifications
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
|
|
@ -121,7 +120,6 @@ private fun NotificationSettingsContentView(
|
|||
PreferenceSwitch(
|
||||
title = stringResource(id = R.string.screen_notification_settings_enable_notifications),
|
||||
isChecked = systemSettings.appNotificationsEnabled,
|
||||
switchAlignment = Alignment.Top,
|
||||
onCheckedChange = onNotificationsEnabledChanged
|
||||
)
|
||||
|
||||
|
|
@ -145,7 +143,6 @@ private fun NotificationSettingsContentView(
|
|||
modifier = Modifier,
|
||||
title = stringResource(id = R.string.screen_notification_settings_room_mention_label),
|
||||
isChecked = matrixSettings.atRoomNotificationsEnabled,
|
||||
switchAlignment = Alignment.Top,
|
||||
onCheckedChange = onMentionNotificationsChanged
|
||||
)
|
||||
}
|
||||
|
|
@ -162,7 +159,6 @@ private fun NotificationSettingsContentView(
|
|||
modifier = Modifier,
|
||||
title = stringResource(id = R.string.screen_notification_settings_invite_for_me_label),
|
||||
isChecked = matrixSettings.inviteForMeNotificationsEnabled,
|
||||
switchAlignment = Alignment.Top,
|
||||
onCheckedChange = onInviteForMeNotificationsChanged
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,10 @@ fun EditDefaultNotificationSettingView(
|
|||
} else {
|
||||
R.string.screen_notification_settings_edit_screen_group_section_header
|
||||
}
|
||||
PreferenceCategory(title = stringResource(id = categoryTitle)) {
|
||||
PreferenceCategory(
|
||||
title = stringResource(id = categoryTitle),
|
||||
showTopDivider = false,
|
||||
) {
|
||||
if (state.mode != null) {
|
||||
Column(modifier = Modifier.selectableGroup()) {
|
||||
validModes.forEach { item ->
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class DeveloperSettingsViewTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Config(qualifiers = "h1024dp")
|
||||
@Test
|
||||
fun `clicking on configure tracing invokes the expected callback`() {
|
||||
val eventsRecorder = EventsRecorder<DeveloperSettingsEvents>(expectEvents = false)
|
||||
|
|
@ -96,7 +97,7 @@ class DeveloperSettingsViewTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Config(qualifiers = "h1024dp")
|
||||
@Config(qualifiers = "h1500dp")
|
||||
@Test
|
||||
fun `clicking on clear cache emits the expected event`() {
|
||||
val eventsRecorder = EventsRecorder<DeveloperSettingsEvents>()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue