For the complete documentation index, see llms.txt. This page is also available as Markdown.

Update Thryve SDK and module configs

After the SDK is initialized with getOrCreate, you can change credentials, locale, identity, or module settings without restarting the app.

There are two APIs:

API
Use when

updateSDKConfig

You need to change top-level SDK fields and/or multiple modules together

updateModuleConfig

You only need to update one module (for example device events listener, Shen AI listener, or observability).

Update ThryveSDKConfig at runtime using updateSDKConfig

private func makeFullSDKConfig(endUserId: String?, endUserAlias: String?) -> ThryveSDKConfig {
    let credentials = partnerInfo.resolvedCredentialPair()
    let backgroundSyncEnabled = UserDefaults.standard.bool(forKey: AppleHealthViewModel.bgSyncKey)
    return ThryveSDKConfig(
        authId: credentials.authId,
        authSecret: credentials.authSecret,
        endUserAlias: endUserAlias,
        endUserId: endUserId,
        locale: partnerInfo.language == "none" ? nil : partnerInfo.language,
        configs: [
            ThryveAppleHealthConfig(
                dataTypes: ThryveAppleHealthDataType.allConnectorTypes,
                enableBackgroundSync: backgroundSyncEnabled
            ),
            ThryveShenAIConfig(apiKey: Environment.shenAIApiKey)
        ],
        observability: ObservabilityConfig(
            tracingEnabled: observabilityEnabled,
            crashReportingEnabled: crashReportingEnabled
        )
    )
}

UpdateModuleConfig at runtime

Which API should I call?

  1. Changing locale, auth, end-user identity, or several modules → updateSDKConfig(fullConfig)

  2. Changing one module listener / one module setting → updateModuleConfig(...)

  3. Changing end-user identity in a way that requires a clean re-init → getOrCreate(fullConfig) again

Last updated