Skip to content

[#134] 사용자 설정으로 시간을 바꿀 때 확인 버튼을 탭하면 서버에 변동사항이 저장되도록 개선한다#139

Merged
opficdev merged 7 commits intodevelopfrom
feat/#134-PushNotificationSettings-AlertTime
Feb 26, 2026
Merged

[#134] 사용자 설정으로 시간을 바꿀 때 확인 버튼을 탭하면 서버에 변동사항이 저장되도록 개선한다#139
opficdev merged 7 commits intodevelopfrom
feat/#134-PushNotificationSettings-AlertTime

Conversation

@opficdev opficdev self-assigned this Feb 26, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @opficdev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 풀 리퀘스트는 푸시 알림 시간 설정 기능의 사용자 경험을 개선하기 위해 상태 관리 로직을 리팩토링합니다. 메인 화면에 표시되는 시간과 시간 선택기 시트에서 편집되는 시간을 분리하고, 사용자가 명시적으로 '확인' 버튼을 눌러야만 변경 사항이 서버에 저장되도록 하여, 의도치 않은 변경을 방지하고 데이터 일관성을 높입니다.

Highlights

  • 시간 상태 분리: 푸시 알림 시간 설정을 위한 viewPushNotificationTimesheetPushNotificationTime 두 가지 상태를 도입하여, 메인 화면에 표시되는 시간과 시간 선택기 시트에서 편집 중인 시간을 명확히 분리했습니다.
  • 확인/취소 액션 추가: 시간 선택기 시트에서 사용자가 변경 사항을 확정하거나 취소할 수 있도록 confirmUpdaterollbackUpdate 액션을 추가했습니다. 이를 통해 서버 저장 시점을 사용자의 명시적인 확인으로 제어합니다.
  • 시간 선택기 UI 개선: 시간 선택기 시트에 NavigationStack과 '취소', '확인' 버튼이 포함된 Toolbar를 추가하여 사용자 경험을 개선했습니다. 이 버튼들은 각각 rollbackUpdateconfirmUpdate 액션을 트리거합니다.
  • 서버 업데이트 로직 변경: 푸시 알림 설정 업데이트를 서버에 전송하는 updatePushNotificationSettings 사이드 이펙트가 이제 confirmUpdate 액션이 발생할 때만 트리거되도록 변경하여, 사용자가 시간을 확정했을 때만 서버에 반영되도록 했습니다.
Changelog
  • DevLog/Presentation/ViewModel/PushNotificationSettingsViewModel.swift
    • 시간 관련 상태 변수 pushNotificationTimeviewPushNotificationTimesheetPushNotificationTime으로 분리했습니다.
    • setPushNotificationTime 액션이 viewsheet 시간을 선택적으로 업데이트할 수 있도록 변경했습니다.
    • confirmUpdaterollbackUpdate 액션을 추가하여 시간 선택기 시트의 확인/취소 로직을 처리합니다.
    • reduce 메서드 내에서 새로운 액션들을 처리하고, updatePushNotificationSettings 사이드 이펙트가 confirmUpdate 시에만 발생하도록 로직을 수정했습니다.
  • DevLog/UI/Setting/PushNotificationSettingsView.swift
    • 시간 표시를 viewModel.state.viewPushNotificationTime으로 변경했습니다.
    • 시간 선택기 (DatePicker)의 바인딩을 viewModel.state.sheetPushNotificationTime으로 업데이트했습니다.
    • 시간 선택기 시트에 NavigationStack과 '취소', '확인' 버튼을 포함하는 Toolbar를 추가했습니다.
    • Toolbar 버튼 탭 시 confirmUpdate 또는 rollbackUpdate 액션을 디스패치하도록 구현했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이 PR은 사용자가 푸시 알림 시간을 설정할 때, 변경 사항을 즉시 저장하는 대신 '확인' 버튼을 눌러야 저장되도록 개선하는 작업을 담고 있습니다. 이를 위해 시간 상태를 화면에 표시되는 시간(viewPushNotificationTime)과 수정 중인 시간(sheetPushNotificationTime)으로 분리하고, sheet 뷰에 확인/취소 버튼을 추가하는 등 ViewModel과 View 양쪽에서 많은 변경이 이루어졌습니다. 전반적으로 의도한 기능 개선은 잘 이루어졌으나, 몇 가지 수정이 필요한 부분과 개선할 점이 보입니다. 특히, 푸시 알림 활성화 토글 시 변경사항이 저장되지 않는 문제와 iOS 버전 체크의 오타는 수정이 필요합니다. 자세한 내용은 각 코드 리뷰 코멘트를 참고해주세요.


@ToolbarContentBuilder
private var toolbar: some ToolbarContent {
if #available(iOS 26.0, *) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

iOS 버전 분기 처리에 if #available(iOS 26.0, *)를 사용하셨습니다. iOS 26.0은 아직 출시되지 않은 버전이므로 이 조건문은 항상 false를 반환하게 됩니다. 아마 iOS 16.0의 오타인 것 같습니다. Buttonrole 파라미터는 iOS 15.0부터 사용 가능하며, .cancel, .confirm 등의 역할(role)에 따른 기본 스타일과 동작을 제공합니다. 버전을 iOS 15.0 또는 iOS 16.0으로 수정해야 의도한 대로 동작합니다.

Suggested change
if #available(iOS 26.0, *) {
if #available(iOS 16.0, *) {

Comment on lines 71 to 72
case .setPushNotificationEnable(let value):
self.state.pushNotificationEnable = value
return [.updatePushNotificationSettings]
state.pushNotificationEnable = value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

setPushNotificationEnable 액션이 더 이상 updatePushNotificationSettings 사이드 이펙트를 발생시키지 않습니다. 이로 인해 사용자가 푸시 알림 활성화 토글을 눌러도 변경사항이 서버에 즉시 저장되지 않는 문제가 발생합니다. 토글 스위치는 즉시 반응하여 서버에 저장되는 것이 일반적인 사용자 경험에 부합하므로, 이전과 같이 사이드 이펙트를 발생시켜야 합니다.

Suggested change
case .setPushNotificationEnable(let value):
self.state.pushNotificationEnable = value
return [.updatePushNotificationSettings]
state.pushNotificationEnable = value
case .setPushNotificationEnable(let value):
state.pushNotificationEnable = value
effects = [.updatePushNotificationSettings]

Comment on lines +131 to +134
let dateComponents = calendar.dateComponents(
[.hour, .minute],
from: state.sheetPushNotificationTime
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

updatePushNotificationSettings 사이드 이펙트에서 state.sheetPushNotificationTime을 사용하여 시간을 업데이트하고 있습니다. sheetPushNotificationTime은 사용자가 시간 선택 창에서 임시로 선택한 시간이며, 아직 확정되지 않은 값일 수 있습니다. 예를 들어, 사용자가 시간 선택 창을 열어 시간을 변경한 후 '확인'을 누르지 않고 닫은 다음, 푸시 알림 활성화 토글을 누르면 아직 확정되지 않은 시간이 서버에 저장될 수 있습니다. 항상 확정된 시간을 사용하도록 state.viewPushNotificationTime을 사용해야 합니다.

Suggested change
let dateComponents = calendar.dateComponents(
[.hour, .minute],
from: state.sheetPushNotificationTime
)
let dateComponents = calendar.dateComponents(
[.hour, .minute],
from: state.viewPushNotificationTime
)

Comment on lines 73 to 81
case .setPushNotificationHour(let value):
// 시간만 변경
if let newDate = calendar.date(
bySettingHour: value,
minute: 0, second: 0,
of: state.pushNotificationTime
of: state.viewPushNotificationTime
) {
self.state.pushNotificationTime = newDate
return [.updatePushNotificationSettings]
state.viewPushNotificationTime = newDate
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

setPushNotificationHour 액션은 View에서 더 이상 사용되지 않는 것으로 보입니다. PushNotificationSettingsView에서는 프리셋 시간을 탭했을 때 setPushNotificationTimeconfirmUpdate 액션을 직접 호출하도록 변경되었습니다. Action 열거형의 setPushNotificationHour 케이스와 reduce 함수의 해당 case 문을 함께 제거하여 코드를 정리하는 것을 권장합니다.

Comment on lines 40 to 41
viewModel.send(.setPushNotificationTime(sheet: date))
viewModel.send(.confirmUpdate)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

프리셋 시간을 탭했을 때 View에서 두 개의 액션(setPushNotificationTime, confirmUpdate)을 순차적으로 보내고 있습니다. 이는 View가 ViewModel의 내부 동작(상태를 설정하고 바로 업데이트를 트리거하는)을 너무 많이 알고 있게 만듭니다. 이 로직을 ViewModel로 옮겨 View의 역할을 단순화하는 것이 좋습니다.

예를 들어, PushNotificationSettingsViewModel.ActionselectPresetTime(Date) 케이스를 추가하고, View에서는 이 액션만 보내도록 수정할 수 있습니다.

ViewModel 수정 제안:
Action 열거형에 .selectPresetTime(Date)를 추가하고, reduce 메소드에 아래와 같이 로직을 구현합니다.

case .selectPresetTime(let date):
    state.viewPushNotificationTime = date
    state.sheetPushNotificationTime = date // 동기화
    effects = [.updatePushNotificationSettings]
Suggested change
viewModel.send(.setPushNotificationTime(sheet: date))
viewModel.send(.confirmUpdate)
viewModel.send(.selectPresetTime(date))

@opficdev opficdev merged commit 0a9194c into develop Feb 26, 2026
1 check passed
@opficdev opficdev deleted the feat/#134-PushNotificationSettings-AlertTime branch February 26, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PushNotificationSettingsView에서 사용자 설정으로 시간을 바꿀 때, 확인 버튼을 탭하면 서버로 변경되도록 변경한다

1 participant