StanfordSpezi / SpeziScheduler

Scheduler Module for the Stanford Spezi Ecosystem
https://swiftpackageindex.com/StanfordSpezi/SpeziScheduler/documentation/
MIT License
4 stars 3 forks source link

Disable persistent storage of Tasks in simulator #38

Closed Supereg closed 8 months ago

Supereg commented 8 months ago

Disable persistent storage of Tasks in simulator

:recycle: Current situation & Problem

We found it overly complicated to deal with SpeziScheduler in the development process (e.g., testing changes within the simulator or running unit tests against a scheduler implementation). This PR changes the SchedulerStorage component to not interact with the local storage if running within a simulator environment. This should allow for more rapid development (e.g., no requirement to delete the app in between startups) and help in unit testing scenarios.

Additionally, this PR fixes the Equatable implementation of the Scheduler module.

Lastly, we update to the latest Spezi release and remove usage of the LifecycleHandler and avoid directly interfacing with the NotificationDelegate. This ensure that we don't override the Notification Center delegate from someone else and, most importantly, only respond to notifications the scheduler sent.

:gear: Release Notes

:books: Documentation

--

:white_check_mark: Testing

--

:pencil: Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

Supereg commented 8 months ago

@PSchmiedmayer make sense. Great catch. I restructured the SchedulerStorage module to be an independent module that you can configure from the outside (via an SPI import). Pretty sweet I think. Added logging to properly communicate if nothing is saved or restored.

I made some additional changes in this PR that (1) fixes some issues around Equatable (and therefore doesn't update our ScheduleView in the template application) and (2) updated everything to the latest changes in Spezi (e.g., LifecycleHandler deprecation and new NotificationHandler protocol).

codecov[bot] commented 8 months ago

Codecov Report

Attention: Patch coverage is 86.58537% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 86.51%. Comparing base (ba39108) to head (0fb5d21).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38/graphs/tree.svg?width=650&height=150&src=pr&token=0VQNE0E1Wp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi)](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) ```diff @@ Coverage Diff @@ ## main #38 +/- ## ========================================== + Coverage 86.18% 86.51% +0.34% ========================================== Files 7 8 +1 Lines 716 778 +62 ========================================== + Hits 617 673 +56 - Misses 99 105 +6 ``` | [Files](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) | Coverage Δ | | |---|---|---| | [Sources/SpeziScheduler/SchedulerStorage.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9TY2hlZHVsZXJTdG9yYWdlLnN3aWZ0) | `100.00% <100.00%> (+6.82%)` | :arrow_up: | | [Sources/SpeziScheduler/SchedulerLifecycle.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9TY2hlZHVsZXJMaWZlY3ljbGUuc3dpZnQ=) | `86.67% <86.67%> (ø)` | | | [Sources/SpeziScheduler/Model/TaskList.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9Nb2RlbC9UYXNrTGlzdC5zd2lmdA==) | `70.00% <50.00%> (-5.00%)` | :arrow_down: | | [Sources/SpeziScheduler/Scheduler.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9TY2hlZHVsZXIuc3dpZnQ=) | `76.57% <80.65%> (-0.27%)` | :arrow_down: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Last update [ba39108...0fb5d21](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/38?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi).