[connectivity] announce 1.0, deprecate wifi APIs (#3183)
diff --git a/packages/connectivity/connectivity/CHANGELOG.md b/packages/connectivity/connectivity/CHANGELOG.md
index e737d92..03213e4 100644
--- a/packages/connectivity/connectivity/CHANGELOG.md
+++ b/packages/connectivity/connectivity/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 1.0.0
+
+* Mark wifi related code deprecated.
+* Announce 1.0.0!
+
## 0.4.9+5
* Update android compileSdkVersion to 29.
diff --git a/packages/connectivity/connectivity/example/lib/main.dart b/packages/connectivity/connectivity/example/lib/main.dart
index f848616..87612ea 100644
--- a/packages/connectivity/connectivity/example/lib/main.dart
+++ b/packages/connectivity/connectivity/example/lib/main.dart
@@ -105,18 +105,23 @@
try {
if (!kIsWeb && Platform.isIOS) {
LocationAuthorizationStatus status =
+ // ignore: deprecated_member_use
await _connectivity.getLocationServiceAuthorization();
if (status == LocationAuthorizationStatus.notDetermined) {
status =
+ // ignore: deprecated_member_use
await _connectivity.requestLocationServiceAuthorization();
}
if (status == LocationAuthorizationStatus.authorizedAlways ||
status == LocationAuthorizationStatus.authorizedWhenInUse) {
+ // ignore: deprecated_member_use
wifiName = await _connectivity.getWifiName();
} else {
+ // ignore: deprecated_member_use
wifiName = await _connectivity.getWifiName();
}
} else {
+ // ignore: deprecated_member_use
wifiName = await _connectivity.getWifiName();
}
} on PlatformException catch (e) {
@@ -127,18 +132,23 @@
try {
if (!kIsWeb && Platform.isIOS) {
LocationAuthorizationStatus status =
+ // ignore: deprecated_member_use
await _connectivity.getLocationServiceAuthorization();
if (status == LocationAuthorizationStatus.notDetermined) {
status =
+ // ignore: deprecated_member_use
await _connectivity.requestLocationServiceAuthorization();
}
if (status == LocationAuthorizationStatus.authorizedAlways ||
status == LocationAuthorizationStatus.authorizedWhenInUse) {
+ // ignore: deprecated_member_use
wifiBSSID = await _connectivity.getWifiBSSID();
} else {
+ // ignore: deprecated_member_use
wifiBSSID = await _connectivity.getWifiBSSID();
}
} else {
+ // ignore: deprecated_member_use
wifiBSSID = await _connectivity.getWifiBSSID();
}
} on PlatformException catch (e) {
@@ -147,6 +157,7 @@
}
try {
+ // ignore: deprecated_member_use
wifiIP = await _connectivity.getWifiIP();
} on PlatformException catch (e) {
print(e.toString());
diff --git a/packages/connectivity/connectivity/example/test_driver/integration_test/connectivity_test.dart b/packages/connectivity/connectivity/example/test_driver/integration_test/connectivity_test.dart
index 54a6733..773ad10 100644
--- a/packages/connectivity/connectivity/example/test_driver/integration_test/connectivity_test.dart
+++ b/packages/connectivity/connectivity/example/test_driver/integration_test/connectivity_test.dart
@@ -22,8 +22,11 @@
expect(result, isNotNull);
switch (result) {
case ConnectivityResult.wifi:
+ // ignore: deprecated_member_use
expect(_connectivity.getWifiName(), completes);
+ // ignore: deprecated_member_use
expect(_connectivity.getWifiBSSID(), completes);
+ // ignore: deprecated_member_use
expect((await _connectivity.getWifiIP()), isNotNull);
break;
default:
@@ -33,6 +36,7 @@
testWidgets('test location methods, iOS only', (WidgetTester tester) async {
if (Platform.isIOS) {
+ // ignore: deprecated_member_use
expect((await _connectivity.getLocationServiceAuthorization()),
LocationAuthorizationStatus.notDetermined);
}
diff --git a/packages/connectivity/connectivity/integration_test/connectivity_test.dart b/packages/connectivity/connectivity/integration_test/connectivity_test.dart
index 54a6733..1b8675b 100644
--- a/packages/connectivity/connectivity/integration_test/connectivity_test.dart
+++ b/packages/connectivity/connectivity/integration_test/connectivity_test.dart
@@ -22,8 +22,11 @@
expect(result, isNotNull);
switch (result) {
case ConnectivityResult.wifi:
+ // ignore: deprecated_member_use_from_same_package
expect(_connectivity.getWifiName(), completes);
+ // ignore: deprecated_member_use_from_same_package
expect(_connectivity.getWifiBSSID(), completes);
+ // ignore: deprecated_member_use_from_same_package
expect((await _connectivity.getWifiIP()), isNotNull);
break;
default:
@@ -33,6 +36,7 @@
testWidgets('test location methods, iOS only', (WidgetTester tester) async {
if (Platform.isIOS) {
+ // ignore: deprecated_member_use_from_same_package
expect((await _connectivity.getLocationServiceAuthorization()),
LocationAuthorizationStatus.notDetermined);
}
diff --git a/packages/connectivity/connectivity/lib/connectivity.dart b/packages/connectivity/connectivity/lib/connectivity.dart
index a5d9f25..e3fdba7 100644
--- a/packages/connectivity/connectivity/lib/connectivity.dart
+++ b/packages/connectivity/connectivity/lib/connectivity.dart
@@ -53,6 +53,8 @@
///
/// From android 8.0 onwards the GPS must be ON (high accuracy)
/// in order to be able to obtain the SSID.
+ @Deprecated(
+ 'This method is deprecated. Please use wifi_info_flutter instead. See https://github.com/flutter/plugins/blob/master/packages/wifi_info_flutter/wifi_info_flutter/README.md')
Future<String> getWifiName() {
return _platform.getWifiName();
}
@@ -63,11 +65,15 @@
///
/// From Android 8.0 onwards the GPS must be ON (high accuracy)
/// in order to be able to obtain the BSSID.
+ @Deprecated(
+ 'This method is deprecated. Please use wifi_info_flutter instead. See https://github.com/flutter/plugins/blob/master/packages/wifi_info_flutter/wifi_info_flutter/README.md')
Future<String> getWifiBSSID() {
return _platform.getWifiBSSID();
}
/// Obtains the IP address of the connected wifi network
+ @Deprecated(
+ 'This method is deprecated. Please use wifi_info_flutter instead. See https://github.com/flutter/plugins/blob/master/packages/wifi_info_flutter/wifi_info_flutter/README.md')
Future<String> getWifiIP() {
return _platform.getWifiIP();
}
@@ -120,6 +126,8 @@
/// Ideally, a location service authorization should only be requested if the current authorization status is not determined.
///
/// See also [getLocationServiceAuthorization] to obtain current location service status.
+ @Deprecated(
+ 'This method is deprecated. Please use wifi_info_flutter instead. See https://github.com/flutter/plugins/blob/master/packages/wifi_info_flutter/wifi_info_flutter/README.md')
Future<LocationAuthorizationStatus> requestLocationServiceAuthorization({
bool requestAlwaysLocationUsage = false,
}) {
@@ -164,6 +172,8 @@
/// ```
///
/// See also [requestLocationServiceAuthorization] for requesting a location service authorization.
+ @Deprecated(
+ 'This method is deprecated. Please use wifi_info_flutter instead. See https://github.com/flutter/plugins/blob/master/packages/wifi_info_flutter/wifi_info_flutter/README.md')
Future<LocationAuthorizationStatus> getLocationServiceAuthorization() {
return _platform.getLocationServiceAuthorization();
}
diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml
index bb27520..a8994bf 100644
--- a/packages/connectivity/connectivity/pubspec.yaml
+++ b/packages/connectivity/connectivity/pubspec.yaml
@@ -2,10 +2,7 @@
description: Flutter plugin for discovering the state of the network (WiFi &
mobile/cellular) connectivity on Android and iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity
-# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
-# the version to 2.0.0.
-# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
-version: 0.4.9+5
+version: 1.0.0
flutter:
plugin:
diff --git a/packages/connectivity/connectivity/test/connectivity_test.dart b/packages/connectivity/connectivity/test/connectivity_test.dart
index 7ed2c8d..98bdf3a 100644
--- a/packages/connectivity/connectivity/test/connectivity_test.dart
+++ b/packages/connectivity/connectivity/test/connectivity_test.dart
@@ -35,28 +35,33 @@
});
test('getWifiName', () async {
+ // ignore: deprecated_member_use_from_same_package
String result = await connectivity.getWifiName();
expect(result, kWifiNameResult);
});
test('getWifiBSSID', () async {
+ // ignore: deprecated_member_use_from_same_package
String result = await connectivity.getWifiBSSID();
expect(result, kWifiBSSIDResult);
});
test('getWifiIP', () async {
+ // ignore: deprecated_member_use_from_same_package
String result = await connectivity.getWifiIP();
expect(result, kWifiIpAddressResult);
});
test('requestLocationServiceAuthorization', () async {
LocationAuthorizationStatus result =
+ // ignore: deprecated_member_use_from_same_package
await connectivity.requestLocationServiceAuthorization();
expect(result, kRequestLocationResult);
});
test('getLocationServiceAuthorization', () async {
LocationAuthorizationStatus result =
+ // ignore: deprecated_member_use_from_same_package
await connectivity.getLocationServiceAuthorization();
expect(result, kRequestLocationResult);
});