From e5f868749a57f112f276fe233b6a41634c4532ba Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 21 Oct 2020 12:24:58 -0700 Subject: [PATCH 1/8] 1.0 --- packages/connectivity/connectivity/CHANGELOG.md | 5 +++++ .../connectivity/connectivity/example/lib/main.dart | 11 +++++++++++ .../connectivity/ios/Classes/FLTConnectivityPlugin.m | 4 +++- .../connectivity/connectivity/lib/connectivity.dart | 12 +++++++++++- packages/connectivity/connectivity/pubspec.yaml | 5 +---- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/packages/connectivity/connectivity/CHANGELOG.md b/packages/connectivity/connectivity/CHANGELOG.md index e737d9201372..957e90b6c141 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/ios/Classes/FLTConnectivityPlugin.m b/packages/connectivity/connectivity/ios/Classes/FLTConnectivityPlugin.m index 526bee25d561..0a65409b3828 100644 --- a/packages/connectivity/connectivity/ios/Classes/FLTConnectivityPlugin.m +++ b/packages/connectivity/connectivity/ios/Classes/FLTConnectivityPlugin.m @@ -156,7 +156,9 @@ - (NSString*)convertCLAuthorizationStatusToString:(CLAuthorizationStatus)status case kCLAuthorizationStatusAuthorizedWhenInUse: { return @"authorizedWhenInUse"; } - default: { return @"unknown"; } + default: { + return @"unknown"; + } } } diff --git a/packages/connectivity/connectivity/lib/connectivity.dart b/packages/connectivity/connectivity/lib/connectivity.dart index a5d9f25089cf..6e3aa177279b 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(); } @@ -98,7 +104,7 @@ class Connectivity { /// * The app uses the NEHotspotConfiguration API to configure the current Wi-Fi network. /// * The app has active VPN configurations installed. /// - /// If the app falls into the first category, call this method before calling `getWifiBSSID` or `getWifiIP`. + /// If the app falls into the first category, c1all this method before calling `getWifiBSSID` or `getWifiIP`. /// For example, /// ```dart /// if (Platform.isIOS) { @@ -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: From 63187afd76109811722e282aabcb27320d207e1b Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 21 Oct 2020 12:27:09 -0700 Subject: [PATCH 2/8] typo --- packages/connectivity/connectivity/lib/connectivity.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connectivity/connectivity/lib/connectivity.dart b/packages/connectivity/connectivity/lib/connectivity.dart index 6e3aa177279b..e3fdba7a5523 100644 --- a/packages/connectivity/connectivity/lib/connectivity.dart +++ b/packages/connectivity/connectivity/lib/connectivity.dart @@ -104,7 +104,7 @@ class Connectivity { /// * The app uses the NEHotspotConfiguration API to configure the current Wi-Fi network. /// * The app has active VPN configurations installed. /// - /// If the app falls into the first category, c1all this method before calling `getWifiBSSID` or `getWifiIP`. + /// If the app falls into the first category, call this method before calling `getWifiBSSID` or `getWifiIP`. /// For example, /// ```dart /// if (Platform.isIOS) { From c7b515ed472d233c18287d5b60fe948acead8905 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 21 Oct 2020 12:27:29 -0700 Subject: [PATCH 3/8] typo --- packages/connectivity/connectivity/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connectivity/connectivity/CHANGELOG.md b/packages/connectivity/connectivity/CHANGELOG.md index 957e90b6c141..03213e4eb831 100644 --- a/packages/connectivity/connectivity/CHANGELOG.md +++ b/packages/connectivity/connectivity/CHANGELOG.md @@ -1,6 +1,6 @@ ## 1.0.0 -* Mark wifi related code deprecated +* Mark wifi related code deprecated. * Announce 1.0.0! ## 0.4.9+5 From 084ee6cdd89db630bb172abdbc3f70b15a0f8c5c Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 21 Oct 2020 12:57:36 -0700 Subject: [PATCH 4/8] Update FLTConnectivityPlugin.m --- .../connectivity/ios/Classes/FLTConnectivityPlugin.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/connectivity/connectivity/ios/Classes/FLTConnectivityPlugin.m b/packages/connectivity/connectivity/ios/Classes/FLTConnectivityPlugin.m index 0a65409b3828..526bee25d561 100644 --- a/packages/connectivity/connectivity/ios/Classes/FLTConnectivityPlugin.m +++ b/packages/connectivity/connectivity/ios/Classes/FLTConnectivityPlugin.m @@ -156,9 +156,7 @@ - (NSString*)convertCLAuthorizationStatusToString:(CLAuthorizationStatus)status case kCLAuthorizationStatusAuthorizedWhenInUse: { return @"authorizedWhenInUse"; } - default: { - return @"unknown"; - } + default: { return @"unknown"; } } } From 82d7b1d048c1dcf33946fa42c68c816b781bfd58 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 21 Oct 2020 14:28:01 -0700 Subject: [PATCH 5/8] add ignores --- .../test_driver/integration_test/connectivity_test.dart | 1 + .../connectivity/integration_test/connectivity_test.dart | 4 ++++ .../connectivity/connectivity/test/connectivity_test.dart | 5 +++++ 3 files changed, 10 insertions(+) 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..2b51f196045b 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,6 +22,7 @@ void main() { expect(result, isNotNull); switch (result) { case ConnectivityResult.wifi: + expect(_connectivity.getWifiName(), completes); expect(_connectivity.getWifiBSSID(), completes); expect((await _connectivity.getWifiIP()), isNotNull); diff --git a/packages/connectivity/connectivity/integration_test/connectivity_test.dart b/packages/connectivity/connectivity/integration_test/connectivity_test.dart index 54a67337285a..773ad1001750 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 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/test/connectivity_test.dart b/packages/connectivity/connectivity/test/connectivity_test.dart index 7ed2c8d7f7e2..657aec815e15 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 String result = await connectivity.getWifiName(); expect(result, kWifiNameResult); }); test('getWifiBSSID', () async { + // ignore: deprecated_member_use String result = await connectivity.getWifiBSSID(); expect(result, kWifiBSSIDResult); }); test('getWifiIP', () async { + // ignore: deprecated_member_use String result = await connectivity.getWifiIP(); expect(result, kWifiIpAddressResult); }); test('requestLocationServiceAuthorization', () async { LocationAuthorizationStatus result = + // ignore: deprecated_member_use await connectivity.requestLocationServiceAuthorization(); expect(result, kRequestLocationResult); }); test('getLocationServiceAuthorization', () async { LocationAuthorizationStatus result = + // ignore: deprecated_member_use await connectivity.getLocationServiceAuthorization(); expect(result, kRequestLocationResult); }); From a0c2da4bbb6794dbc97ffc55699d03c609b2d403 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 21 Oct 2020 18:42:47 -0700 Subject: [PATCH 6/8] format --- .../example/test_driver/integration_test/connectivity_test.dart | 1 - 1 file changed, 1 deletion(-) 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 2b51f196045b..54a67337285a 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,7 +22,6 @@ void main() { expect(result, isNotNull); switch (result) { case ConnectivityResult.wifi: - expect(_connectivity.getWifiName(), completes); expect(_connectivity.getWifiBSSID(), completes); expect((await _connectivity.getWifiIP()), isNotNull); From 797d8e0770c76937a5b6c52925058be1abcbd263 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 21 Oct 2020 18:43:58 -0700 Subject: [PATCH 7/8] format --- .../test_driver/integration_test/connectivity_test.dart | 4 ++++ 1 file changed, 4 insertions(+) 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); } From b9702d7f53ccd7cfa231cd741b040dabc2250bdd Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 21 Oct 2020 19:02:09 -0700 Subject: [PATCH 8/8] updated to deprecated_member_use_from_same_package --- .../integration_test/connectivity_test.dart | 8 ++++---- .../connectivity/test/connectivity_test.dart | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/connectivity/connectivity/integration_test/connectivity_test.dart b/packages/connectivity/connectivity/integration_test/connectivity_test.dart index 773ad1001750..1b8675bc4c8e 100644 --- a/packages/connectivity/connectivity/integration_test/connectivity_test.dart +++ b/packages/connectivity/connectivity/integration_test/connectivity_test.dart @@ -22,11 +22,11 @@ void main() { expect(result, isNotNull); switch (result) { case ConnectivityResult.wifi: - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package expect(_connectivity.getWifiName(), completes); - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package expect(_connectivity.getWifiBSSID(), completes); - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package expect((await _connectivity.getWifiIP()), isNotNull); break; default: @@ -36,7 +36,7 @@ void main() { testWidgets('test location methods, iOS only', (WidgetTester tester) async { if (Platform.isIOS) { - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package expect((await _connectivity.getLocationServiceAuthorization()), LocationAuthorizationStatus.notDetermined); } diff --git a/packages/connectivity/connectivity/test/connectivity_test.dart b/packages/connectivity/connectivity/test/connectivity_test.dart index 657aec815e15..98bdf3a11a6d 100644 --- a/packages/connectivity/connectivity/test/connectivity_test.dart +++ b/packages/connectivity/connectivity/test/connectivity_test.dart @@ -35,33 +35,33 @@ void main() { }); test('getWifiName', () async { - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package String result = await connectivity.getWifiName(); expect(result, kWifiNameResult); }); test('getWifiBSSID', () async { - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package String result = await connectivity.getWifiBSSID(); expect(result, kWifiBSSIDResult); }); test('getWifiIP', () async { - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package String result = await connectivity.getWifiIP(); expect(result, kWifiIpAddressResult); }); test('requestLocationServiceAuthorization', () async { LocationAuthorizationStatus result = - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package await connectivity.requestLocationServiceAuthorization(); expect(result, kRequestLocationResult); }); test('getLocationServiceAuthorization', () async { LocationAuthorizationStatus result = - // ignore: deprecated_member_use + // ignore: deprecated_member_use_from_same_package await connectivity.getLocationServiceAuthorization(); expect(result, kRequestLocationResult); });