Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions sdk/src/main/java/com/qonversion/android/sdk/Qonversion.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package com.qonversion.android.sdk

import android.app.Activity
import android.content.Context
import android.net.Uri
import android.util.Log
import com.qonversion.android.sdk.dto.QAttributionProvider
import com.qonversion.android.sdk.dto.QPurchaseOptions
import com.qonversion.android.sdk.dto.QPurchaseResult
import com.qonversion.android.sdk.dto.QRemoteConfigFallbackValue
import com.qonversion.android.sdk.dto.products.QProduct
import com.qonversion.android.sdk.dto.properties.QUserPropertyKey
import com.qonversion.android.sdk.internal.InternalConfig
import com.qonversion.android.sdk.internal.QonversionInternal
import com.qonversion.android.sdk.internal.services.BundledRemoteConfigDefaults
import com.qonversion.android.sdk.listeners.QonversionEmptyCallback
import com.qonversion.android.sdk.listeners.QonversionExperimentAttachCallback
import com.qonversion.android.sdk.listeners.QDeferredPurchasesListener
Expand Down Expand Up @@ -49,6 +52,24 @@ interface Qonversion {
"the initialize method before accessing the shared instance of Qonversion."
)

/**
* Reads a Remote Config default directly from the generated asset bundled with the app.
*
* This synchronous API is independent of SDK initialization, networking, identity and
* caches. Put the generated `qonversion_remote_config_defaults.json` file in the app's
* `assets` directory and call this method with its logical [contextKey]. A non-null
* wrapper whose [QRemoteConfigFallbackValue.rawValue] is null represents a present JSON
* `null`; a null wrapper means the key is absent or the bundle failed strict validation.
*
* @param context any Android context used only to access the application asset.
* @param contextKey logical Remote Config key from the generated bundle.
*/
@JvmStatic
fun fallbackRemoteConfigValue(
context: Context,
contextKey: String,
): QRemoteConfigFallbackValue? = BundledRemoteConfigDefaults.value(context, contextKey)

/**
* An entry point to use Qonversion SDK. Call to initialize Qonversion SDK with required and extra configs.
* The function is the best way to set additional configs you need to use Qonversion SDK.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.qonversion.android.sdk.dto

/**
* A value read directly from the Remote Config defaults bundled with the app.
*
* [rawValue] is one of the JSON-compatible Kotlin values: [String], [Double],
* [Boolean], an immutable [List], an immutable [Map], or `null`. The wrapper
* itself remains non-null for a present JSON `null`, so callers can distinguish
* that value from a missing or invalid bundled key.
*/
class QRemoteConfigFallbackValue internal constructor(
val rawValue: Any?,
)
Loading
Loading