Repository navigation
fix: 반복 일정의 종료 알람이 시작 알람에 지워지지 않게 한다 (163) - #164
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Issues
Closes #163
📎 Work Description
반복 일정에 종료 시각을 넣으면 그 종료 알람이 한 번도 울리지 않았습니다. 시작 알람이 울리는 순간 그날 종료 알람이 지워집니다.
사슬은 이렇습니다. 09:00 시작 알람이 울리면
AlarmReceiver가 다음 회차를 걸라고 시킵니다. 그때 계산된 「다음」 은 내일 09:00 이고, 알람을 다시 거는 일은 첫 줄이cancelAlarm이라 그 일정의 자리를 먼저 비웁니다. 자리는scheduleId로만 찾으므로 아직 안 울린 오늘 10:00 종료 알람까지 함께 지워집니다.자리가 일정마다 시작 하나·종료 하나뿐이라, 회차를 앞당겨 걸면 진행 중인 회차의 남은 알람이 밀려납니다.
장부가 「지금 걸린 것이 어느 회차인가」 를 알게 했습니다.
ScheduledAlarm.bookedStartMillis를 더하고, 걸어 둔 회차에 아직 울릴 것이 남아 있으면 그 회차를 그대로 지킵니다. 되풀이하는 일정은 종료 알람까지 울린 뒤에야 다음 회차로 넘어갑니다.거는 자리를 하나로 모았습니다. 예약(
schedule)·다음 회차(scheduleNextOccurrence)·복원(restoreAll)이 모두book(record, now)를 지납니다. 「어느 회차가 걸려 있나」 를 아는 곳이 하나뿐이라, 다음에 이 자리를 고치는 사람이 세 곳을 맞출 필요가 없습니다.복원은 걸어 둔 회차를 지우고 다시 셉니다. 재부팅으로 걸린 것이 전부 사라졌으므로 지키던 회차라도 다시 걸어야 합니다.
📷 Screenshot
화면 변경 없습니다.
💬 To Reviewers
ktlintFormat·testDebugUnitTest(전 모듈 116개 통과) ·:app:lintDebug초록입니다.ScheduledAlarmTest에 회차 판정 테스트 6개를 더했습니다.bookedStartMillis가 없던 판의 JSON 을 읽어도 알람이 사라지지 않습니다.nextTriggerAfter를occurrenceToBook으로 갈음했습니다. 「다음에 울릴 시각」 이 아니라 「지금 걸어야 할 회차」 가 이 값이 답해야 할 질문입니다.```같은 줄이 섞입니다(이번 배포1.0-dist.67에서 실제로 보입니다). 읽는 데 지장은 없어 별도로 다룹니다.