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

Use CareKit 3.0.0 #116

Merged
merged 54 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
0e21d7b
Working without displaying HealthKit tasks
cbaker6 Apr 9, 2023
9aa4454
nits
cbaker6 Apr 9, 2023
def29db
Merge branch 'main' into newCareKit
cbaker6 Apr 9, 2023
f6491b0
add stream coordinator
cbaker6 Apr 9, 2023
f24d231
simplify views and viewModels
cbaker6 Apr 9, 2023
54b6f57
simplify some more
cbaker6 Apr 9, 2023
97a585a
more simplifications
cbaker6 Apr 9, 2023
088fb51
simplify profile
cbaker6 Apr 9, 2023
48abdc6
More clean up
cbaker6 Apr 9, 2023
396d667
Everything working but watch login transition
cbaker6 Apr 10, 2023
914b8ac
Remove notification center from watchOS app
cbaker6 Apr 10, 2023
56e61ac
remove extra notification
cbaker6 Apr 10, 2023
dbee256
Update to tintColor fixes
cbaker6 Apr 10, 2023
f0bb01f
Latest
cbaker6 Apr 10, 2023
3879a3a
fix init
cbaker6 Apr 10, 2023
51349a3
fix watchOS login transition
cbaker6 Apr 10, 2023
0998a8a
move sync properties
cbaker6 Apr 10, 2023
1d858a5
Doc nits
cbaker6 Apr 10, 2023
d2f61d0
move back global properties
cbaker6 Apr 11, 2023
1ed8dc0
doc nits
cbaker6 Apr 11, 2023
d62c35d
Don't replace store if it has the same name
cbaker6 Apr 11, 2023
4dafb1f
UIKit views don't use async/await
cbaker6 Apr 12, 2023
6336ee0
Constrain query on watch
cbaker6 Apr 13, 2023
82b7902
Add back SwiftUI step card in UIKit
cbaker6 Apr 13, 2023
5063b4a
Remove padding on SwiftUI view
cbaker6 Apr 13, 2023
ad68a21
disable steps card since it's causing crash
cbaker6 Apr 13, 2023
e1440ad
Fix syncing with watch directly
cbaker6 Apr 14, 2023
da29422
enable use of isSendingPushUpdatesToWatch
cbaker6 Apr 14, 2023
4a55bc5
move enums to models folder
cbaker6 Apr 14, 2023
38fe43a
fix crash when deleting app
cbaker6 Apr 14, 2023
776938d
remover extra properties
cbaker6 Apr 15, 2023
5453a5a
Simplify views
cbaker6 Apr 15, 2023
00332ad
Use careStore environment property in more views
cbaker6 Apr 15, 2023
d62803b
Add bday to preview store
cbaker6 Apr 15, 2023
4f3538b
Improve watch sync
cbaker6 Apr 15, 2023
2c65f3c
Fix entity conflicts
cbaker6 Apr 18, 2023
6b1add0
Merge remote-tracking branch 'refs/remotes/origin/newCareKit'
cbaker6 Apr 18, 2023
eb934f2
update conflicts on watch
cbaker6 Apr 18, 2023
27d0fa7
latest
cbaker6 Apr 18, 2023
edb2c6b
Update to latest ParseCareKit
cbaker6 Apr 18, 2023
7bfeff6
updates
cbaker6 Apr 18, 2023
2d2d2e5
updates
cbaker6 Apr 22, 2023
6941e91
Use transactions by default
cbaker6 Apr 22, 2023
1efc8b1
Working ACL's with roles
cbaker6 Apr 23, 2023
cf174de
Working
cbaker6 Apr 23, 2023
1b1840b
latest
cbaker6 Apr 23, 2023
5785888
Use latest ParseCareKit
cbaker6 Apr 24, 2023
1452d71
delete ParseCareKit cache on logout
cbaker6 Apr 24, 2023
7ae5254
latest
cbaker6 Apr 25, 2023
953b083
use latest ParseCareKit
cbaker6 Apr 25, 2023
a883f4b
working
cbaker6 Apr 25, 2023
7f8a647
Use latest ParseCareKit
cbaker6 Apr 30, 2023
f596578
update
cbaker6 May 1, 2023
b362e42
Update ParseCareKit
cbaker6 May 1, 2023
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
67 changes: 51 additions & 16 deletions OCKSample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/cbaker6/CareKit.git",
"state" : {
"revision" : "954185b307222431e50f656d2870019e9ec97c28",
"version" : "2.1.8"
"revision" : "698176a292e3077f7a30496c42f9e8392328930e",
"version" : "3.0.0-alpha.22"
}
},
{
"identity" : "carekitutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/netreconlab/CareKitUtilities.git",
"state" : {
"revision" : "ca65485fd95f40ae1bc27f61ee062b2688ad2554",
"version" : "0.0.1"
"revision" : "7c7be19c8f652589fe97692df92cd7ffb634c41c",
"version" : "1.0.0-alpha.2"
}
},
{
Expand All @@ -32,17 +32,35 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/netreconlab/Parse-Swift.git",
"state" : {
"revision" : "8c7d8dce114571052d07516e8f4aef90891960aa",
"version" : "5.3.3"
"revision" : "a746db0bf4e9a2b3b33bc0a7f9dbcaf79feb0c8b",
"version" : "5.4.2"
}
},
{
"identity" : "parsecarekit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/netreconlab/ParseCareKit.git",
"state" : {
"revision" : "57aaabd1dfe0d038ffc40e95239b2445ed832d74",
"version" : "0.13.1"
"revision" : "566f68ef230e4285eb9e19a3d1045947d5a74eef",
"version" : "1.0.0-alpha.80"
}
},
{
"identity" : "swift-async-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-async-algorithms",
"state" : {
"revision" : "9cfed92b026c524674ed869a4ff2dcfdeedf8a2a",
"version" : "0.1.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version" : "1.0.4"
}
}
],
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 = "1400"
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91AD922624A4C42B00925D4D"
BuildableName = "OCKWatchSample.app"
BlueprintName = "OCKWatchSample"
ReferencedContainer = "container:OCKSample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E72B2C05226939E3009A9438"
BuildableName = "OCKSample.app"
BlueprintName = "OCKSample"
ReferencedContainer = "container:OCKSample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "8"
notificationPayloadFile = "OCKWatchSample Extension/Notifications/PushNotificationPayload.apns">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91AD922624A4C42B00925D4D"
BuildableName = "OCKWatchSample.app"
BlueprintName = "OCKWatchSample"
ReferencedContainer = "container:OCKSample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
launchAutomaticallySubstyle = "8"
notificationPayloadFile = "OCKWatchSample Extension/Notifications/PushNotificationPayload.apns">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91AD922624A4C42B00925D4D"
BuildableName = "OCKWatchSample.app"
BlueprintName = "OCKWatchSample"
ReferencedContainer = "container:OCKSample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
93 changes: 93 additions & 0 deletions OCKSample.xcodeproj/xcshareddata/xcschemes/OCKWatchSample.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91AD922624A4C42B00925D4D"
BuildableName = "OCKWatchSample.app"
BlueprintName = "OCKWatchSample"
ReferencedContainer = "container:OCKSample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E72B2C05226939E3009A9438"
BuildableName = "OCKSample.app"
BlueprintName = "OCKSample"
ReferencedContainer = "container:OCKSample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
notificationPayloadFile = "OCKWatchSample Extension/Notifications/PushNotificationPayload.apns">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91AD922624A4C42B00925D4D"
BuildableName = "OCKWatchSample.app"
BlueprintName = "OCKWatchSample"
ReferencedContainer = "container:OCKSample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91AD922624A4C42B00925D4D"
BuildableName = "OCKWatchSample.app"
BlueprintName = "OCKWatchSample"
ReferencedContainer = "container:OCKSample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
84 changes: 42 additions & 42 deletions OCKSample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,91 +38,91 @@ import WatchConnectivity

