diff --git a/DevLog/Presentation/ViewModel/PushNotificationSettingsViewModel.swift b/DevLog/Presentation/ViewModel/PushNotificationSettingsViewModel.swift index 3f3886d..0bd73c4 100644 --- a/DevLog/Presentation/ViewModel/PushNotificationSettingsViewModel.swift +++ b/DevLog/Presentation/ViewModel/PushNotificationSettingsViewModel.swift @@ -16,6 +16,9 @@ final class PushNotificationSettingsViewModel: Store { var pushNotificationHour: Int { Calendar.current.component(.hour, from: pushNotificationTime) } + var pushNotificationMinute: Int { + Calendar.current.component(.minute, from: pushNotificationTime) + } } enum Action { diff --git a/DevLog/Resource/Localizable.xcstrings b/DevLog/Resource/Localizable.xcstrings index 7c9e582..bdf905b 100644 --- a/DevLog/Resource/Localizable.xcstrings +++ b/DevLog/Resource/Localizable.xcstrings @@ -307,12 +307,6 @@ }, "어제" : { - }, - "오전 %lld시" : { - - }, - "오후 %lld시" : { - }, "완료" : { diff --git a/DevLog/UI/Setting/PushNotificationSettingsView.swift b/DevLog/UI/Setting/PushNotificationSettingsView.swift index 304da61..3cc05b9 100644 --- a/DevLog/UI/Setting/PushNotificationSettingsView.swift +++ b/DevLog/UI/Setting/PushNotificationSettingsView.swift @@ -25,17 +25,20 @@ struct PushNotificationSettingsView: View { }) Section { ForEach([9, 15, 18, 21], id: \.self) { hour in - HStack { - Text((hour < 12 ? "오전 \(hour)시" : "오후 \(hour - 12)시")) - Spacer() - if viewModel.state.pushNotificationHour == hour { - Image(systemName: "checkmark") - .foregroundStyle(Color.accentColor) + if let date = Calendar.current.date(bySettingHour: hour, minute: 0, second: 0, of: Date()) { + HStack { + Text(formattedTimeString(date)) + Spacer() + if viewModel.state.pushNotificationHour == hour && + viewModel.state.pushNotificationMinute == 0 { + Image(systemName: "checkmark") + .foregroundStyle(Color.accentColor) + } + } + .contentShape(Rectangle()) + .onTapGesture { + viewModel.send(.setPushNotificationHour(hour)) } - } - .contentShape(Rectangle()) - .onTapGesture { - viewModel.send(.setPushNotificationHour(hour)) } } HStack { @@ -43,7 +46,7 @@ struct PushNotificationSettingsView: View { Spacer() Text(formattedTimeString(viewModel.state.pushNotificationTime)) .foregroundStyle(.secondary) - if ![9, 15, 18, 21].contains(viewModel.state.pushNotificationHour) { + if viewModel.state.pushNotificationMinute != 0 { Image(systemName: "checkmark") .foregroundStyle(Color.accentColor) }