Skip to content

Commit

Permalink
Merge pull request #161 from qonversion/release/2.9.1
Browse files Browse the repository at this point in the history
Release/2.9.1
  • Loading branch information
Maria-Bordunova authored Jun 23, 2021
2 parents f4bb3ab + 540cdaf commit 4273d3c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
buildscript {
ext {
release = [
versionName: "2.9.0",
versionName: "2.9.1",
versionCode: 1
]
}
Expand Down
14 changes: 13 additions & 1 deletion sdk/src/main/java/com/qonversion/android/sdk/Qonversion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.qonversion.android.sdk

import android.app.Activity
import android.app.Application
import android.os.Handler
import android.os.Looper
import androidx.lifecycle.ProcessLifecycleOwner
import com.android.billingclient.api.BillingFlowParams
import com.google.firebase.messaging.RemoteMessage
Expand All @@ -18,10 +20,11 @@ object Qonversion : LifecycleDelegate {
private var automationsManager: QAutomationsManager? = null
private var logger = ConsoleLogger()
private var isDebugMode = false
private val handler = Handler(Looper.getMainLooper())

init {
val lifecycleHandler = AppLifecycleHandler(this)
ProcessLifecycleOwner.get().lifecycle.addObserver(lifecycleHandler)
postToMainThread { ProcessLifecycleOwner.get().lifecycle.addObserver(lifecycleHandler) }
}

override fun onAppBackground() {
Expand Down Expand Up @@ -371,6 +374,15 @@ object Qonversion : LifecycleDelegate {
internal fun logLaunchErrorForFunctionName(functionName: String?) {
logger.release("$functionName function can not be executed. It looks like launch was not called.")
}

// Private functions
private fun postToMainThread(runnable: () -> Unit) {
if (Looper.myLooper() == Looper.getMainLooper()) {
runnable()
} else {
handler.post(runnable)
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ class AppModule(
}

companion object {
private const val SDK_VERSION = "2.9.0"
private const val SDK_VERSION = "2.9.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.qonversion.android.sdk.services

import com.qonversion.android.sdk.Constants
import com.qonversion.android.sdk.storage.SharedPreferencesCache
import com.qonversion.android.sdk.storage.TokenStorage
import io.mockk.*
import junit.framework.Assert.assertEquals
import org.junit.Assert.assertEquals
import org.assertj.core.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Nested
Expand Down

0 comments on commit 4273d3c

Please sign in to comment.