Skip to content

Commit

Permalink
Some drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Aug 29, 2024
1 parent d6e8bb3 commit d4d8988
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 19 deletions.
13 changes: 11 additions & 2 deletions TemplateApplication.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UITemplateApplicationlicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UITemplateApplicationlicationSupportsIndirectInputEvents = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -726,6 +727,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 637867499T;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.templateapplication.tests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -743,6 +745,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 637867499T;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.templateapplicationuitests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -903,6 +906,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UITemplateApplicationlicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UITemplateApplicationlicationSupportsIndirectInputEvents = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -949,6 +953,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UITemplateApplicationlicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UITemplateApplicationlicationSupportsIndirectInputEvents = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -976,6 +981,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 637867499T;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.templateapplication.tests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -994,6 +1000,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 637867499T;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.templateapplication.tests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1011,6 +1018,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 637867499T;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.templateapplicationuitests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1028,6 +1036,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 637867499T;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.templateapplicationuitests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1087,8 +1096,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordSpezi/SpeziScheduler.git";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.8.3;
branch = "feature/infinity-loop";
kind = branch;
};
};
2F49B7742980407B00BCB272 /* XCRemoteSwiftPackageReference "Spezi" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "a5c253d1b4409eb8aef4346015ba000f9935cb2d",
"version" : "11.0.0"
"revision" : "9118aca998dbe2ceac45d64b21a91c6376928df7",
"version" : "11.1.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "ca30c987b732d130732fb60b071e0b655a85ada7",
"version" : "11.0.0"
"revision" : "07a2f57d147d2bf368a0d2dcb5579ff082d9e44f",
"version" : "11.1.0"
}
},
{
Expand Down Expand Up @@ -186,8 +186,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/Spezi",
"state" : {
"revision" : "87d735b4db005b1ff825bb3b55733cb78a69f899",
"version" : "1.7.1"
"revision" : "77550134ea4cf7cd05314bc44ccb13f7495503fc",
"version" : "1.7.2"
}
},
{
Expand Down Expand Up @@ -220,7 +220,7 @@
{
"identity" : "spezifoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation.git",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation",
"state" : {
"revision" : "d3a675735c734001e29e51689217d160bde51ce2",
"version" : "2.0.0-beta.1"
Expand Down Expand Up @@ -267,8 +267,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziScheduler.git",
"state" : {
"revision" : "896eb442eb2941f9b2f7721c3ac871373934142a",
"version" : "0.8.3"
"branch" : "feature/infinity-loop",
"revision" : "2b7c443cf30ab59511311df825b9795468963399"
}
},
{
Expand Down Expand Up @@ -301,7 +301,7 @@
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
Expand Down Expand Up @@ -393,8 +393,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/XCTRuntimeAssertions",
"state" : {
"revision" : "a2b127559cae78ae497273f047ccd99b28bf319b",
"version" : "1.1.2"
"revision" : "f560ec8410af032dd485ca9386e8c2b5d3e1a1f8",
"version" : "1.1.3"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion TemplateApplication/Schedule/EventContextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct EventContextView: View {


var body: some View {
HStack {
HStack { // TODO: see if we can introduce the tile views from NAMS? => automatically make it a gird layout on iPad?

Check failure on line 18 in TemplateApplication/Schedule/EventContextView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Todo Violation: TODOs should be resolved (see if we can introduce the ti...) (todo)
VStack(alignment: .leading) {
HStack {
if eventContext.event.complete {
Expand Down
13 changes: 9 additions & 4 deletions TemplateApplication/Schedule/ScheduleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ struct ScheduleView: View {

@State private var presentedContext: EventContext?
@Binding private var presentingAccount: Bool



@Environment(ILScheduler.self) private var ilScheduler

@MainActor private var eventContextsByDate: OrderedDictionary<Date, [EventContext]> {
let eventContexts = scheduler.tasks.flatMap { task in
task
Expand All @@ -33,18 +34,22 @@ struct ScheduleView: View {
EventContext(event: event, task: task)
}
}
.sorted()
.sorted() // TODO: double sort!

Check failure on line 37 in TemplateApplication/Schedule/ScheduleView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Todo Violation: TODOs should be resolved (double sort!) (todo)

return OrderedDictionary(grouping: eventContexts) { eventContext in
Calendar.current.startOfDay(for: eventContext.event.scheduledAt)
}
}

private var eventsToday: Any {
ilScheduler.queryEvents(for: .now..<Date.tomorrow)
}


var body: some View {
NavigationStack {
let eventContextsByDate = eventContextsByDate
List(eventContextsByDate.keys, id: \.timeIntervalSinceNow) { startOfDay in
List(eventContextsByDate.keys, id: \.timeIntervalSinceReferenceDate) { startOfDay in
Section(format(startOfDay: startOfDay)) {
ForEach(eventContextsByDate[startOfDay] ?? [], id: \.event) { eventContext in
EventContextView(eventContext: eventContext)
Expand Down
11 changes: 11 additions & 0 deletions TemplateApplication/Schedule/TemplateApplicationScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ typealias TemplateApplicationScheduler = Scheduler<TemplateApplicationTaskContex


extension TemplateApplicationScheduler {
static var newSocialSupportTask: ILTask {
// TODO: support testSchedule!

Check failure on line 20 in TemplateApplication/Schedule/TemplateApplicationScheduler.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Todo Violation: TODOs should be resolved (support testSchedule!) (todo)
ILTask(
id: "social-support-questionnaire",
title: String(localized: "TASK_SOCIAL_SUPPORT_QUESTIONNAIRE_TITLE"),
instructions: String(localized: "TASK_SOCIAL_SUPPORT_QUESTIONNAIRE_DESCRIPTION"),
schedule: .daily(hour: 8, minute: 0, startingAt: .today)
)
}

static var socialSupportTask: SpeziScheduler.Task<TemplateApplicationTaskContext> {
let dateComponents: DateComponents
if FeatureFlags.testSchedule {
Expand All @@ -38,6 +48,7 @@ extension TemplateApplicationScheduler {
end: .numberOfEvents(365)
),
notifications: true,
// TODO: we probably WANT to store the questionnaire along the task? to properly version it? Or just the identifier to make it easier to update?

Check failure on line 51 in TemplateApplication/Schedule/TemplateApplicationScheduler.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Todo Violation: TODOs should be resolved (we probably WANT to store the ...) (todo)
context: TemplateApplicationTaskContext.questionnaire(Bundle.main.questionnaire(withName: "SocialSupportQuestionnaire"))
)
}
Expand Down
1 change: 1 addition & 0 deletions TemplateApplication/TemplateApplicationDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class TemplateApplicationDelegate: SpeziAppDelegate {
}

TemplateApplicationScheduler()
ILScheduler()
OnboardingDataSource()
}
}
Expand Down
6 changes: 6 additions & 0 deletions TemplateApplication/TemplateApplicationStandard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import SpeziFirestore
import SpeziHealthKit
import SpeziOnboarding
import SpeziQuestionnaire
import SpeziScheduler
import SwiftUI


Expand All @@ -29,9 +30,14 @@ actor TemplateApplicationStandard: Standard,
@Application(\.logger) private var logger

@Dependency(FirebaseConfiguration.self) private var configuration
@Dependency(ILScheduler.self) private var scheduler

init() {}

@MainActor func configure() {

Check failure on line 37 in TemplateApplication/TemplateApplicationStandard.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes)

Check failure on line 38 in TemplateApplication/TemplateApplicationStandard.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Vertical Whitespace before Closing Braces Violation: Don't include vertical whitespace (empty line) before closing braces (vertical_whitespace_closing_braces)

Check failure on line 38 in TemplateApplication/TemplateApplicationStandard.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Vertical Whitespace after Opening Braces Violation: Don't include vertical whitespace (empty line) after opening braces (vertical_whitespace_opening_braces)
}


func add(sample: HKSample) async {
if FeatureFlags.disableFirebase {
Expand Down

0 comments on commit d4d8988

Please sign in to comment.