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(ios): getSSID and getBSSID always returning null #175

Merged
merged 2 commits into from
Sep 19, 2021

Conversation

DominikStarke
Copy link
Contributor

This patch adresses issues
#161
and
#105

It adds a callback function to getSSID, which will resolve the result.
This is since NEHotspotNetwork.fetchCurrent's completionHandler is escaping. As a result ssid will never be set.

@daadu
Copy link
Member

daadu commented Sep 19, 2021

I do not know iOS much.

Requesting @Niek @diegotori, can you review the fix?

@daadu
Copy link
Member

daadu commented Sep 19, 2021

Did some basic google searches, looks like since we are setting ssid inside getSSID inside a closure (namely completionHandler) which by-default are nonescaping (since Swift 3) it not being set because it is "out of scope" of the outer function.

These fix adds a callback to getSSID as param, which is called when the "SSID" is fetched.

@DominikStarke correct me if my understanding is wrong.

Resources:

This fix LGTM, waiting for others to review.

@diegotori
Copy link

@daadu LGTM as well, since it's now handling the iOS result much better.

@DominikStarke
Copy link
Contributor Author

Yes. The current implementation is running out of scope. getSSID returns before fetchCurrent's handler is executed.

@DominikStarke
Copy link
Contributor Author

I added another commit to apply this fix to getBSSID.

@daadu daadu changed the title Fix getSSID on iOS fix(ios): getSSID and getBSSID always returning null Sep 19, 2021
@daadu daadu merged commit 089b84b into flutternetwork:master Sep 19, 2021
@daadu
Copy link
Member

daadu commented Sep 19, 2021

Thanks @DominikStarke for the fix.

This has landed on pub.dev with v0.3.7

daadu added a commit that referenced this pull request Sep 19, 2021
@daadu daadu linked an issue Sep 19, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants