Skip to content

Commit 6a0c067

Browse files
committed
refactor: 뷰가 뷰모델 액션을 덜 알도록 개선
1 parent 2106322 commit 6a0c067

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

DevLog/Presentation/ViewModel/PushNotificationSettingsViewModel.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ final class PushNotificationSettingsViewModel: Store {
3535
case setPushNotificationTime(view: Date? = nil, sheet: Date? = nil)
3636
case setShowTimePicker(Bool)
3737
case setSheetHeight(CGFloat)
38+
case selectPresetTime(Date)
3839
case confirmUpdate
3940
case rollbackUpdate
4041
}
@@ -84,6 +85,10 @@ final class PushNotificationSettingsViewModel: Store {
8485
}
8586
case .setSheetHeight(let value):
8687
state.sheetHeight = value
88+
case .selectPresetTime(let date):
89+
state.viewPushNotificationTime = date
90+
state.sheetPushNotificationTime = date
91+
effects = [.updatePushNotificationSettings]
8792
case .confirmUpdate:
8893
state.showTimePicker = false
8994
state.viewPushNotificationTime = state.sheetPushNotificationTime

DevLog/UI/Setting/PushNotificationSettingsView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ struct PushNotificationSettingsView: View {
3737
}
3838
.contentShape(Rectangle())
3939
.onTapGesture {
40-
viewModel.send(.setPushNotificationTime(sheet: date))
41-
viewModel.send(.confirmUpdate)
40+
viewModel.send(.selectPresetTime(date))
4241
}
4342
}
4443
}

0 commit comments

Comments
 (0)