diff --git a/build.gradle b/build.gradle index 9111bbea..e0174107 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask buildscript { ext { release = [ - versionName: "7.0.0", + versionName: "7.1.0", versionCode: 1 ] } diff --git a/fastlane/report.xml b/fastlane/report.xml index 4b1059ca..2ffb37cd 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,7 +5,7 @@ - + diff --git a/sdk/src/main/java/com/qonversion/android/sdk/dto/properties/QUserPropertyKey.kt b/sdk/src/main/java/com/qonversion/android/sdk/dto/properties/QUserPropertyKey.kt index d7d907d7..778831ef 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/dto/properties/QUserPropertyKey.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/dto/properties/QUserPropertyKey.kt @@ -11,6 +11,10 @@ enum class QUserPropertyKey(val userPropertyCode: String) { FirebaseAppInstanceId("_q_firebase_instance_id"), AppSetId("_q_app_set_id"), AdvertisingId("_q_advertising_id"), // iOS only + AppMetricaDeviceId("_q_appmetrica_device_id"), + AppMetricaUserProfileId("_q_appmetrica_user_profile_id"), + PushWooshHwId("_q_pushwoosh_hwid"), + PushWooshUserId("_q_pushwoosh_user_id"), Custom(""); companion object { diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/QProductCenterManager.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/QProductCenterManager.kt index 4e9315f6..0009f57d 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/QProductCenterManager.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/QProductCenterManager.kt @@ -856,7 +856,7 @@ internal class QProductCenterManager internal constructor( onSuccess: (permissions: Map) -> Unit, onError: (QonversionError) -> Unit ) { - if (launchError != null || unhandledLogoutAvailable) { + fun actualizePermissions() { retryLaunch( onSuccess = { launchResult -> onSuccess(launchResult.permissions) @@ -869,9 +869,25 @@ internal class QProductCenterManager internal constructor( onSuccess(it) } ?: onError(error) }) - } else { - val permissions = launchResultCache.getActualPermissions() ?: emptyMap() + } + + if (launchError != null || unhandledLogoutAvailable) { + actualizePermissions() + return + } + + val permissions = launchResultCache.getActualPermissions() ?: emptyMap() + + val nowMs = System.currentTimeMillis() + val permissionsAreActual = permissions.none { + val expirationTs = it.value.expirationDate?.time ?: Long.MAX_VALUE + it.value.isActive() && expirationTs < nowMs + } + + if (permissionsAreActual) { onSuccess(permissions) + } else { + actualizePermissions() } }