diff --git a/build.gradle b/build.gradle index 7dc0e169..554a69c5 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask buildscript { ext { release = [ - versionName: "7.3.1", + versionName: "7.3.2", versionCode: 1 ] } diff --git a/fastlane/report.xml b/fastlane/report.xml index 04dcadb6..ec6e6840 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,7 +5,7 @@ - + diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/QRemoteConfigManager.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/QRemoteConfigManager.kt index 9cd835f1..4d537b65 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/QRemoteConfigManager.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/QRemoteConfigManager.kt @@ -22,12 +22,27 @@ internal class QRemoteConfigManager @Inject constructor( var isInProgress: Boolean = false ) + internal class ListRequestData( + val callback: QonversionRemoteConfigListCallback, + val contextKeys: List? = null, + val includeEmptyContextKey: Boolean = false + ) + lateinit var userStateProvider: UserStateProvider private var loadingStates = mutableMapOf() + private val listRequests = mutableListOf() fun handlePendingRequests() { loadingStates.filter { it.value.callbacks.isNotEmpty() } .keys.forEach { contextKey -> loadRemoteConfig(contextKey, null) } + + listRequests.forEach { requestData -> + requestData.contextKeys?.let { + loadRemoteConfigList(it, requestData.includeEmptyContextKey, requestData.callback) + } ?: run { + loadRemoteConfigList(requestData.callback) + } + } } fun userChangingRequestFailedWithError(error: QonversionError) { @@ -86,6 +101,11 @@ internal class QRemoteConfigManager @Inject constructor( return } + if (!userStateProvider.isUserStable) { + listRequests.add(ListRequestData(callback, contextKeys, includeEmptyContextKey)) + return + } + remoteConfigService.loadRemoteConfigs( contextKeys, includeEmptyContextKey, @@ -94,6 +114,11 @@ internal class QRemoteConfigManager @Inject constructor( } fun loadRemoteConfigList(callback: QonversionRemoteConfigListCallback) { + if (!userStateProvider.isUserStable) { + listRequests.add(ListRequestData(callback)) + return + } + remoteConfigService.loadRemoteConfigs(getRemoteConfigListCallbackWrapper(callback)) }