diff --git a/feature/setting/src/main/java/com/boostcamp/dreamteam/dreamdiary/setting/SettingNotificationScreen.kt b/feature/setting/src/main/java/com/boostcamp/dreamteam/dreamdiary/setting/SettingNotificationScreen.kt index 7b723788..d09120e5 100644 --- a/feature/setting/src/main/java/com/boostcamp/dreamteam/dreamdiary/setting/SettingNotificationScreen.kt +++ b/feature/setting/src/main/java/com/boostcamp/dreamteam/dreamdiary/setting/SettingNotificationScreen.kt @@ -73,19 +73,19 @@ internal fun SettingNotificationScreen( onClick = { viewModel.goToLaunchNotificationSetting(activity) }, ) SettingCategory(text = stringResource(R.string.setting_notification_wakeup)) - if (!onTracking) { - SettingOption( - icon = Icons.Default.Bedtime, - text = stringResource(R.string.setting_notification_diary_on), - onClick = { viewModel.startTracking(context) }, - ) - } else { - SettingOption( - icon = Icons.Default.BedtimeOff, - text = stringResource(R.string.setting_notification_diary_off), - onClick = { viewModel.stopTracking(context) }, - ) - } + SettingOption( + icon = if (onTracking) Icons.Default.BedtimeOff else Icons.Default.Bedtime, + text = if (onTracking) { + stringResource( + R.string.setting_notification_diary_off, + ) + } else { + stringResource(R.string.setting_notification_diary_on) + }, + onClick = { if (onTracking) viewModel.stopTracking(context) else viewModel.startTracking(context) }, + switchOption = true, + checked = onTracking, + ) SettingCategory(text = stringResource(R.string.setting_comment_alarm)) SettingOption( icon = Icons.AutoMirrored.Outlined.Comment, diff --git a/feature/setting/src/main/java/com/boostcamp/dreamteam/dreamdiary/setting/component/SettingOption.kt b/feature/setting/src/main/java/com/boostcamp/dreamteam/dreamdiary/setting/component/SettingOption.kt index feb7237c..85e93725 100644 --- a/feature/setting/src/main/java/com/boostcamp/dreamteam/dreamdiary/setting/component/SettingOption.kt +++ b/feature/setting/src/main/java/com/boostcamp/dreamteam/dreamdiary/setting/component/SettingOption.kt @@ -26,6 +26,7 @@ internal fun SettingOption( text: String, helpText: String? = null, switchOption: Boolean = false, + checked: Boolean = false, onClick: () -> Unit = {}, modifier: Modifier = Modifier, ) { @@ -59,8 +60,8 @@ internal fun SettingOption( } if (switchOption) { Switch( - checked = false, - onCheckedChange = { /* TODO */ }, + checked = checked, + onCheckedChange = { onClick() }, ) } }