diff --git a/packages/connectivity/connectivity/CHANGELOG.md b/packages/connectivity/connectivity/CHANGELOG.md index e737d9201372..03213e4eb831 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 f8486165fa70..87612ea7f7f0 100644 --- a/packages/connectivity/connectivity/example/lib/main.dart +++ b/packages/connectivity/connectivity/example/lib/main.dart @@ -105,18 +105,23 @@ class _MyHomePageState extends State { 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 @@ class _MyHomePageState extends State { 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 @@ class _MyHomePageState extends State { } 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 54a67337285a..773ad1001750 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 @@ void main() { 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 @@ void main() { 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 54a67337285a..1b8675bc4c8e 100644 --- a/packages/connectivity/connectivity/integration_test/connectivity_test.dart +++ b/packages/connectivity/connectivity/integration_test/connectivity_test.dart @@ -22,8 +22,11 @@ void main() { 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 @@ void main() { 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 a5d9f25089cf..e3fdba7a5523 100644 --- a/packages/connectivity/connectivity/lib/connectivity.dart +++ b/packages/connectivity/connectivity/lib/connectivity.dart @@ -53,6 +53,8 @@ class Connectivity { /// /// 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 getWifiName() { return _platform.getWifiName(); } @@ -63,11 +65,15 @@ class Connectivity { /// /// 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 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 getWifiIP() { return _platform.getWifiIP(); } @@ -120,6 +126,8 @@ class Connectivity { /// 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 requestLocationServiceAuthorization({ bool requestAlwaysLocationUsage = false, }) { @@ -164,6 +172,8 @@ class Connectivity { /// ``` /// /// 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 getLocationServiceAuthorization() { return _platform.getLocationServiceAuthorization(); } diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index bb2752078069..a8994bfaaccb 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -2,10 +2,7 @@ name: connectivity 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 7ed2c8d7f7e2..98bdf3a11a6d 100644 --- a/packages/connectivity/connectivity/test/connectivity_test.dart +++ b/packages/connectivity/connectivity/test/connectivity_test.dart @@ -35,28 +35,33 @@ void main() { }); 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); });