-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: master
Are you sure you want to change the base?
Conversation
목표시간 초기화 프로세스 개선
Toast Message 구현 [SwiftUI]
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.
수고하셨습니다! 👍
|
||
/// view의 사이즈를 알아내는 함수 | ||
@ViewBuilder | ||
func onReadSize(_ perform: @escaping (CGSize) -> Void) -> some View { |
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.
오 이런방법도 있었군요! 👍
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 | ||
} |
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.
P1 (꼭 확인)
day 의 값이 H 시간이 반영된 날짜값이여야 합니다!
해당 로직으로는 Date 값에 H 시간이 반영되어 있지 않은 것 같아요!
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.
음.. 위 로직 자체가 잘못되었네요ㅠ
왜 저렇게 했는지 기억은 안나지만,, 수정했습니다
- 전 날 기록이 없고, 오늘 새벽에 들어왔는데 resetHour 이전 시간인 경우
- 전 날의 기록으로 생성 -> 생성할 때 H시간이 반영되도록!
@@ -136,6 +140,7 @@ final class StopwatchVM { | |||
RecordsManager.shared.recordTimes.reset() | |||
self.updateDaily() | |||
self.updateTimes() | |||
ToastMessage.shared.show(type: .newRecord) |
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.
편하게 사용 가능하군요! 👍
private func setting(_ type: ToastType) { | ||
presenter.height = height | ||
if !UIDevice.current.orientation.isLandscape { | ||
presenter.height += UIApplication.shared.windows.first?.safeAreaInsets.top ?? 0 |
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.
P5 (의견)
safeAreaInsets.top 값의 경우 자주 사용될수도 있을 것 같다고 생각되네요
Extension 추가는 어떨까요?
extension UIApplication {
var safeAreaTop: CGFloat {
return UIApplication.shared.windows.first?.safeAreaInsets.bottom ?? 0
}
}
withAnimation(.easeIn(duration: 0.15)) { | ||
yOffset = presenter.height + viewHeight | ||
} completion: { | ||
DispatchQueue.main.asyncAfter(deadline: .now()+1, execute: { | ||
hide() | ||
}) | ||
} |
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.
최종 duration 수치를 조정해보면 좋겠습니다!
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.
최종적으로 논의된 수치로 반영했습니다!
https://www.notion.so/timertiti/Toast-Animation-25b9a4d3d8104176bfed617fb5deaeab?pvs=4
- newRecord -> createNewRecord - 내부 함수 사용시 self 키워드 추가
Sub PR
변경사항
이번 PR에서는 아래 commit이 등록되었어요
3dc75e4: Daily의 day가 생성되는 로직을 변경 했어요!
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
Simulator.Screen.Recording.-.iPad.Pro.11-inch.4th.generation.-.2024-07-31.at.17.59.23.mp4
ipad_land.mov