Skip to main content

Migration: New version SDK 4.x.x

Initialization

The method public func initRook() has been removed, depending on your current implementation it can be replaced with one of the following options:

public func initRook(completion: @escaping (Result<Bool, Error>) -> Void) 
public func initRook() async throws -> Bool

example:

func setupRook() {
guard let uuid: String = Bundle.main.object(forInfoDictionaryKey: "CLIENT_UUID") as? String,
let secret: String = Bundle.main.object(forInfoDictionaryKey: "SECRET_KEY") as? String else { return }
RookConnectConfigurationManager.shared.setEnvironment(.sandbox)
RookConnectConfigurationManager.shared.setConsoleLogAvailable(true)
RookConnectConfigurationManager.shared.setConfiguration(
clientUUID: uuid,
secretKey: secret,
enableBackgroundSync: true,
enableEventsBackgroundSync: true)
RookConnectConfigurationManager.shared.initRook { result in
switch result {
case .success(let initResult):
debugPrint("init result rook SDK \(initResult)")
case .failure(let error):
debugPrint("Error Init SDK \(error)")
}
}
RookBackGroundSync.shared.setBackListeners()
}

User

The method public func clearUser(completion: @escaping (Result<Bool, Error>) -> Void) has been removed, the method public func removeUserFromRook(completion: @escaping (Result<Bool, Error>) -> Void) can be used to replace it.

Permissions

All the methods to request permissions have bee replaced by public func requestPermissions(_ permissions: [HealthDataType]?, completion: @escaping (Result<Bool, Error>) -> Void) it allow to request a custom list of permissions or pass a null value to request all of them.

Manual Sync

Background sync