Skip to content
This repository was archived by the owner on Dec 22, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
.DS_Store


## User settings
xcuserdata/
Expand Down
183 changes: 140 additions & 43 deletions CareKit Sample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 18 additions & 20 deletions CareKit Sample/CKCareKitManager+Sample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal extension OCKStore {
func populateSampleData() {
seedLiveLectureTasks()
seedResearchKitSample()

seedSkinAI()
createContacts()
}

Expand Down Expand Up @@ -49,36 +49,26 @@ internal extension OCKStore {

fileprivate func seedLiveLectureTasks() {

// Daily medication task
let medsSchedule = OCKSchedule.dailyAtTime(hour: 8, minutes: 0, start: Date(), end: nil, text: nil)
var meds = OCKTask(id: "meds", title: "Take your accutane", carePlanUUID: nil, schedule: medsSchedule)
meds.instructions = "Take 1 tablet after breakfast."

// Rehab task
// Week 1 - twice daily
// Week 2 - once daily
// Week 3 - end
let startOfWeek1 = Calendar.current.startOfDay(for: Date())
let endOfWeek1 = Calendar.current.date(byAdding: .weekOfYear, value: 1, to: startOfWeek1)!
let startOfWeek2 = endOfWeek1
let endOfWeek2 = Calendar.current.date(byAdding: .weekOfYear, value: 1, to: startOfWeek2)!


let week1Morning = OCKSchedule.dailyAtTime(hour: 8, minutes: 0, start: startOfWeek1, end: endOfWeek1, text: "Morning")

let week1Evening = OCKSchedule.dailyAtTime(hour: 20, minutes: 0, start: startOfWeek1, end: endOfWeek1, text: "Before Bed")

let week2Afternoon = OCKSchedule.dailyAtTime(hour: 12, minutes: 0, start: startOfWeek2, end: endOfWeek2, text: "Afternoon")

let rehabSchedule = OCKSchedule(composing: [week1Morning, week1Evening, week2Afternoon])
let rehabSchedule = OCKSchedule(composing: [week1Morning, week1Evening])

var rehab = OCKTask(id: "rehab", title: "Rehab Exercises", carePlanUUID: nil, schedule: rehabSchedule)
var rehab = OCKTask(id: "rehab", title: "Skincare routine", carePlanUUID: nil, schedule: rehabSchedule)

rehab.instructions = """
Lie on your back and bend your affected knee 90 degrees with your foot.
You can modify this text with any instructions of your choice!
Don't forget to follow your morning and evening skincare routine steps!
"""

addTasks([meds, rehab], callbackQueue: .main) { result in
addTasks([rehab], callbackQueue: .main) { result in
switch result {
case let .success(tasks):
print("Added \(tasks.count) tasks")
Expand All @@ -89,12 +79,20 @@ internal extension OCKStore {
}

fileprivate func seedResearchKitSample() {
let surveySchedule = OCKSchedule.dailyAtTime(hour: 12, minutes: 0, start: Date(), end: nil, text: nil)
var survey = OCKTask(id: "survey", title: "Take a Survey 📝", carePlanUUID: nil, schedule: surveySchedule)
let startOfWeek1 = Calendar.current.startOfDay(for: Date())
let surveySchedule = OCKSchedule.weeklyAtTime(weekday: 7, hours: 12, minutes: 0, start: startOfWeek1, end: nil, targetValues: [], text: "")
var survey = OCKTask(id: "survey", title: "Take your skin survey", carePlanUUID: nil, schedule: surveySchedule)
survey.impactsAdherence = true
survey.instructions = "You can schedule any ResearchKit survey in your app."

// survey.instructions = "Please take your skin survey so we can know how you are doing."
addTasks([survey], callbackQueue: .main, completion: nil)
}

fileprivate func seedSkinAI() {
let startOfWeek1 = Calendar.current.startOfDay(for: Date())
let skinAISchedule = OCKSchedule.weeklyAtTime(weekday: 7, hours: 12, minutes: 0, start: startOfWeek1, end: nil, targetValues: [], text: "")
var skinAI = OCKTask(id: "skinAI", title: "Take your skin diagnosis", carePlanUUID: nil, schedule: skinAISchedule)
skinAI.impactsAdherence = true
// skinAI.instructions = "Please take your skin diagnosis so we can monitor you skin progession."
addTasks([skinAI], callbackQueue: .main, completion: nil)
}
}
3 changes: 2 additions & 1 deletion CareKit Sample/CKCareKitManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class CKCareKitManager: NSObject {
override init() {
super.init()

coreDataStore = OCKStore(name: "CKSampleCareKitStore", securityApplicationGroupIdentifier: nil, type: coreDataStoreType, remote: CKCareKitRemoteSyncWithFirestore())
// coreDataStore = OCKStore(name: "CKSampleCareKitStore", securityApplicationGroupIdentifier: nil, type: coreDataStoreType, remote: CKCareKitRemoteSyncWithFirestore())
coreDataStore = OCKStore(name: "CKSampleCareKitStore", securityApplicationGroupIdentifier: nil, type: .inMemory)

initStore(forceUpdate: coreDataStoreType == .inMemory)

Expand Down
2 changes: 1 addition & 1 deletion CareKit Sample/CareKit_SampleApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct CareKit_SampleApp: App {

var body: some Scene {
WindowGroup {
ContentView()
LaunchUIView()
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading