Skip to content

Commit a9e608f

Browse files
authored
Fix App Launched event in CT (#521)
1 parent d2954ae commit a9e608f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

AndroidSDKCore/src/main/java/com/leanplum/Leanplum.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,8 @@ public void noPendingDownloads() {
657657
}
658658
});
659659

660+
MigrationManager.updateWrapper(); // create CT object to track App Launched correctly
661+
660662
// Reduce latency by running the rest of the start call in a background thread.
661663
OperationQueue.sharedInstance().addParallelOperation(new Runnable() {
662664
@Override
@@ -752,6 +754,9 @@ private static void startHelper(
752754
}
753755
APIConfig.getInstance().setUserId(userId);
754756

757+
// If wrapper has already been initialised it would update it with correct userId.
758+
MigrationManager.getWrapper().setUserId(userId);
759+
755760
String locale = Util.getLocale();
756761
if (!TextUtils.isEmpty(customLocale)) {
757762
locale = customLocale;

AndroidSDKCore/src/main/java/com/leanplum/migration/wrapper/WrapperFactory.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ package com.leanplum.migration.wrapper
2323

2424
import com.leanplum.Leanplum
2525
import com.leanplum.callbacks.CleverTapInstanceCallback
26-
import com.leanplum.internal.Constants
2726
import com.leanplum.internal.LeanplumInternal
27+
import com.leanplum.internal.Log
2828
import com.leanplum.migration.model.MigrationConfig
29+
import kotlin.system.measureTimeMillis
2930

3031
internal object WrapperFactory {
3132

@@ -51,7 +52,10 @@ internal object WrapperFactory {
5152
}
5253

5354
return CTWrapper(account, token, region, deviceId, userId).apply {
54-
launch(context, callback)
55+
val timeToLaunch = measureTimeMillis {
56+
launch(context, callback)
57+
}
58+
Log.d("Wrapper: launch took $timeToLaunch millis")
5559
}
5660
}
5761

0 commit comments

Comments
 (0)