-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[wifi_info_flutter] Wifi plugin implementation #3143
Conversation
| String ssid = null; | ||
| if (wifiInfo != null) ssid = wifiInfo.getSSID(); | ||
| if (ssid != null) ssid = ssid.replaceAll("\"", ""); // Android returns "SSID" | ||
| if (ssid != null && ssid.equals("<unknown ssid>")) ssid = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amirh addresses #3134 (comment)
cyanglaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I did a basic scan of the code as I assumed they are copy pasted from connectivity
| @@ -0,0 +1,22 @@ | |||
| // Copyright 2020 The Chromium Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style license that can be | |||
| // found in the LICENSE file. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need an extra line
| @@ -1,3 +1,4 @@ | |||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |||
| package="io.flutter.plugins.wifi_info_flutter"> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @bparrishMines
To make the plugin work with Android 8.0 and Android 8.1 without additional steps, you can add that too: android.permission.CHANGE_WIFI_STATE .
https://developer.android.com/guide/topics/connectivity/wifi-scan#wifi-scan-permissions
Thank you
| return ip; | ||
| } | ||
|
|
||
| private android.net.wifi.WifiInfo getWifiInfo() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bparrishMines Why not import android.net.wifi.WifiInfo ?
| private WifiInfoFlutter wifiInfoFlutter; | ||
|
|
||
| /** | ||
| * Construct the ConnectivityMethodChannelHandler with a {@code connectivity}. The {@code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bparrishMines It must be updated to Construct the WifiInfoFlutterMethodChannelHandle...
| ```dart | ||
| import 'package:connectivity/connectivity.dart'; | ||
| var wifiBSSID = await (WifiFlutter().getWifiBSSID()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean var wifiBSSID = await WifiFlutter().getWifiBSSID() without ()?
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| package="io.flutter.plugins.wifi_info_flutter"> | ||
| <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> to <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> .
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's best to leave permissions to the developer. I added the permission that was in the connectivity plugin to avoid breaking changes.
|
I saw we have publish:none in pubspec.yaml, when do we publish this? @bparrishMines |
Description
Implementation of
wifi_info_flutterplugin. Mostly a copy of wifi methods and tests fromconnectivityplugin.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.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?