ProviderStore

class ProviderStore(context: Context, val presets: List<ProviderProfile> = ProviderProfile.Presets)(source)

Saved provider profiles (SharedPreferences) with their API keys and OAuth tokens kept encrypted in SecretStore; exposes the list and the selected profile as flows. presets (built in, the first one selected by default) are merged in on load, so new presets appear after an app update.

Constructors

Link copied to clipboard
constructor(context: Context, presets: List<ProviderProfile> = ProviderProfile.Presets)

Properties

Link copied to clipboard
Link copied to clipboard
val profiles: StateFlow<List<ProviderProfile>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val selectedId: StateFlow<String>
Link copied to clipboard
val tokenVersion: StateFlow<Int>

Functions

Link copied to clipboard
fun apiKey(id: String): String
Link copied to clipboard
fun remove(id: String)
Link copied to clipboard
fun reset(id: String)

Restore a built-in preset to its defaults (keeps its API key).

Link copied to clipboard
fun select(id: String)
Link copied to clipboard
fun setApiKey(id: String, key: String)
Link copied to clipboard
Link copied to clipboard

OAuth tokens for a signed-in profile, encrypted like API keys.

Link copied to clipboard
fun upsert(profile: ProviderProfile)