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: iOS SSID to WiFi details #210

Merged
merged 4 commits into from
Nov 3, 2019
Merged

feat: iOS SSID to WiFi details #210

merged 4 commits into from
Nov 3, 2019

Conversation

Rapsssito
Copy link
Contributor

Overview

I've added in the ssid key to the details object on WiFi connection on iOS.

Test Plan

I couldn't test the code on a real iPhone, I do not have access to one at the moment.

@matt-oakes
Copy link
Collaborator

👋 Thanks for the PR. I will review this when I have an opportunity to.

@matt-oakes
Copy link
Collaborator

Thanks for this PR. I've taken a look and the requirements for using this API on iOS are pretty complicated. Quoting from the documentation:

Returns the network information for the specified interface when the requesting application meets one of following 3 requirements -.

  1. application is using CoreLocation API and has user's authorization to access location.
  2. application has used NEHotspotConfiguration API to configure the current Wi-Fi network.
  3. application has active VPN configurations installed.
  • An application that is linked against iOS 12.0 SDK and above must have the "com.apple.developer.networking.wifi-info" entitlement.
  • An application will receive a pseudo network information if it is linked against an SDK before iOS 13.0, and if it fails to meet any of the
    above 3 requirements.
  • An application will receive NULL if it is linked against iOS 13.0 SDK or above, and if it fails to meet any of the above 3 requirements..

Pseudo network information will contain "Wi-Fi" SSID and "00:00:00:00:00:00" BSSID. For China region, the SSID will be "WLAN".

For this PR to be merged, I think we need to ensure that the ssid property on iOS is only returned when we are able to provide the correct information. What is missing is a check for NULL and only including the ssid property if we think we have the correct SSID.

We will also need to update the documentation to make it clear what the requirements are for using this API. Linking to this Apple documentation page is likely enough there:

https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo?language=objc

Rapsssito and others added 2 commits October 6, 2019 16:17
@Rapsssito
Copy link
Contributor Author

Rapsssito commented Oct 6, 2019

Changes introduced
If the requesting application does not meet any of the requirements, the SSID will return null, in order to follow the same structure as on Android:
The SSID of the network. May not be present, null, or an empty string if it cannot be determined

@matt-oakes matt-oakes merged commit 119b372 into react-native-netinfo:master Nov 3, 2019
react-native-community-bot pushed a commit that referenced this pull request Nov 3, 2019
# [4.6.0](v4.5.0...v4.6.0) (2019-11-03)

### Features

* iOS SSID to WiFi details ([#210](#210)) ([119b372](119b372))
@react-native-community-bot
Copy link
Collaborator

🎉 This PR is included in version 4.6.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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants