Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to SpeziScheduler 1.0 #84

Merged
merged 12 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 48 additions & 32 deletions TemplateApplication.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "7791f7520d86b9b987dab37c9b90dab7fe5795363615aa359655357df18d38c1",
"originHash" : "99b228a3d90393197a05e59655cd0021e5d50f341ea80fb724e702b86d4f07e6",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand All @@ -13,7 +13,7 @@
{
"identity" : "antlr4",
"kind" : "remoteSourceControl",
"location" : "https://github.com/antlr/antlr4",
"location" : "https://github.com/antlr/antlr4.git",
"state" : {
"revision" : "cc82115a4e7f53d71d9d905caa2c2dfa4da58899",
"version" : "4.13.2"
Expand All @@ -24,8 +24,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "21fe1af9be463a359aaf8d96789ef73fc3760d09",
"version" : "11.0.1"
"revision" : "87dd288fc792bf9751e522e171a47df5b783b0b8",
"version" : "11.1.0"
}
},
{
Expand All @@ -49,7 +49,7 @@
{
"identity" : "fhirmodels",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/FHIRModels",
"location" : "https://github.com/apple/FHIRModels.git",
"state" : {
"revision" : "861afd5816a98d38f86220eab2f812d76cad84a0",
"version" : "0.5.0"
Expand All @@ -60,17 +60,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "9118aca998dbe2ceac45d64b21a91c6376928df7",
"version" : "11.1.0"
"revision" : "f909f901bfba9e27e4e9da83242a4915d6dd64bb",
"version" : "11.3.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "07a2f57d147d2bf368a0d2dcb5579ff082d9e44f",
"version" : "11.1.0"
"revision" : "93406fd21b85e66e2d6dbf50b472161fd75c3f1f",
"version" : "11.3.0"
}
},
{
Expand Down Expand Up @@ -114,8 +114,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/HealthKitOnFHIR.git",
"state" : {
"revision" : "c24e316311ff9813cb1fe32cd8820bcca6e5e7f2",
"version" : "0.2.10"
"revision" : "87a9257e6fa37407f3437e4a0bf21dd09a4ea7c5",
"version" : "0.2.11"
}
},
{
Expand Down Expand Up @@ -157,7 +157,7 @@
{
"identity" : "researchkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/ResearchKit",
"location" : "https://github.com/StanfordBDHG/ResearchKit.git",
"state" : {
"revision" : "08ab0290140e5a5e0e81d46cade1f09c7282facf",
"version" : "3.0.3"
Expand All @@ -166,10 +166,10 @@
{
"identity" : "researchkitonfhir",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/ResearchKitOnFHIR",
"location" : "https://github.com/StanfordBDHG/ResearchKitOnFHIR.git",
"state" : {
"revision" : "23dda93dc652b5c2753b5cbf989faf8185fd17f1",
"version" : "2.0.1"
"revision" : "d8d8b0d01599ad8a5a8397d10a99073728e6ae9b",
"version" : "2.0.2"
}
},
{
Expand All @@ -184,19 +184,19 @@
{
"identity" : "spezi",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/Spezi",
"location" : "https://github.com/StanfordSpezi/Spezi.git",
"state" : {
"revision" : "d5c8eec55255fd753367422c49db1ec16610c48b",
"version" : "1.7.4"
"branch" : "feature/application-for-swiftui",
"revision" : "dd59b84ec9525942842ad9f355d05c40804b1a97"
}
},
{
"identity" : "speziaccount",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziAccount.git",
"state" : {
"revision" : "7e78ee9e7e4df2071a18ac0fc722671ac1dcfac4",
"version" : "2.0.0-beta.7"
"branch" : "feature/swift-syntax-6",
"revision" : "76317960b52228a509919efaa766ef0243e9e9b0"
}
},
{
Expand All @@ -213,17 +213,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFirebase.git",
"state" : {
"revision" : "d0cb58fc43c99e632446b43c5cb56943f8339bf2",
"version" : "2.0.0-beta.3"
"revision" : "5aae93f567091b29f7683863baa2241f7c95290d",
"version" : "2.0.0-beta.4"
}
},
{
"identity" : "spezifoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation.git",
"state" : {
"revision" : "17bd0e03e69e0cc722d4cd28148d04443f4e2aba",
"version" : "2.0.0-beta.2"
"revision" : "5b4ad1b343154b52a68c33a6bfe02d9cb07cb9dc",
"version" : "2.0.0"
}
},
{
Expand All @@ -238,16 +238,25 @@
{
"identity" : "spezilicense",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziLicense",
"location" : "https://github.com/StanfordSpezi/SpeziLicense.git",
"state" : {
"revision" : "2249ce615a624a072834e31e7906b779ba82b824",
"version" : "0.1.1"
}
},
{
"identity" : "spezinotifications",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziNotifications",
"state" : {
"branch" : "feature/initial-version",
"revision" : "f09473d3ef8c76dd1dbfb384fabaf567d46b2aa5"
}
},
{
"identity" : "spezionboarding",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziOnboarding",
"location" : "https://github.com/StanfordSpezi/SpeziOnboarding.git",
"state" : {
"revision" : "a3d7bc15e6803b2205eb8dca010a48b1a40215be",
"version" : "1.2.2"
Expand All @@ -267,8 +276,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziScheduler.git",
"state" : {
"branch" : "feature/infinity-loop",
"revision" : "2b7c443cf30ab59511311df825b9795468963399"
"branch" : "feature/il-notifications-support",
"revision" : "7ad6b40b39bf85536dcbd1b9ac8e8f8f3f86dbbd"
}
},
{
Expand All @@ -285,14 +294,23 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziViews.git",
"state" : {
"revision" : "427f4f3a7acb0e00ea11c4c3ca7b60e36d2557a0",
"version" : "1.6.0"
"branch" : "feature/additional-infrastructure",
"revision" : "7eb5c529ff266b50e05a620427ed2ef6d1da8e80"
}
},
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms.git",
"state" : {
"revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42",
"version" : "1.2.0"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "41982a3656a71c768319979febd796c6fd111d5c",
"version" : "1.5.0"
Expand All @@ -312,44 +330,53 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "9bf03ff58ce34478e66aaee630e491823326fd06",
"version" : "1.1.3"
"revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
"version" : "1.1.4"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics.git",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
}
},
{
"identity" : "swift-package-list",
"kind" : "remoteSourceControl",
"location" : "https://github.com/FelixHerrmann/swift-package-list",
"state" : {
"revision" : "01f2e9860c122dd8c3ae2a7e642b85bbb053efe3",
"version" : "4.2.0"
"revision" : "e84b63c88f0797d769732440fe0786c5a2c634d8",
"version" : "4.4.0"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "edb6ed4919f7756157fe02f2552b7e3850a538e5",
"version" : "1.28.1"
"revision" : "ebc7251dd5b37f627c93698e4374084d98409633",
"version" : "1.28.2"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"location" : "https://github.com/swiftlang/swift-syntax.git",
"state" : {
"revision" : "2bc86522d115234d1f588efe2bcb4ce4be8f8b82",
"version" : "510.0.3"
"revision" : "515f79b522918f83483068d99c68daeb5116342d",
"version" : "600.0.0-prerelease-2024-08-14"
}
},
{
"identity" : "swiftlint",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/SwiftLint.git",
"state" : {
"revision" : "b515723b16eba33f15c4677ee65f3fef2ce8c255",
"version" : "0.55.1"
"revision" : "168fb98ed1f3e343d703ecceaf518b6cf565207b",
"version" : "0.57.0"
}
},
{
Expand Down Expand Up @@ -391,7 +418,7 @@
{
"identity" : "xctruntimeassertions",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/XCTRuntimeAssertions",
"location" : "https://github.com/StanfordBDHG/XCTRuntimeAssertions.git",
"state" : {
"revision" : "f560ec8410af032dd485ca9386e8c2b5d3e1a1f8",
"version" : "1.1.3"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
16 changes: 6 additions & 10 deletions TemplateApplication/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@ struct HomeView: View {

var body: some View {
TabView(selection: $selectedTab) {
ScheduleView(presentingAccount: $presentingAccount)
.tag(Tabs.schedule)
.tabItem {
Label("SCHEDULE_TAB_TITLE", systemImage: "list.clipboard")
}
Contacts(presentingAccount: $presentingAccount)
.tag(Tabs.contact)
.tabItem {
Label("CONTACTS_TAB_TITLE", systemImage: "person.fill")
}
Tab("SCHEDULE_TAB_TITLE", systemImage: "list.clipboard", value: .schedule) {
Supereg marked this conversation as resolved.
Show resolved Hide resolved
ScheduleView(presentingAccount: $presentingAccount)
}
Tab("CONTACTS_TAB_TITLE", systemImage: "person.fill", value: .contact) {
Contacts(presentingAccount: $presentingAccount)
}
}
.sheet(isPresented: $presentingAccount) {
AccountSheet()
Expand Down
9 changes: 5 additions & 4 deletions TemplateApplication/Onboarding/NotificationPermissions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
// SPDX-License-Identifier: MIT
//

import SpeziNotifications
import SpeziOnboarding
import SpeziScheduler
import SwiftUI


struct NotificationPermissions: View {
@Environment(TemplateApplicationScheduler.self) private var scheduler
@Environment(OnboardingNavigationPath.self) private var onboardingNavigationPath


@Environment(\.requestNotificationAuthorization) private var requestNotificationAuthorization

@State private var notificationProcessing = false


Expand Down Expand Up @@ -46,7 +47,7 @@ struct NotificationPermissions: View {
if ProcessInfo.processInfo.isPreviewSimulator {
try await _Concurrency.Task.sleep(for: .seconds(5))
} else {
try await scheduler.requestLocalNotificationAuthorization()
try await requestNotificationAuthorization(options: [.alert, .sound, .badge])
}
} catch {
print("Could not request notification permissions.")
Expand Down
20 changes: 14 additions & 6 deletions TemplateApplication/Onboarding/OnboardingFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
@_spi(TestingSupport) import SpeziAccount
import SpeziFirebaseAccount
import SpeziHealthKit
import SpeziNotifications
import SpeziOnboarding
import SpeziScheduler
import SwiftUI


/// Displays an multi-step onboarding flow for the Spezi Template Application.
struct OnboardingFlow: View {
@Environment(HealthKit.self) private var healthKitDataSource
@Environment(TemplateApplicationScheduler.self) private var scheduler

@Environment(\.scenePhase) private var scenePhase
@Environment(\.notificationSettings) private var notificationSettings

@AppStorage(StorageKeys.onboardingFlowComplete) private var completedOnboardingFlow = false

@State private var localNotificationAuthorization = false


Expand Down Expand Up @@ -55,10 +57,16 @@ struct OnboardingFlow: View {
NotificationPermissions()
}
}
.task {
localNotificationAuthorization = await scheduler.localNotificationAuthorization
}
.interactiveDismissDisabled(!completedOnboardingFlow)
.onChange(of: scenePhase, initial: true) {
guard case .active = scenePhase else {
return
}

Task {
localNotificationAuthorization = await notificationSettings().authorizationStatus == .authorized
}
}
}
}

Expand Down
Loading
Loading