Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMA/GMA] Fix race condition in adapters where we reported initialized too early #87

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.uid2.dev

import android.app.Application
import android.util.Log
import com.uid2.UID2Manager

class GMADevApplication : Application() {

override fun onCreate() {
super.onCreate()

// Initialise the UID2Manager class. We will use it's DefaultNetworkSession rather than providing our own
// custom implementation. This can be done to allow wrapping something like OkHttp.
try {
UID2Manager.init(
context = this,
isLoggingEnabled = true,
)
} catch (ex: Exception) {
Log.e("IMADevApplication", "Error initialising UID2Manager", ex)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public class UID2MediationAdapter : RtbAdapter() {
UID2Manager.init(context)
}

initializationCompleteCallback.onInitializationSucceeded()
// After we've asked to initialize the manager, we should wait until it's complete before reporting success.
// This will potentially allow any previously persisted identity to be fully restored before we allow any
// signals to be collected.
UID2Manager.getInstance().onInitialized = initializationCompleteCallback::onInitializationSucceeded
}

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.uid2.dev

import android.app.Application
import android.util.Log
import com.uid2.UID2Manager

class IMADevApplication : Application() {

override fun onCreate() {
super.onCreate()

// Initialise the UID2Manager class. We will use it's DefaultNetworkSession rather than providing our own
// custom implementation. This can be done to allow wrapping something like OkHttp.
try {
UID2Manager.init(
context = this,
isLoggingEnabled = true,
)
} catch (ex: Exception) {
Log.e("IMADevApplication", "Error initialising UID2Manager", ex)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public class UID2SecureSignalsAdapter : SecureSignalsAdapter {
UID2Manager.init(context)
}

callback.onSuccess()
// After we've asked to initialize the manager, we should wait until it's complete before reporting success.
// This will potentially allow any previously persisted identity to be fully restored before we allow any
// signals to be collected.
UID2Manager.getInstance().onInitialized = callback::onSuccess
}

/**
Expand Down
Loading