Unofficial Dioxus bridge for Qonversion Subscription Management Mode.
Mobile only for now (iOS and Android). Web and desktop are out of scope. Qonversion’s own Web SDK covers browser checkout (Stripe/Paddle); this crate does not wrap it.
This crate is not affiliated with Qonversion.
Early — the public API is not stable yet. See the roadmap.
Dioxus UI (Rust)
→ dioxus-qonversion (Rust API)
→ Kotlin host (Android) / Swift host (iOS)
→ Qonversion SDK + No-Codes SDK
→ App Store / Play Store
Native calls go through a thin host — Kotlin on Android (auto-bundled by Dioxus CLI 0.7+), ObjC-visible Swift on iOS — not UniFFI.
| Layer | Owns |
|---|---|
| Library | Qonversion primitives (init, identify, logout, paywall, …), serial SDK queue + default timeout |
| App | Project key, stable user id, Remote Config field names, gating UI, fail-open vs fail-closed policy |
Call once before any other library API. The project key comes from the app (never hardcode it in a library).
use dioxus_qonversion::{initialize, Environment, InitConfig, LaunchMode};
initialize(InitConfig {
project_key: std::env::var("QONVERSION_PROJECT_KEY").expect("set QONVERSION_PROJECT_KEY"),
environment: Environment::Sandbox, // Production for store releases
launch_mode: LaunchMode::SubscriptionManagement,
})?;Double-init returns a typed error. Desktop / web builds return UnsupportedPlatform.
After init (and after your app session restore / sign-in), map a stable app user id into Qonversion so purchases attach to that user. Use your auth provider uid — not an ephemeral session token.
use dioxus_qonversion::{identify, logout};
// Prefer calling from Dioxus `spawn` / a background thread (blocking wait).
identify(firebase_uid)?;
// On sign-out:
logout()?;Both identify / logout and Remote Config go through one serial SDK queue with a default 8s timeout (DEFAULT_SDK_TIMEOUT, override with set_sdk_timeout). Timing out returns QonversionError::Timeout and does not cancel native work — the worker still finishes before the next queued call. show_screen stays fire-and-present and is not on this queue.
If identify fails or times out, anonymous paywalls can still work. Fail-open vs fail-closed is app policy — this crate does not decide. The library also does not memoize Remote Config; clear any app-side caches yourself after logout.
After init, fetch the JSON payload for any dashboard context key. Field names inside the payload stay app-owned — this crate does not interpret them.
use dioxus_qonversion::{remote_config, remote_config_default};
// Prefer calling from Dioxus `spawn` / a background thread (blocking wait).
let config = remote_config("your_context_key")?;
let payload = &config.payload;
// Empty dashboard context key (SDK default overload):
let default = remote_config_default()?;Same serial SDK queue and 8s timeout as identify / logout. An empty payload map is success; SDK failures are QonversionError::Native or Timeout. source and experiment are present when the SDK assigned this payload from a remote config or A/B experiment.
After init, present any published screen by its context key (from the Qonversion dashboard). The key is always an app parameter — this crate never hardcodes screen names.
use dioxus_qonversion::show_screen;
show_screen("your_context_key")?;This is fire-and-present: it returns once the native SDK has been asked to show the screen, not when the user dismisses it. Finished / failed-to-load callbacks come in a later milestone.
- Depend on this crate (
cargo add dioxus-qonversion/ git path). - Build with Dioxus CLI 0.7+ (
dx). The crate ships a Gradle library underandroid/and emits manganis Android artifact metadata sodxembeds the Kotlin host automatically — no copy/paste of Kotlin. - The plugin module already depends on
io.qonversion:no-codes. You may still list it inDioxus.tomlgradle_dependenciesif you want an explicit app-level pin; it is not required for the host class itself.
Context is taken from ndk_context (initialized by Dioxus / wry).
Fallback (non-dx / older CLI): compile android/src/main/kotlin/io/dioxus/qonversion/DioxusQonversionHost.kt into your Android target and add implementation("io.qonversion:no-codes:1.+"). Same idea as the iOS Swift host note below — not the happy path.
- Add the Qonversion iOS SDK via Swift Package Manager (≥ 6.13.0 for No-Codes).
- Compile
ios/DioxusQonversionHost.swiftfrom this crate into your Dioxus iOS target (copy or path reference in Xcode / yourdxmobile project).
Licensed under either of
at your option.