-
Notifications
You must be signed in to change notification settings - Fork 0
[#134] 사용자 설정으로 시간을 바꿀 때 확인 버튼을 탭하면 서버에 변동사항이 저장되도록 개선한다 #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
opficdev
merged 7 commits into
develop
from
feat/#134-PushNotificationSettings-AlertTime
Feb 26, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
291cc1d
ui: 시트 상단에 툴바로 취소, 확인 버튼 추가
opficdev 23090a2
feat: 시트 내 변동 값으로 서버에 업데이트 하고, 시트가 닫힐 때 적절한 값으로 부모 뷰 값 업데이트
opficdev ecc66fb
fix: 시트 외부를 탭 해서 내려갔을 때 원복되지 않는 현상 해결
opficdev 6947bc6
fix: 서버에 업데이트하지 않는 현상 해결
opficdev 4c0e7d7
feat: 업데이트가 실패했을 경우 서버값으로 오버라이드
opficdev 2106322
refactor: 불필요 액션 제거
opficdev 6a0c067
refactor: 뷰가 뷰모델 액션을 덜 알도록 개선
opficdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -37,14 +37,14 @@ struct PushNotificationSettingsView: View { | |||||
| } | ||||||
| .contentShape(Rectangle()) | ||||||
| .onTapGesture { | ||||||
| viewModel.send(.setPushNotificationHour(hour)) | ||||||
| viewModel.send(.selectPresetTime(date)) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| HStack { | ||||||
| Text("사용자 설정") | ||||||
| Spacer() | ||||||
| Text(formattedTimeString(viewModel.state.pushNotificationTime)) | ||||||
| Text(formattedTimeString(viewModel.state.viewPushNotificationTime)) | ||||||
| .foregroundStyle(.secondary) | ||||||
| if viewModel.state.pushNotificationMinute != 0 { | ||||||
| Image(systemName: "checkmark") | ||||||
|
|
@@ -67,37 +67,70 @@ struct PushNotificationSettingsView: View { | |||||
| } | ||||||
| } | ||||||
| .onAppear { | ||||||
| viewModel.send(.onAppear) | ||||||
| viewModel.send(.fetchSettings) | ||||||
| } | ||||||
| .sheet(isPresented: Binding( | ||||||
| get: { viewModel.state.showTimePicker }, | ||||||
| set: { _ in viewModel.send(.setShowTimePicker(false)) } | ||||||
| set: { viewModel.send(.setShowTimePicker($0)) } | ||||||
| )) { | ||||||
| DatePicker( | ||||||
| "", | ||||||
| selection: Binding( | ||||||
| get: { viewModel.state.pushNotificationTime }, | ||||||
| set: { viewModel.send(.setPushNotificationTime($0)) } | ||||||
| ), | ||||||
| displayedComponents: .hourAndMinute | ||||||
| ) | ||||||
| .datePickerStyle(.wheel) | ||||||
| .labelsHidden() | ||||||
| .presentationDragIndicator(.hidden) | ||||||
| .presentationDetents([.height(viewModel.state.sheetHeight)]) | ||||||
| .onAppear { | ||||||
| UIDatePicker.appearance().minuteInterval = 5 | ||||||
| NavigationStack { | ||||||
| DatePicker( | ||||||
| "", | ||||||
| selection: Binding( | ||||||
| get: { viewModel.state.sheetPushNotificationTime }, | ||||||
| set: { viewModel.send(.setPushNotificationTime(sheet: $0)) } | ||||||
| ), | ||||||
| displayedComponents: .hourAndMinute | ||||||
| ) | ||||||
| .datePickerStyle(.wheel) | ||||||
| .labelsHidden() | ||||||
| .presentationDragIndicator(.hidden) | ||||||
| .presentationDetents([.height(viewModel.state.sheetHeight)]) | ||||||
| .onAppear { UIDatePicker.appearance().minuteInterval = 5 } | ||||||
| .onDisappear { UIDatePicker.appearance().minuteInterval = 1 /* 기본값으로 복원 */ } | ||||||
| .toolbar { toolbar } | ||||||
| .background( | ||||||
| GeometryReader { geometry in | ||||||
| Color.clear.onAppear { | ||||||
| viewModel.send(.setSheetHeight(geometry.size.height)) | ||||||
| } | ||||||
| } | ||||||
| ) | ||||||
| } | ||||||
| .onDisappear { | ||||||
| UIDatePicker.appearance().minuteInterval = 1 // 기본값으로 복원 | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| @ToolbarContentBuilder | ||||||
| private var toolbar: some ToolbarContent { | ||||||
| if #available(iOS 26.0, *) { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. iOS 버전 분기 처리에
Suggested change
|
||||||
| ToolbarItem(placement: .topBarLeading) { | ||||||
| Button(role: .cancel) { | ||||||
| viewModel.send(.rollbackUpdate) | ||||||
| } | ||||||
| } | ||||||
| .background( | ||||||
| GeometryReader { geometry in | ||||||
| Color.clear.onAppear { | ||||||
| viewModel.send(.setSheetHeight(geometry.size.height)) | ||||||
| } | ||||||
|
|
||||||
| ToolbarItem(placement: .topBarTrailing) { | ||||||
| Button(role: .confirm) { | ||||||
| viewModel.send(.confirmUpdate) | ||||||
| } | ||||||
| } | ||||||
| } else { | ||||||
| ToolbarItem(placement: .topBarLeading) { | ||||||
| Button { | ||||||
| viewModel.send(.rollbackUpdate) | ||||||
| } label: { | ||||||
| Text("취소") | ||||||
| } | ||||||
| ) | ||||||
| } | ||||||
|
|
||||||
| ToolbarItem(placement: .topBarTrailing) { | ||||||
| Button { | ||||||
| viewModel.send(.confirmUpdate) | ||||||
| } label: { | ||||||
| Text("확인") | ||||||
| .bold() | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updatePushNotificationSettings사이드 이펙트에서state.sheetPushNotificationTime을 사용하여 시간을 업데이트하고 있습니다.sheetPushNotificationTime은 사용자가 시간 선택 창에서 임시로 선택한 시간이며, 아직 확정되지 않은 값일 수 있습니다. 예를 들어, 사용자가 시간 선택 창을 열어 시간을 변경한 후 '확인'을 누르지 않고 닫은 다음, 푸시 알림 활성화 토글을 누르면 아직 확정되지 않은 시간이 서버에 저장될 수 있습니다. 항상 확정된 시간을 사용하도록state.viewPushNotificationTime을 사용해야 합니다.