class AppDelegate: UIResponder, ObservableObject {
// MARK: Public read/write properties
@Published var isFirstTimeLogin = false {
willSet {
DispatchQueue.main.async {
self.objectWillChange.send()
}
}
}

@Published var isFirstTimeLogin = false

// MARK: Public read private write properties
// swiftlint:disable:next line_length
@Published private(set) var storeManager: OCKSynchronizedStoreManager = .init(wrapping: OCKStore(name: Constants.noCareStoreName,
type: .inMemory)) {

@Published private(set) var storeCoordinator: OCKStoreCoordinator = .init() {
willSet {
StoreManagerKey.defaultValue = newValue
DispatchQueue.main.async {
self.objectWillChange.send()
}
StoreCoordinatorKey.defaultValue = newValue
self.objectWillChange.send()
}
}
private(set) var parseRemote: ParseRemote!
private(set) var store: OCKStore?
@Published private(set) var store: OCKStore! = .init(name: Constants.noCareStoreName, type: .inMemory)
private(set) var healthKitStore: OCKHealthKitPassthroughStore!
private(set) var parseRemote: ParseRemote!

// MARK: Private read/write properties

private var sessionDelegate: SessionDelegate!
private lazy var watchRemote = OCKWatchConnectivityPeer()

// MARK: Helpers

@MainActor
func resetAppToInitialState() {
do {
try healthKitStore.reset()
try storeCoordinator.reset()
} catch {
Logger.appDelegate.error("Error deleting HealthKit Store: \(error)")
Logger.appDelegate.error("Could not delete Coordinator Store: \(error)")
}

do {
try store?.delete() // Delete data in local OCKStore database
try self.store?.delete()
} catch {
Logger.appDelegate.error("Error deleting OCKStore: \(error)")
Logger.utility.error("Could not delete local OCKStore because of error: \(error)")
}
storeManager = .init(wrapping: OCKStore(name: Constants.noCareStoreName, type: .inMemory))

storeCoordinator = .init()
healthKitStore = nil
parseRemote = nil
store = nil

let store = OCKStore(name: Constants.noCareStoreName,
type: .inMemory)
sessionDelegate.store = store
self.store = store
PCKUtility.removeCache()
}

@MainActor
func setupRemotes(uuid: UUID? = nil) async throws {
do {
if isSyncingWithCloud {
if isSyncingWithRemote {
guard let uuid = uuid else {
Logger.appDelegate.error("Error in setupRemotes, uuid is nil")
Logger.appDelegate.error("Could not setupRemotes, uuid is nil")
return
}
parseRemote = try await ParseRemote(uuid: uuid,
auto: false,
subscribeToServerUpdates: true,
defaultACL: try? ParseACL.defaultACL())
store = OCKStore(name: Constants.iOSParseCareStoreName,
type: .onDisk(),
remote: parseRemote)
subscribeToRemoteUpdates: true,
defaultACL: PCKUtility.getDefaultACL())
let store = OCKStore(name: Constants.iOSParseCareStoreName,
type: .onDisk(),
remote: parseRemote)
parseRemote?.parseRemoteDelegate = self
sessionDelegate = RemoteSessionDelegate(store: store)
self.store = store
} else {
store = OCKStore(name: Constants.iOSLocalCareStoreName,
type: .onDisk(),
remote: watchRemote)
let store = OCKStore(name: Constants.iOSLocalCareStoreName,
type: .onDisk(),
remote: watchRemote)
watchRemote.delegate = self
sessionDelegate = LocalSessionDelegate(remote: watchRemote, store: store)
self.store = store
}

// Setup communication with watch
WCSession.default.delegate = sessionDelegate
WCSession.default.activate()

guard let currentStore = store else {
Logger.appDelegate.error("Should have OCKStore")
return
}
healthKitStore = OCKHealthKitPassthroughStore(store: currentStore)
let coordinator = OCKStoreCoordinator()
coordinator.attach(store: currentStore)
coordinator.attach(eventStore: healthKitStore)
storeManager = OCKSynchronizedStoreManager(wrapping: coordinator)
healthKitStore = OCKHealthKitPassthroughStore(store: store)
let storeCoordinator = OCKStoreCoordinator()
storeCoordinator.attach(store: store)
storeCoordinator.attach(eventStore: healthKitStore)
self.storeCoordinator = storeCoordinator
} catch {
Logger.appDelegate.error("Error setting up remote: \(error)")
Logger.appDelegate.error("Could not setup remote: \(error)")
throw error
}
}
Expand Down
Loading