Skip to content

MOBILE-78: Add MindboxLifecycleInitializer#709

Open
enotniy wants to merge 4 commits into
developfrom
feature/MOBILE-78
Open

MOBILE-78: Add MindboxLifecycleInitializer#709
enotniy wants to merge 4 commits into
developfrom
feature/MOBILE-78

Conversation

@enotniy
Copy link
Copy Markdown
Collaborator

@enotniy enotniy commented Apr 30, 2026

Copilot AI review requested due to automatic review settings April 30, 2026 19:10
Copy link
Copy Markdown

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

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/register LifecycleManager early.
  • Refactor Mindbox.initialize to reuse the startup-created LifecycleManager and attach callbacks after init.
  • Make LifecycleManager callbacks 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.

Comment thread sdk/src/test/java/cloud/mindbox/mobile_sdk/managers/LifecycleManagerTest.kt Outdated
Copilot AI review requested due to automatic review settings May 14, 2026 13:56
Copy link
Copy Markdown

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@enotniy enotniy force-pushed the feature/MOBILE-78 branch from 40487c9 to 2639d27 Compare May 15, 2026 14:46
Copy link
Copy Markdown

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Comment thread sdk/src/main/java/cloud/mindbox/mobile_sdk/Mindbox.kt
Copilot AI review requested due to automatic review settings May 19, 2026 14:02
Copy link
Copy Markdown

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

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

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() }
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

душнила

Comment on lines +155 to +160
sendTrackVisit(intent ?: return@loggingRunCatching)
}
return@loggingRunCatching
}

sendTrackVisit(activity.intent, areActivitiesEqual)
sendTrackVisit(intent ?: return@loggingRunCatching, sameActivity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants