Skip to content

Conversation

@Zoe0929
Copy link
Member

@Zoe0929 Zoe0929 commented Jun 16, 2024

👾 작업 내용

  • 챌린지 성공 여부를 저장하는 로직을 추가했습니다.
  • 실패한 챌린지에 대한 이미지가 빠져 있어서 처리 해두었습니다.
  • 필요없는 파일 / 패키지 정리했습니다
  • 대면 만남 시 있었던 수정 사항들을 반영했습니다.

🚀 PR Point

챌린지 성공 여부 저장 로직을 유의해서 봐주세요!

  • 생각했던 방식은 이렇습니다.
  1. 마지막 접속 날짜 기록
  2. 마지막 접속 날짜와 현재 접속 날짜가 같다면 전송 X
  3. 마지막 접속 날짜와 현재 접속 날짜가 다르다면 마지막 접속 날짜 ~ 당일 전날 까지의 데이터 전송
  • 이 때, 당일 전날까지의 데이터는 모두 성공으로 저장. 앱 잠금을 포인트 이용해서 해제하지 않는 한 성공이기 때문
  • 포인트 이용 잠금해제는 바로 챌린지 실패 처리

일단 이해한 기능 대로 이렇게 구현했는데, 이러면 CoreData, 백그라운드 작업이 사실 상 필요없더라구요!
그런데, 만약 전체 사용 시간이 넘어갈 때까지 사용한 것도 실패라면, 이벤트에 실패 처리를 달아야 할 것 같습니다.

📸 스크린샷

구현 내용 스크린샷
챌린지

✅ CheckList

  • 오류 없이 빌드되는지 확인
  • 로그용 print문 제거
  • 불필요한 주석 제거
  • 코드 컨벤션 확인

🔗 Issue

Resolved #45

@Zoe0929 Zoe0929 requested a review from kim-seonwoo June 16, 2024 18:37
@Zoe0929 Zoe0929 linked an issue Jun 16, 2024 that may be closed by this pull request
@Zoe0929 Zoe0929 self-assigned this Jun 16, 2024
@Zoe0929 Zoe0929 added 🐰지희 지희의 issue ✨FEAT 기능 구현 labels Jun 16, 2024
@Zoe0929 Zoe0929 added this to the 🔭2차 스프린트🪐 milestone Jun 16, 2024
Copy link
Member

@kim-seonwoo kim-seonwoo left a comment

Choose a reason for hiding this comment

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

복잡한 로직 구현... 고생 많으셨을 것 같습니다..
파이팅 파이팅 ~

}

extension AppDelegate {
private func sendDailyChallengeDataIfNeeded() {
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 +10 to +17
extension Date {
func formattedString(format: String = "yyyy-MM-dd") -> String {
let formatter = DateFormatter()
formatter.dateFormat = format
return formatter.string(from: self)
}
}

Copy link
Member

Choose a reason for hiding this comment

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

👍 이부분 저도 활용해봐야겠어요..

Copy link
Member Author

Choose a reason for hiding this comment

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

유용할 것 같아서 extension으로 추가해뒀습니다! 유용하게 사용하세용 ~

Comment on lines +46 to +47
@StateObject var screenTimeModel = ScreenTimeViewModel()
@StateObject var challengeModel = ChallengeViewModel()
Copy link
Member

Choose a reason for hiding this comment

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

❓지금은 어쩔 수 없지만... 구조적으로 뷰모델에서 뷰모델을 선언해주는게 좋을까란.. 싶긴합니다..

Copy link
Member Author

Choose a reason for hiding this comment

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

구조 전체적인 수정이 필요하긴 합니다! 리뷰 감사해요~

instance: BaseResponse<UsagePointResponseDTO>.self) { result in

instance: BaseResponse<PatchPointUseResponseDTO>.self) { result in
if result.status == 400 {
Copy link
Member

Choose a reason for hiding this comment

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

❓ 에러 코드에 대한 핸들링을 위하여 NetworkProvider에 다음과 같이 선언해서 실패 에러 처리에 바로 안걸리게 해놓았는데요.

            case .success(let response):
                if (200..<300).contains(response.statusCode) ||
                    response.statusCode == 403 || response.statusCode == 400

이 방식이 괜찮은 건지 의문입니다..

Copy link
Member Author

Choose a reason for hiding this comment

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

제가 생각했을 때는 좋아보입니다!
따로 Vaildate를 해줄 수 있는 방법도 한 번 알아보면 좋을 것 같아요~
저렇게 하지 않으면 200대만 성공으로 인식하기 때문에 나머지가 인터셉터에서 처리해줘야 하는 문제가 발생할 것 같네용

self.currentAlertType = .insufficientPoints
} else if result.status == 200 {
// 특정 앱이 아닌 설정해둔 모든 앱이 잠기므로 모든 앱 잠금 해제
self.screenTimeModel.unblockAllApps()
Copy link
Member

Choose a reason for hiding this comment

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

❓ 이 부분과 별개로..
저희 그러면 자정에 어떤 동작들이 이루어지나요.?

Copy link
Member Author

Choose a reason for hiding this comment

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

정말 큰 부분이었는데 제가 깜빡했네요! 지금 구현해두었습니다.
지금 report에서 Fail일 때 뷰 전환(로티, 타이틀)을 위해 Bool 변수를 Appstorage를 이용해서 선언했는데요,
이는 UserDefaults 처럼 사용되기 때문에 자정에 실패 처리했던 변수를 한번 초기화해줘야 해요!
그 부분만 간단하게 백그라운드에서 처리해줄 수 있도록 변경해두었습니다~
이 부분 출시 이후헤 같이 테스트 해요!

@Zoe0929 Zoe0929 merged commit bf5c4f8 into develop Jun 17, 2024
@Zoe0929 Zoe0929 deleted the feat/#45 branch June 19, 2024 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨FEAT 기능 구현 🐰지희 지희의 issue

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feat] 백그라운 스케줄러 구현

3 participants