Skip to content
Merged
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
8 changes: 5 additions & 3 deletions sdk/src/main/java/cloud/mindbox/mobile_sdk/Mindbox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ object Mindbox : MindboxLog {

private val mutex = Mutex()

private val inAppMutex = Mutex()

private var firstInitCall: Boolean = true

/**
Expand Down Expand Up @@ -522,7 +524,7 @@ object Mindbox : MindboxLog {
if (activity != null && lifecycleManager.isCurrentActivityResumed) {
inAppMessageManager.registerCurrentActivity(activity)
mindboxScope.launch {
mutex.withLock {
inAppMutex.withLock {
firstInitCall = false
inAppMessageManager.listenEventAndInApp()
inAppMessageManager.initLogs()
Expand Down Expand Up @@ -576,8 +578,8 @@ object Mindbox : MindboxLog {
)
if (firstInitCall) {
mindboxScope.launch {
mutex.withLock {
InitializeLock.await(InitializeLock.State.SAVE_MINDBOX_CONFIG)
InitializeLock.await(InitializeLock.State.SAVE_MINDBOX_CONFIG)
inAppMutex.withLock {
if (!firstInitCall) return@launch
firstInitCall = false
inAppMessageManager.listenEventAndInApp()
Expand Down