From 5368a63715be148667d841a7a50761f9f775a8d0 Mon Sep 17 00:00:00 2001 From: Mehmet Fidanboylu Date: Fri, 15 Nov 2019 06:14:51 -0800 Subject: [PATCH 1/3] Reachability is not a singleton anymore. This stopped working on iOS 13. --- packages/connectivity/ios/Classes/ConnectivityPlugin.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/connectivity/ios/Classes/ConnectivityPlugin.m b/packages/connectivity/ios/Classes/ConnectivityPlugin.m index c69871175b01..3b312880f53b 100644 --- a/packages/connectivity/ios/Classes/ConnectivityPlugin.m +++ b/packages/connectivity/ios/Classes/ConnectivityPlugin.m @@ -22,6 +22,7 @@ @interface FLTConnectivityPlugin () *)registrar { @@ -174,12 +175,16 @@ - (FlutterError*)onListenWithArguments:(id)arguments eventSink:(FlutterEventSink selector:@selector(onReachabilityDidChange:) name:kReachabilityChangedNotification object:nil]; - [[Reachability reachabilityForInternetConnection] startNotifier]; + _reachabilityForInternetConnection = [Reachability reachabilityForInternetConnection]; + [_reachabilityForInternetConnection startNotifier]; return nil; } - (FlutterError*)onCancelWithArguments:(id)arguments { - [[Reachability reachabilityForInternetConnection] stopNotifier]; + if (_reachabilityForInternetConnection) { + [_reachabilityForInternetConnection stopNotifier]; + _reachabilityForInternetConnection = nil; + } [[NSNotificationCenter defaultCenter] removeObserver:self]; _eventSink = nil; return nil; From 2ff194557d177cf71cc3c27a28153f21ac4fdf32 Mon Sep 17 00:00:00 2001 From: Mehmet Fidanboylu Date: Fri, 15 Nov 2019 06:15:26 -0800 Subject: [PATCH 2/3] Update version and changelog --- packages/connectivity/CHANGELOG.md | 4 ++++ packages/connectivity/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/connectivity/CHANGELOG.md b/packages/connectivity/CHANGELOG.md index 17e49e25cbd8..0e1ea814907a 100644 --- a/packages/connectivity/CHANGELOG.md +++ b/packages/connectivity/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.5+6 + +* Fix singleton Reachability problem on iOS. + ## 0.4.5+5 * Add an analyzer check for the public documentation. diff --git a/packages/connectivity/pubspec.yaml b/packages/connectivity/pubspec.yaml index c68109d835da..8dce3c8867b6 100644 --- a/packages/connectivity/pubspec.yaml +++ b/packages/connectivity/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for discovering the state of the network (WiFi & mobile/cellular) connectivity on Android and iOS. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity -version: 0.4.5+5 +version: 0.4.5+6 flutter: plugin: From 33c5a583d91a66de4ed4534e2775adb95df78a74 Mon Sep 17 00:00:00 2001 From: Mehmet Fidanboylu Date: Fri, 15 Nov 2019 11:06:42 -0800 Subject: [PATCH 3/3] Make formatter happy --- packages/connectivity/ios/Classes/ConnectivityPlugin.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connectivity/ios/Classes/ConnectivityPlugin.m b/packages/connectivity/ios/Classes/ConnectivityPlugin.m index 3b312880f53b..100e70b44ec6 100644 --- a/packages/connectivity/ios/Classes/ConnectivityPlugin.m +++ b/packages/connectivity/ios/Classes/ConnectivityPlugin.m @@ -22,7 +22,7 @@ @interface FLTConnectivityPlugin () *)registrar {