StanfordSpezi / SpeziScheduler

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

Flag that indicates if Local Notification authorization given #14

Closed philippzagar closed 1 year ago

philippzagar commented 1 year ago

Flag that indicates if Local Notification authorization given

:recycle: Current situation & Problem

As an application developer utilizing the Spezi framework, there is currently no way to determine if the Local Notification authorizations are already granted. This could result in unnecessary onboarding views to grant notification permissions, even though they are already given.

:bulb: Proposed solution

The Scheduler module is extended by the public var localNotificationAuthorization: Bool flag. This property indicates whether the authorization to deliver local notifications is already given to the app. Note that the flag is an async get computed property, meaning one has to await the result.

An example usage could be the following:

struct HealthKitPermissions: View {
    @EnvironmentObject var scheduler: Scheduler<FHIR, SomeContext>

    var body: some View {
        OnboardingView(
            ...,
            action: {
                if await !scheduler.localNotificationAuthorization {
                    ...
                }
        )
    }
}

:gear: Release Notes

:heavy_plus_sign: Additional Information

--

Related PRs

SpeziTemplateApplication PR

Testing

A UI test case was written to check the behavior of the flag.

Reviewer Nudging

Code changes are minimal

Code of Conduct & Contributing Guidelines

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

codecov[bot] commented 1 year ago

Codecov Report

Merging #14 (51e6303) into main (cf4d9a0) will increase coverage by 0.11%. The diff coverage is 100.00%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/14/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/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) ```diff @@ Coverage Diff @@ ## main #14 +/- ## ========================================== + Coverage 90.39% 90.50% +0.11% ========================================== Files 5 5 Lines 437 442 +5 ========================================== + Hits 395 400 +5 Misses 42 42 ``` | [Impacted Files](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) | Coverage Δ | | |---|---|---| | [Sources/SpeziScheduler/Scheduler.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9TY2hlZHVsZXIuc3dpZnQ=) | `88.78% <100.00%> (+0.61%)` | :arrow_up: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/14?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/14?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Last update [cf4d9a0...51e6303](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/14?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).
philippzagar commented 1 year ago

@PSchmiedmayer Thanks for the feedback, the branch is now ready to merge, all lints and tests in the pipeline finish successfully. However, some checks are staying on "Wating for status to be reported" (the same also happenes in another repo), even though the actual job (e.g. linting) ran through. Retriggering the CI didn't help. Any hints?

image
PSchmiedmayer commented 1 year ago

@philippzagar Same issue as in https://github.com/StanfordSpezi/SpeziOnboarding/pull/9, will fix this and merge the PR right after that 👍