Skip to content

Only do the WiFi connectivity check if the associated option is enabled #5705

Open

Description

@laurent22

In order to get the "Synchronise only over WiFi connection" option to work the mobile application checks for WiFi connectiviy on startup:

this.unsubscribeNetInfoHandler_ = NetInfo.addEventListener(({ type, details }) => {

And doing so makes a call to "clients3.google.com": react-native-netinfo/react-native-netinfo#212

If it's possible, this call should only happen when the "Synchronise only over WiFi connection" connection is enabled. Due to privacy concerns over using a Google URL for the check, we could also look at using an alternative.

Activity

  1. added
    enhancementFeature requests and code enhancements
    mobileAll mobile platforms
    backlogWe'll get to it... eventually...
    on Nov 10, 2021
  2. CalebJohn commented on Nov 10, 2021

    @CalebJohn
    Contributor

    It looks like you can also [configure the URL] (https://github.com/react-native-netinfo/react-native-netinfo/tree/371acf957cb25275395a268fd61a285e60a01acf#netinfoconfiguration) so even when it does hit a server, it can hit joplinapp instead.

  3. tomasz1986 commented on Nov 10, 2021

    @tomasz1986

    Is this also the case when using File System sync? If yes, would it also be possible not to check for any connectivity when using File System sync (regardless of the WiFi setting)? The reason is that there is no need for any Internet connection when the sync target is a local folder.

  4. tessus commented on Nov 10, 2021

    @tessus
    Collaborator

    @laurent22 I have a few questions:

    If we added a check before creating the listener at startup, the app would have to be restarted for a change (of "only sync via WiFi" setting) to be effective. Am I correct?
    If so, is that ok? If not, what can be done? I checked the NetInfo docs and using a React Hook will still have the same problem.

    For privacy concerned people having an option to specify the check URL is important. We can use the joplinapp.org server as a default, with a setting to change the URL. Just because we say that the server does not track people doesn't mean people can verify that statement. Also, isn't the web site run by github? In which case my above 2 sentences are moot.

    One thing to note though: I am not happy with the google URL either, but I believe the reason for this particular default setting in the Netinfo package was the availability of that endpoint. We all can be sure that it will be available 24x7. Can we say the same thing for other servers?

    Either way, it seems that only iOS is affected by this. However, I'd be willing to make the following changes today:

    • set URL to joplinapp.org and make the check verify status code 200
    • add a Reachability URL setting for mobile to allow people to change the URL (unfortunately there's no iOS/iPadOS AppType for settings)
    • only add listener if the "sync only via Wifi" is set
  5. laurent22 commented on Nov 11, 2021

    @laurent22
    OwnerAuthor

    Yes joplinapp.org would probably be better, and yes it would be GitHub's server. For now I prefer not to add an option to set the url though.

  6. added a commit that references this issue on Nov 12, 2021
    c087eb1
  7. laurent22 commented on Nov 29, 2021

    @laurent22
    OwnerAuthor

    Done a partial fix based on Tessus's pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogWe'll get to it... eventually...enhancementFeature requests and code enhancementsmobileAll mobile platforms

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions