diff --git a/app/src/main/java/com/qonversion/android/app/App.java b/app/src/main/java/com/qonversion/android/app/App.java index 49e58aa7e..738031e21 100644 --- a/app/src/main/java/com/qonversion/android/app/App.java +++ b/app/src/main/java/com/qonversion/android/app/App.java @@ -35,11 +35,12 @@ public void onError(@NotNull QonversionError error) { } } ); - Qonversion.setProperty(QUserProperties.AppsFlyerUserId, AppsFlyerLib.getInstance().getAppsFlyerUID(this)); + AppsFlyerConversionListener conversionListener = new AppsFlyerConversionListener() { @Override public void onConversionDataSuccess(final Map conversionData) { + Qonversion.setProperty(QUserProperties.AppsFlyerUserId, AppsFlyerLib.getInstance().getAppsFlyerUID(App.this)); Qonversion.attribution(conversionData, AttributionSource.AppsFlyer); } diff --git a/gradle.properties b/gradle.properties index 65aa4ed99..e157c250f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,5 +20,5 @@ android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -libraryVersion = 2.1.0 +libraryVersion = 2.1.1 diff --git a/sdk/build.gradle b/sdk/build.gradle index 17a0cccf3..e6a67e86d 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -20,7 +20,7 @@ android { consumerProguardFiles 'consumer-rules.pro' group = 'com.qonversion.android.sdk' - version = '2.1.0' + version = '2.1.1' } buildTypes { @@ -56,10 +56,10 @@ bintray { name = 'com.qonversion.android.sdk' version { - name = '2.1.0' + name = '2.1.1' desc = 'qonversion-android-sdk' released = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZ", Locale.ENGLISH).format(new Date()) - vcsTag = '2.1.0' + vcsTag = '2.1.1' } licenses = ['MIT'] @@ -72,7 +72,7 @@ bintray { MyPublication(MavenPublication) { groupId 'com.qonversion.android.sdk' artifactId 'sdk' - version '2.1.0' + version '2.1.1' } } } @@ -102,7 +102,7 @@ ext { PUBLISH_GROUP_ID = 'com.qonversion.android.sdk' PUBLISH_ARTIFACT_ID = 'sdk' - PUBLISH_VERSION = '2.1.0' + PUBLISH_VERSION = '2.1.1' kotlinVersion = '1.3.61' moshiVersion = '1.9.2' diff --git a/sdk/src/main/java/com/qonversion/android/sdk/Qonversion.kt b/sdk/src/main/java/com/qonversion/android/sdk/Qonversion.kt index 73fdbce58..5bb5df056 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/Qonversion.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/Qonversion.kt @@ -13,7 +13,7 @@ import com.qonversion.android.sdk.validator.TokenValidator object Qonversion : LifecycleDelegate { - private const val SDK_VERSION = "2.1.0" + private const val SDK_VERSION = "2.1.1" private lateinit var repository: QonversionRepository private var userPropertiesManager: QUserPropertiesManager? = null diff --git a/sdk/src/main/java/com/qonversion/android/sdk/errors.kt b/sdk/src/main/java/com/qonversion/android/sdk/errors.kt index 637f4be4e..34e8a6530 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/errors.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/errors.kt @@ -47,14 +47,19 @@ fun Throwable.toQonversionError(): QonversionError { fun Response.toQonversionError(): QonversionError { val data = "data" val message = "message" - var errorMessage = "" + var errorMessage = "failed to parse the backend response" + errorBody()?.let { - val jsonObjError = JSONObject(it.string()) - if (jsonObjError.has(data)) { - val jsonObjData = jsonObjError.getJSONObject(data) - errorMessage += if (jsonObjData.has(message)) jsonObjData.getString(message) else "" - } + try { + val jsonObjError = JSONObject(it.string()) + if (jsonObjError.has(data)) { + val jsonObjData = jsonObjError.getJSONObject(data) + if (jsonObjData.has(message)) { + errorMessage = jsonObjData.getString(message) + } + } + } catch (e: JSONException) { } } return QonversionError(QonversionErrorCode.BackendError, "HTTP status code=${this.code()}, errorMessage=$errorMessage")