Skip to content

Commit

Permalink
Merge pull request #161 from TimerTiTi/fix-double-toast
Browse files Browse the repository at this point in the history
update : GetResetDailyEventUseCase
  • Loading branch information
koreatlwls authored Jun 29, 2024
2 parents cb5683e + b51c620 commit bf79345
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@ class GetResetDailyEventUseCase @Inject constructor(
private val dailyRepository: DailyRepository,
) {
suspend operator fun invoke(): Boolean {
val resetDaily = dailyRepository.getResetDailyEvent()
val today = getDailyDayWithHour(6).first
val resetEventDate = dailyRepository.getResetDailyEvent()
val (todayDate, endOfToday) = getDailyDayWithHour(6)

return if (resetDaily != null) {
if (resetDaily != today) {
dailyRepository.setResetDailyEvent(today)
return if (resetEventDate != null) {
if (resetEventDate != todayDate) {
dailyRepository.setResetDailyEvent(todayDate)
true
} else {
false
}
} else {
dailyRepository.setResetDailyEvent(today)
true
dailyRepository.setResetDailyEvent(todayDate)
val dailyEvent = dailyRepository.getDateDaily(
startDateTime = todayDate,
endDateTime = endOfToday,
)
dailyEvent == null
}
}
}

0 comments on commit bf79345

Please sign in to comment.