Skip to content
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

날짜 초기화 자동 프로세스 최종 [Toast 연결] #162

Open
wants to merge 40 commits into
base: master
Choose a base branch
from

Conversation

sladuf
Copy link
Contributor

@sladuf sladuf commented Jul 3, 2024

Sub PR

  • 날짜 초기화 자동 프로세스, Toast Message 구현과 이어지는 작업입니다.
  • 날짜 초기화 자동 프로세스는 여기에 상세한 PR 남겨 두었으니 참고하세요!
  • Toast Message 구현은 여기에 상세한 PR 남겨 두었으니 참고하세요!

변경사항

이번 PR에서는 아래 commit이 등록되었어요

  • 3dc75e4: Daily의 day가 생성되는 로직을 변경 했어요!

    • 기존: day = Date()
    • 변경: resetHour 이전에 생성되는 경우, day-1(전날)로 생성
  • 5619883: ToastView가 iPad에서 두배가 되도록 로직을 추가했어요!

  • b9321d5: 날짜 초기화 시점에 맞춰 Toast.show()


ScreenShot

  • Toast는 애니메이션이 있어 영상으로 첨부합니다.

  • iPhone에서 세로모드, 가로모드

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-07-31.at.17.56.37.mp4
iphone_land.mov
  • iPad에서 세로모드, 가로모드
Simulator.Screen.Recording.-.iPad.Pro.11-inch.4th.generation.-.2024-07-31.at.17.59.23.mp4
ipad_land.mov

sladuf added 27 commits May 9, 2024 02:41
목표시간 초기화 프로세스 개선
Toast Message 구현 [SwiftUI]
@sladuf sladuf added the feature 기능 추가/변경/삭제 label Jul 3, 2024
@sladuf sladuf requested a review from minsangKang July 3, 2024 03:13
@sladuf sladuf self-assigned this Jul 3, 2024
@sladuf sladuf added the pr: needed review PR 리뷰필요 label Jul 4, 2024
@sladuf sladuf marked this pull request as draft July 4, 2024 16:53
@sladuf sladuf marked this pull request as ready for review July 7, 2024 12:02
Copy link
Member

@minsangKang minsangKang left a comment

Choose a reason for hiding this comment

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

수고하셨습니다! 👍


/// view의 사이즈를 알아내는 함수
@ViewBuilder
func onReadSize(_ perform: @escaping (CGSize) -> Void) -> some View {
Copy link
Member

Choose a reason for hiding this comment

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

오 이런방법도 있었군요! 👍

Comment on lines 31 to 37
let now = Date().setTime(hour: RecordsManager.resetHour, minute: 0, second: 0)
if now.hour < RecordsManager.resetHour {
/// 전 날 기록이 없고, 새벽에 들어오는 경우
self.day = now.nextDay(offset: -1)
} else {
self.day = now
}
Copy link
Member

Choose a reason for hiding this comment

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

P1 (꼭 확인)
day 의 값이 H 시간이 반영된 날짜값이여야 합니다!
해당 로직으로는 Date 값에 H 시간이 반영되어 있지 않은 것 같아요!

Copy link
Contributor Author

@sladuf sladuf Oct 9, 2024

Choose a reason for hiding this comment

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

음.. 위 로직 자체가 잘못되었네요ㅠ
왜 저렇게 했는지 기억은 안나지만,, 수정했습니다

  • 전 날 기록이 없고, 오늘 새벽에 들어왔는데 resetHour 이전 시간인 경우
  • 전 날의 기록으로 생성 -> 생성할 때 H시간이 반영되도록!

@@ -136,6 +140,7 @@ final class StopwatchVM {
RecordsManager.shared.recordTimes.reset()
self.updateDaily()
self.updateTimes()
ToastMessage.shared.show(type: .newRecord)
Copy link
Member

Choose a reason for hiding this comment

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

편하게 사용 가능하군요! 👍

private func setting(_ type: ToastType) {
presenter.height = height
if !UIDevice.current.orientation.isLandscape {
presenter.height += UIApplication.shared.windows.first?.safeAreaInsets.top ?? 0
Copy link
Member

Choose a reason for hiding this comment

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

P5 (의견)
safeAreaInsets.top 값의 경우 자주 사용될수도 있을 것 같다고 생각되네요
Extension 추가는 어떨까요?

extension UIApplication {
    var safeAreaTop: CGFloat {
        return UIApplication.shared.windows.first?.safeAreaInsets.bottom ?? 0
    }
}

Comment on lines 45 to 51
withAnimation(.easeIn(duration: 0.15)) {
yOffset = presenter.height + viewHeight
} completion: {
DispatchQueue.main.asyncAfter(deadline: .now()+1, execute: {
hide()
})
}
Copy link
Member

Choose a reason for hiding this comment

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

최종 duration 수치를 조정해보면 좋겠습니다!

Copy link
Member

Choose a reason for hiding this comment

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

최종적으로 논의된 수치로 반영했습니다!
https://www.notion.so/timertiti/Toast-Animation-25b9a4d3d8104176bfed617fb5deaeab?pvs=4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 기능 추가/변경/삭제 pr: needed review PR 리뷰필요
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants