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

feat: add offline mode #111

Merged
merged 10 commits into from
Feb 8, 2024
Merged

feat: add offline mode #111

merged 10 commits into from
Feb 8, 2024

Conversation

Mercy811
Copy link
Collaborator

@Mercy811 Mercy811 commented Jan 26, 2024

Summary

User interfaces

This feature is enabled by default.

To opt out of using NetworkConnectivityCheckerPlugin and implement custom offline logic, setting config.offline to NetworkConnectivityCheckerPlugin.Disabled will prevent the plugin from installing.

var testInstance = Amplitude(
    configuration: Configuration(
        apiKey: "API_KEY",
        offline: NetworkConnectivityCheckerPlugin.Disabled
    )
)

Tests

Tests to toggling network connection are based on https://amplitude.atlassian.net/wiki/spaces/GOV/pages/2319024851/Mock+network+changes.

Note

Note that simulators don't accurately reflect network changes of Mac (example). So test it on a real device.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

@Mercy811 Mercy811 marked this pull request as ready for review January 30, 2024 16:59
@Mercy811
Copy link
Collaborator Author

Don't merge it until running on a real device

Copy link
Contributor

@justin-fiedler justin-fiedler left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks @Mercy811!

@Mercy811
Copy link
Collaborator Author

Mercy811 commented Feb 8, 2024

NWPathMonitor.pathUploadHandler being called multiple times with the same path is a known issue ( see discussion here). Avoid multiple flush() when back to online at 0f072ad

@justin-fiedler justin-fiedler self-requested a review February 8, 2024 19:34
Copy link
Contributor

@justin-fiedler justin-fiedler left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks @Mercy811 !

@Mercy811 Mercy811 merged commit 37b337d into main Feb 8, 2024
3 checks passed
@Mercy811 Mercy811 deleted the offline branch February 8, 2024 19:49
github-actions bot pushed a commit that referenced this pull request Feb 8, 2024
# [1.3.0](v1.2.0...v1.3.0) (2024-02-08)

### Features

* add offline mode ([#111](#111)) ([37b337d](37b337d))
Copy link

github-actions bot commented Feb 8, 2024

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants