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

Fix session start data issue #253

Merged
merged 5 commits into from
Jan 28, 2025
Merged

Conversation

didiergarcia
Copy link
Contributor

We identified an issue with data loss that would occur when the host app would startup with no internet connection.

In these circumstances the SDK would not be able to download a valid Settings object and would not use either a good default or fallback to the previous known good Settings object.

This fix address various issues that lead to dataloss:

  • Sets the default Configuration.settings object to null instead of an empty Settings object (parity with analytics-swit)
  • Establish and use good defaults for Settings object when one can not be obtained (parity with analytics-swift)
  • Sets the default state of DestinationPlugin.enabled to true instead of false (parity with intention of analytics-swift)

Note: This PR contains a revert of a previous commit that set Configuration.settings object to an empty Settings object, so there are many changes related to the tests.

val defaultSettings = configuration.defaultSettings ?: Settings(
integrations = buildJsonObject {
put(
"Segment.io",
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe better to make this a constant in SegmentDestination and reference it here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can add constructors in Settings so it's consistent with swift's implementation and that forces every settings created to have a segment destination

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I agree, there are too many differences :( from swift.

@@ -89,7 +89,7 @@ abstract class DestinationPlugin : EventPlugin {
override val type: Plugin.Type = Plugin.Type.Destination
private val timeline: Timeline = Timeline()
override lateinit var analytics: Analytics
internal var enabled = false
internal var enabled = true
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good catch! otherwise we might have issue when the user first opens the app offline and plugins are disabled by default.

@didiergarcia didiergarcia merged commit b958b36 into main Jan 28, 2025
8 checks passed
@didiergarcia didiergarcia deleted the fix-session-start-data-issue branch January 28, 2025 16:26
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