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

refactor: Migrate Internal Application context class to kotlin #511

Merged
merged 10 commits into from
Oct 31, 2024
Merged
1 change: 1 addition & 0 deletions android-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ android {
jvmArgs += ['--add-opens', 'java.base/java.text=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.math=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.util.concurrent.atomic=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.lang.ref=ALL-UNNAMED']
}
if (useOrchestrator()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class SessionMessagesTest : BaseCleanStartedEachTest() {
fun testSessionStartMessage() {
val sessionStartReceived = BooleanArray(1)
sessionStartReceived[0] = false
Assert.assertFalse(mAppStateManager.session.isActive)
Assert.assertFalse(mAppStateManager.fetchSession().isActive)
einsteinx2 marked this conversation as resolved.
Show resolved Hide resolved
val sessionId = AndroidUtils.Mutable<String?>(null)
mAppStateManager.ensureActiveSession()
sessionId.value = mAppStateManager.session.mSessionID
sessionId.value = mAppStateManager.fetchSession().mSessionID
AccessUtils.awaitMessageHandler()
MParticle.getInstance()?.upload()
mServer.waitForVerify(
Expand All @@ -45,14 +45,14 @@ class SessionMessagesTest : BaseCleanStartedEachTest() {
if (eventObject.getString("dt") == Constants.MessageType.SESSION_START) {
Assert.assertEquals(
eventObject.getLong("ct").toFloat(),
mAppStateManager.session.mSessionStartTime.toFloat(),
mAppStateManager.fetchSession().mSessionStartTime.toFloat(),
1000f
)
Assert.assertEquals(
"""started sessionID = ${sessionId.value}
current sessionId = ${mAppStateManager.session.mSessionID}
current sessionId = ${mAppStateManager.fetchSession().mSessionID}
sent sessionId = ${eventObject.getString("id")}""",
mAppStateManager.session.mSessionID,
mAppStateManager.fetchSession().mSessionID,
eventObject.getString("id")
)
sessionStartReceived[0] = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AppStateManagerInstrumentedTest : BaseCleanStartedEachTest() {
}
mAppStateManager?.ensureActiveSession()
for (mpid in mpids) {
mAppStateManager?.session?.addMpid(mpid)
mAppStateManager?.fetchSession()?.addMpid(mpid)
}
val checked = BooleanArray(1)
val latch: CountDownLatch = MPLatch(1)
Expand Down Expand Up @@ -72,7 +72,7 @@ class AppStateManagerInstrumentedTest : BaseCleanStartedEachTest() {
mpids.add(Constants.TEMPORARY_MPID)
mAppStateManager?.ensureActiveSession()
for (mpid in mpids) {
mAppStateManager?.session?.addMpid(mpid)
mAppStateManager?.fetchSession()?.addMpid(mpid)
}
val latch: CountDownLatch = MPLatch(1)
val checked = MutableBoolean(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class BatchSessionInfoTest : BaseCleanStartedEachTest() {

AccessUtils.awaitMessageHandler()
MParticle.getInstance()?.Internal()?.apply {
val sessionId = appStateManager.session.mSessionID
val sessionId = appStateManager.fetchSession().mSessionID
appStateManager.endSession()
appStateManager.ensureActiveSession()
InstallReferrerHelper.setInstallReferrer(mContext, "222")
assertNotEquals(sessionId, appStateManager.session.mSessionID)
assertNotEquals(sessionId, appStateManager.fetchSession().mSessionID)
}

var messageCount = 0
Expand Down
Loading
Loading