MOBILE-78: Add MindboxLifecycleInitializer#709
Open
enotniy wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces an androidx.startup initializer to register LifecycleManager at app startup so lifecycle tracking can begin before Mindbox.init, and refactors Mindbox.init to attach callbacks to the pre-created manager when present.
Changes:
- Add
MindboxLifecycleInitializer(AndroidX Startup) and manifest wiring to initialize/registerLifecycleManagerearly. - Refactor
Mindbox.initializeto reuse the startup-createdLifecycleManagerand attach callbacks after init. - Make
LifecycleManagercallbacks nullable/settable post-construction; add Robolectric tests for initializer/manager behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/src/main/java/cloud/mindbox/mobile_sdk/managers/MindboxLifecycleInitializer.kt | New Startup initializer creating/registering LifecycleManager in main process. |
| sdk/src/main/java/cloud/mindbox/mobile_sdk/managers/LifecycleManager.kt | Switch constructor-injected callbacks to nullable properties; add internal static instance. |
| sdk/src/main/java/cloud/mindbox/mobile_sdk/Mindbox.kt | Refactor init flow to reuse startup manager and attach lifecycle callbacks separately. |
| sdk/src/main/AndroidManifest.xml | Merge metadata into InitializationProvider to run the initializer. |
| sdk/build.gradle | Add AndroidX Startup runtime dependency. |
| gradle/libs.versions.toml | Add version/catalog entry for androidx.startup. |
| sdk/src/test/java/cloud/mindbox/mobile_sdk/managers/MindboxLifecycleInitializerTest.kt | New tests for initializer main/non-main process behavior and background initialization. |
| sdk/src/test/java/cloud/mindbox/mobile_sdk/managers/LifecycleManagerTest.kt | New tests for LifecycleManager callback safety and track-visit behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
40487c9 to
2639d27
Compare
2639d27 to
70913b0
Compare
sergeysozinov
approved these changes
May 19, 2026
Comment on lines
+651
to
+659
| controller.executeOnViewThread { inAppController.close() } | ||
| } | ||
| } ?: run { | ||
| inAppFailureTracker.sendFailureWithContext( | ||
| inAppId = wrapper.inAppType.inAppId, | ||
| failureReason = FailureReason.WEBVIEW_LOAD_FAILED, | ||
| errorDescription = "WebView content URL is null" | ||
| ) | ||
| inAppController.close() | ||
| controller.executeOnViewThread { inAppController.close() } |
Comment on lines
+155
to
+160
| sendTrackVisit(intent ?: return@loggingRunCatching) | ||
| } | ||
| return@loggingRunCatching | ||
| } | ||
|
|
||
| sendTrackVisit(activity.intent, areActivitiesEqual) | ||
| sendTrackVisit(intent ?: return@loggingRunCatching, sameActivity) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://tracker.yandex.ru/MOBILE-78