Skip to content

Use Event Horizon for application lifecycle#4943

Merged
MiSikora merged 1 commit intomainfrom
mehow/task/event-infra
Feb 25, 2026
Merged

Use Event Horizon for application lifecycle#4943
MiSikora merged 1 commit intomainfrom
mehow/task/event-infra

Conversation

@MiSikora
Copy link
Copy Markdown
Contributor

@MiSikora MiSikora commented Feb 3, 2026

Description

Relates to PCDROID-419
Closes PCDROID-420

Testing Instructions

  1. Install the app.
  2. Verify in logs that the application_installed event is triggered.
  3. Minimize the app.
  4. Verify in logs that the application_closed event is triggered.
  5. Maximize the app.
  6. Verify in logs that the application_opened event is triggered.
  7. Apply this patch.
curl -L https://github.com/user-attachments/files/25043607/version.patch | git apply
  1. Open the app.
  2. Verify in logs that the application_updated event is triggered.

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

I have tested any UI changes...

  • with different themes
  • with a landscape orientation
  • with the device set to have a large display and font size
  • for accessibility with TalkBack

@MiSikora MiSikora added this to the 8.6 milestone Feb 3, 2026
@MiSikora MiSikora requested a review from a team as a code owner February 3, 2026 10:59
@MiSikora MiSikora requested review from geekygecko and removed request for a team February 3, 2026 10:59
@MiSikora MiSikora added [Area] Analytics Analytics related issues [Type] Enhancement Improve an existing feature. labels Feb 3, 2026
@dangermattic
Copy link
Copy Markdown
Collaborator

dangermattic commented Feb 3, 2026

1 Warning
⚠️ Class EventSink is missing tests, but unit-tests-exemption label was set to ignore this.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Feb 3, 2026

Project dependencies changes

list
+ New Dependencies
com.automattic:eventhorizon:pocket-casts-068631373314a38e6adb54cd000fc1d1a74f86bd
tree
+\--- project :modules:features:account
+     \--- project :modules:features:search
+          \--- project :modules:services:analytics
+               \--- com.automattic:eventhorizon:pocket-casts-068631373314a38e6adb54cd000fc1d1a74f86bd
+                    \--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.3.10 (*)

@geekygecko
Copy link
Copy Markdown
Member

Is this the right patch file thread-crash.patch?

@MiSikora
Copy link
Copy Markdown
Contributor Author

MiSikora commented Feb 4, 2026

Is this the right patch file thread-crash.patch?

Whoops! Fixed.

@wpmobilebot wpmobilebot modified the milestones: 8.6, 8.7 Feb 16, 2026
@wpmobilebot
Copy link
Copy Markdown
Collaborator

Version 8.6 has now entered code-freeze, so the milestone of this PR has been updated to 8.7.

Copilot AI review requested due to automatic review settings February 25, 2026 07:27
@MiSikora MiSikora force-pushed the mehow/task/event-infra branch from 0abfa8b to 737683a Compare February 25, 2026 07:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates Pocket Casts’ application lifecycle analytics to Automattic’s Event Horizon by introducing an EventSink bridge and updating lifecycle tracking to use monotonic time.

Changes:

  • Added Event Horizon dependency and DI wiring (EventSink + singleton EventHorizon) in the analytics service.
  • Updated AppLifecycleAnalytics to emit Event Horizon lifecycle events and compute timeInApp via TimeSource.
  • Added a small analytics testing module (modules:services:analytics:testing) and moved/updated lifecycle unit tests accordingly.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
settings.gradle.kts Includes new :modules:services:analytics:testing module.
modules/services/utils/.../UtilsModule.kt Provides TimeSource.Monotonic via Hilt for timing calculations.
modules/services/analytics/testing/.../TestEventSink.kt Test-only sink capturing Event Horizon Trackable events.
modules/services/analytics/testing/build.gradle.kts Declares the new testing module and its Event Horizon dependency.
modules/services/analytics/src/test/.../AppLifecycleAnalyticsTest.kt New unit test validating lifecycle events via Event Horizon + TestTimeSource.
modules/services/analytics/.../di/AnalyticsModule.kt Provides EventSink and a singleton EventHorizon.
modules/services/analytics/.../EventSink.kt Implements the bridge from Event Horizon Trackable to existing Tracker + listeners.
modules/services/analytics/.../AppLifecycleAnalytics.kt Emits Event Horizon lifecycle events and computes elapsed time using TimeSource.
modules/services/analytics/.../AnalyticsLoggingListener.kt Filters out NoOpTracker entries from debug logging output.
modules/services/analytics/build.gradle.kts Adds Event Horizon + the new testing module as test dependency.
gradle/libs.versions.toml Adds the eventhorizon library coordinate.
app/src/test/.../AppLifecycleAnalyticsTest.kt Removes old app-module lifecycle analytics unit test.

@MiSikora MiSikora force-pushed the mehow/task/event-infra branch from 737683a to c6069fa Compare February 25, 2026 07:38
@MiSikora MiSikora merged commit b95e854 into main Feb 25, 2026
18 checks passed
@MiSikora MiSikora deleted the mehow/task/event-infra branch February 25, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Analytics Analytics related issues [Type] Enhancement Improve an existing feature. unit-tests-exemption

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants