Skip to content

Commit

Permalink
Rename cleanUp to signOut
Browse files Browse the repository at this point in the history
  • Loading branch information
andersio committed Feb 23, 2024
1 parent 93ad906 commit 0d6a967
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Examples/iOS/Settings/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ let settingsReducer = Reducer<Settings.State, Settings.Action, Settings.Environm

case .resetSDK:
return .task {
await VitalHealthKitClient.shared.cleanUp()
await VitalClient.shared.signOut()
return .didResetSDK
}

Expand Down
9 changes: 7 additions & 2 deletions Sources/VitalCore/Core/Client/VitalClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public let health_secureStorageKey: String = "health_secureStorageKey"
.filter { $0 == .userNoLongerValid }
.sink { _ in
Task {
await client.cleanUp()
await client.signOut()
}
}
.store(in: &client.cancellables)
Expand Down Expand Up @@ -563,8 +563,13 @@ public let health_secureStorageKey: String = "health_secureStorageKey"

storage.storeConnectedSource(for: userId, with: provider)
}


@available(*, deprecated, message:"Renamed to `signOut()`.", renamed: "signOut")
public func cleanUp() async {
await signOut()
}

public func signOut() async {
/// Here we remove the following:
/// 1) Anchor values we are storing for each `HKSampleType`.
/// 2) Stage for each `HKSampleType`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/VitalHealthKit/HealthKit/HealthKitReads.swift
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func handleBody(
type: .quantityType(forIdentifier: .bodyMass)!
)

var (bodyFatPercentage, bodyFatPercentageAnchor) = try await queryQuantities(
let (bodyFatPercentage, bodyFatPercentageAnchor) = try await queryQuantities(
type: .quantityType(forIdentifier: .bodyFatPercentage)!
)

Expand Down
5 changes: 3 additions & 2 deletions Sources/VitalHealthKit/HealthKit/VitalHealthKitClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,10 @@ extension VitalHealthKitClient {
_status.send(.syncingCompleted)
}
}


@available(*, deprecated, message: "Use `VitalClient.shared.signOut()`, which now resets both the Vital Core and Health SDKs.")
public func cleanUp() async {
await VitalClient.shared.cleanUp()
await VitalClient.shared.signOut()
}

private func resetAutoSync() async {
Expand Down

0 comments on commit 0d6a967

Please sign in to comment.