Skip to content

Conversation

@kuhnroyal
Copy link
Contributor

Description

  • copied from MacOS implementation
  • available on iOS 12+
  • correctly notifies when switching between Wifi networks without internet access

Related Issues

Fixes #632 for iOS 12+

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated the version in pubspec.yaml and CHANGELOG.md.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@kuhnroyal
Copy link
Contributor Author

Both iOS and MacOS plugins with Reachability and NWPathMonitor still have an inconsistent behavior after a hot restart and if a status stream has been created and stopped on the Flutter side. This is due to the fact that both versions clean up the backing implementation when the last listener is removed.

I would suggest to keep backing implementation (Reachability/NWPathMonitor) alive all the time. This would fix #434 and #790 in all cases.

@miquelbeltran
Copy link
Member

Thanks for the PR @kuhnroyal in the coming days I will take a look at the code and give it a try

@miquelbeltran miquelbeltran self-assigned this Mar 22, 2022
@miquelbeltran
Copy link
Member

Sorry @kuhnroyal I couldn't go through your PR yet. Any chance you can fix the merge conflicts?

* copied from MacOS implementation
* available on iOS 12+
* correctly notifies when switching between Wifi networks without internet access
* ensure early initialization of backing `Reachability`/`NWPathMonitor` resulting in `checkConnectivity()` returning the correct status right away (until now it almost always returned `.none`)
* having the correct initial status results in the the status stream not emitting double events on startup (previously most of the time it emitted 2 events starting with `.none` following the correct status)
* the behavior is still incorrect after a hot restart because the backing `Reachability`/`NWPathMonitor` has been cleaned up and is not initialized early
@kuhnroyal kuhnroyal force-pushed the feature/nwpathmonitor branch from ce87bec to c8235da Compare April 11, 2022 12:58
@kuhnroyal
Copy link
Contributor Author

@miquelbeltran Rebased

@miquelbeltran
Copy link
Member

Thanks! I will be merging and releasing them today.

To confirm, is this PR fixing: #632, #434 and #790 ?

@kuhnroyal
Copy link
Contributor Author

#790

Yea that is what I hope.

@miquelbeltran miquelbeltran merged commit 89993a6 into fluttercommunity:main Apr 12, 2022
@kuhnroyal kuhnroyal deleted the feature/nwpathmonitor branch April 19, 2022 23:07
@kuhnroyal
Copy link
Contributor Author

Both iOS and MacOS plugins with Reachability and NWPathMonitor still have an inconsistent behavior after a hot restart and if a status stream has been created and stopped on the Flutter side. This is due to the fact that both versions clean up the backing implementation when the last listener is removed.

I would suggest to keep backing implementation (Reachability/NWPathMonitor) alive all the time. This would fix #434 and #790 in all cases.

@miquelbeltran Do you have thoughts on this?

@miquelbeltran
Copy link
Member

your explanation makes sense, yes. I haven't looked into it tho.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[connectivity_plus] can't check wifi connection without internet access

2 participants