Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
tevincent authored and KevinBoulongne committed Sep 3, 2024
1 parent becc9af commit 434d8c6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fun SettingsScreen(
description = appSettings.theme.getString(),
endIcon = CHEVRON,
onClick = { onItemClick(THEME) },
)
SettingItem(
titleRes = R.string.settingsOptionNotifications,
isSelected = { selectedSetting == NOTIFICATIONS },
Expand All @@ -93,7 +94,7 @@ fun SettingsScreen(
SettingItem(
titleRes = R.string.settingsOptionValidityPeriod,
isSelected = { selectedSetting == VALIDITY_PERIOD },
icon = AppIcons.FileBadgeArrowDown,
icon = AppIcons.ArrowDownFile,
description = appSettings.validityPeriod.getString(),
endIcon = CHEVRON,
onClick = { onItemClick(VALIDITY_PERIOD) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,19 @@ fun SettingsScreenWrapper(
val appSettings by settingsViewModel.appSettingsFlow.collectAsStateWithLifecycle(null)
appSettings?.let { safeAppSettings ->
TwoPaneScaffold<SettingsOptionScreens>(
windowAdaptiveInfo = windowAdaptiveInfo,
windowAdaptiveInfo,
listPane = { ListPane(this, safeAppSettings) },
detailPane = { DetailPane(safeAppSettings, settingsViewModel, navigator = this) },
)
}
}

@OptIn(ExperimentalMaterial3AdaptiveApi::class)
@Composable
private fun DetailPane(
settingsViewModel: SettingsViewModel,
navigator: ThreePaneScaffoldNavigator<SettingsOptionScreens>,
appSettings: AppSettings
) {
var lastSelectedScreen by rememberSaveable { mutableStateOf<SettingsOptionScreens?>(null) }
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
@Composable
private fun ListPane(navigator: ThreePaneScaffoldNavigator<SettingsOptionScreens>, appSettings: AppSettings) {
val context = LocalContext.current
val aboutURL = stringResource(R.string.urlAbout)
val userReportURL = stringResource(R.string.urlUserReportAndroid)

SettingsScreen(
appSettings,
Expand Down Expand Up @@ -107,41 +106,48 @@ private fun DetailPane(
SettingsThemeScreen(appSettings.theme, navigateBack) {
settingsViewModel.setTheme(it)
}
DOWNLOAD_LIMIT -> {
val downloadLimit = appSettings.downloadLimit
SettingsDownloadsLimitScreen(downloadLimit, navigateBack) {
settingsViewModel.setDownloadLimit(it)
}
}
VALIDITY_PERIOD -> {
val validityPeriod = appSettings.validityPeriod
SettingsValidityPeriodScreen(validityPeriod, navigateBack) {
settingsViewModel.setValidityPeriod(it)
}
EMAIL_LANGUAGE -> {
val emailLanguage = appSettings.emailLanguage
SettingsEmailLanguageScreen(emailLanguage, navigateBack) {
settingsViewModel.setEmailLanguage(it)
}
}
DOWNLOAD_LIMIT -> {
val downloadLimit = appSettings.downloadLimit
SettingsDownloadsLimitScreen(downloadLimit, navigateBack) {
settingsViewModel.setDownloadLimit(it)
}
}
EMAIL_LANGUAGE -> {
val emailLanguage = appSettings.emailLanguage
SettingsEmailLanguageScreen(emailLanguage, navigateBack) {
settingsViewModel.setEmailLanguage(it)
}
NOTIFICATIONS,
DISCOVER_INFOMANIAK,
SHARE_IDEAS,
GIVE_FEEDBACK -> Unit
null -> NoSelectionEmptyState()
}
NOTIFICATIONS,
DISCOVER_INFOMANIAK,
SHARE_IDEAS,
GIVE_FEEDBACK -> Unit
null -> NoSelectionEmptyState()
}
}

// Show the detail pane content if selected item is available
@Composable
private fun NoSelectionEmptyState() {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text("Select a setting item", color = SwissTransferTheme.colors.secondaryTextColor)
}
// Show the detail pane content if selected item is available
@Composable
private fun NoSelectionEmptyState() {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text("Select a setting item", color = SwissTransferTheme.colors.secondaryTextColor)
}
}

@PreviewMobile
@PreviewTablet
@Composable
private fun SettingsScreenWrapperPreview() {
SwissTransferTheme {
Surface(color = MaterialTheme.colorScheme.background) {
SettingsScreenWrapper()
}
@PreviewMobile
@PreviewTablet
@Composable
private fun SettingsScreenWrapperPreview() {
SwissTransferTheme {
Surface(color = MaterialTheme.colorScheme.background) {
SettingsScreenWrapper()
}
}
}

0 comments on commit 434d8c6

Please sign in to comment.