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

Rename methods in ActivityLifecycleListenerInterface to match lifecycle methods #1123

Merged
merged 1 commit into from
Jul 26, 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
*
* @param activity details of the activity
*/
public fun onView(activity: Activity) {}
public fun onActivityStarted(activity: Activity) {}

Check warning on line 16 in embrace-android-core/src/main/kotlin/io/embrace/android/embracesdk/internal/session/lifecycle/ActivityLifecycleListener.kt

View check run for this annotation

Codecov / codecov/patch

embrace-android-core/src/main/kotlin/io/embrace/android/embracesdk/internal/session/lifecycle/ActivityLifecycleListener.kt#L16

Added line #L16 was not covered by tests

/**
* Triggered when an activity is closed.
*
* @param activity details of the activity
*/
public fun onViewClose(activity: Activity) {}
public fun onActivityStopped(activity: Activity) {}

Check warning on line 23 in embrace-android-core/src/main/kotlin/io/embrace/android/embracesdk/internal/session/lifecycle/ActivityLifecycleListener.kt

View check run for this annotation

Codecov / codecov/patch

embrace-android-core/src/main/kotlin/io/embrace/android/embracesdk/internal/session/lifecycle/ActivityLifecycleListener.kt#L23

Added line #L23 was not covered by tests

/**
* Triggered when an activity is created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ internal class EmbraceBreadcrumbService(
}
}

override fun onView(activity: Activity) {
override fun onActivityStarted(activity: Activity) {
if (configService.breadcrumbBehavior.isAutomaticActivityCaptureEnabled()) {
logView(activity.javaClass.name, clock.now())
}
Expand All @@ -105,7 +105,7 @@ internal class EmbraceBreadcrumbService(
/**
* Close all open fragments when the activity closes
*/
override fun onViewClose(activity: Activity) {
override fun onActivityStopped(activity: Activity) {
if (configService.breadcrumbBehavior.isAutomaticActivityCaptureEnabled()) {
dataSourceModuleProvider()?.viewDataSource?.dataSource?.onViewClose()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal class ActivityLifecycleTracker(
updateStateWithActivity(activity)
stream(listeners) { listener: ActivityLifecycleListener ->
try {
listener.onView(activity)
listener.onActivityStarted(activity)
} catch (ex: Exception) {
logger.logWarning(ERROR_FAILED_TO_NOTIFY)
logger.trackInternalError(InternalErrorType.ACTIVITY_LISTENER_FAIL, ex)
Expand All @@ -104,7 +104,7 @@ internal class ActivityLifecycleTracker(
override fun onActivityStopped(activity: Activity) {
stream(listeners) { listener: ActivityLifecycleListener ->
try {
listener.onViewClose(activity)
listener.onActivityStopped(activity)
} catch (ex: Exception) {
logger.logWarning(ERROR_FAILED_TO_NOTIFY)
logger.trackInternalError(InternalErrorType.ACTIVITY_LISTENER_FAIL, ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal class ActivityLifecycleTrackerTest {

activityLifecycleTracker.onActivityStarted(mockActivity)

verify { mockActivityLifecycleListener.onView(mockActivity) }
verify { mockActivityLifecycleListener.onActivityStarted(mockActivity) }
assertEquals(mockActivity, activityLifecycleTracker.foregroundActivity)
}

Expand Down Expand Up @@ -153,7 +153,7 @@ internal class ActivityLifecycleTrackerTest {

activityLifecycleTracker.onActivityStopped(mockActivity)

verify { mockActivityLifecycleListener.onViewClose(mockActivity) }
verify { mockActivityLifecycleListener.onActivityStopped(mockActivity) }
}

@Test
Expand Down