-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attach lifecycle listeners internally in initialize method (#131)
* Internalize the lifecycle listener attachment. * Mark the public property to be deprecated and replace with a no-op implementation to avoid duplicate listeners. * Update readme instructions, migration guide. --------- Co-authored-by: Evan Masseau <>
- Loading branch information
1 parent
1500879
commit e9598b0
Showing
7 changed files
with
77 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
sdk/core/src/main/java/com/klaviyo/core/lifecycle/NoOpLifecycleCallbacks.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.klaviyo.core.lifecycle | ||
|
||
import android.app.Activity | ||
import android.app.Application | ||
import android.os.Bundle | ||
|
||
/** | ||
* A no-op implementation of ActivityLifecycleCallbacks | ||
* to temporarily replace the public property Klaviyo.lifecycleCallbacks | ||
* and prevent duplicate registration of the KlaviyoLifecycleMonitor | ||
* until next major release when we can make the breaking change to remove that public property | ||
*/ | ||
object NoOpLifecycleCallbacks : Application.ActivityLifecycleCallbacks { | ||
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {} | ||
override fun onActivityStarted(activity: Activity) {} | ||
override fun onActivityResumed(activity: Activity) {} | ||
override fun onActivityPaused(activity: Activity) {} | ||
override fun onActivityStopped(activity: Activity) {} | ||
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {} | ||
override fun onActivityDestroyed(activity: Activity) {} | ||
} |