Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansi-mParticle committed Oct 30, 2024
1 parent 09d8cfa commit e1c46cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ open class AppStateManager @JvmOverloads constructor(
if (launchAction == null) {
launchAction = activity.intent.action
}
if (activity.intent.extras != null && activity.intent.extras!!
.getBundle(Constants.External.APPLINK_KEY) != null
) {
if (activity.intent.extras?.getBundle(Constants.External.APPLINK_KEY) != null) {
val parameters = JSONObject()
try {
parameters.put(
Expand Down Expand Up @@ -238,7 +236,6 @@ open class AppStateManager @JvmOverloads constructor(
if (!mInitialized) {
initialize(null, null, null, null)
}
val session = session
session.mLastEventTime = System.currentTimeMillis()
if (!session.isActive) {
newSession()
Expand Down Expand Up @@ -301,7 +298,6 @@ open class AppStateManager @JvmOverloads constructor(
}

fun shouldEndSession(): Boolean {
val session = session
val instance = MParticle.getInstance()
return (
0L != session?.mSessionStartTime &&
Expand Down Expand Up @@ -428,7 +424,7 @@ open class AppStateManager @JvmOverloads constructor(
MPUtility.getAdIdInfo(MParticle.getInstance()?.Internal()?.appStateManager?.mContext)
val currentAdId =
(if (adIdInfo == null) null else (if (adIdInfo.isLimitAdTrackingEnabled) null else adIdInfo.id))
val previousAdId = configManager!!.previousAdId
val previousAdId = configManager?.previousAdId
if (currentAdId != null && currentAdId != previousAdId) {
val instance = MParticle.getInstance()
if (instance != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,18 @@ open class ApplicationContextWrapper(private val mBaseApplication: Application)
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
override fun run() {
if (callback != null && mActivityLifecycleCallbackRecorder != null && isReplayActivityLifecycle) {
val reference = if (MParticle.getInstance()!!
.Internal().kitManager == null
val reference = if (MParticle.getInstance()?.Internal()?.kitManager == null
) {
null
} else {
MParticle.getInstance()!!
.Internal().kitManager.currentActivity
MParticle.getInstance()?.Internal()?.kitManager?.currentActivity
}
if (reference != null) {
val currentActivity = reference.get()
if (currentActivity != null) {
val recordedLifecycleList: LinkedList<LifeCycleEvent> =
mActivityLifecycleCallbackRecorder!!.recordedLifecycleListCopy
mActivityLifecycleCallbackRecorder?.recordedLifecycleListCopy
?: LinkedList()
while (recordedLifecycleList.size > 0) {
val lifeCycleEvent = recordedLifecycleList.removeFirst()
if (lifeCycleEvent.activityRef != null) {
Expand Down Expand Up @@ -323,10 +322,12 @@ open class ApplicationContextWrapper(private val mBaseApplication: Application)

MethodType.ON_SAVE_INSTANCE_STATE -> {
Logger.debug("Forwarding OnSaveInstance")
callback.onActivitySaveInstanceState(
recordedActivity,
lifeCycleEvent.bundle!!
)
lifeCycleEvent.bundle?.let {
callback.onActivitySaveInstanceState(
recordedActivity,
it
)
}
}

MethodType.ON_STOPPED -> {
Expand Down

0 comments on commit e1c46cf

Please sign in to comment.