Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Ignore redundant initial reachability notification on iOS 9
Browse files Browse the repository at this point in the history
Fixes #1911.
  • Loading branch information
1ec5 committed Jul 29, 2015
1 parent d57a02f commit 807d87f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ @implementation MGLMapView
mbgl::Map *_mbglMap;
MBGLView *_mbglView;
mbgl::DefaultFileSource *_mbglFileSource;
BOOL _isWaitingForRedundantReachableNotification;

NS_MUTABLE_ARRAY_OF(NSURL *) *_bundledStyleURLs;

Expand Down Expand Up @@ -244,6 +245,10 @@ - (void)commonInit
object:nil];

MGLReachability* reachability = [MGLReachability reachabilityForInternetConnection];
if ([reachability isReachable])
{
_isWaitingForRedundantReachableNotification = YES;
}
[reachability startNotifier];

// setup annotations
Expand Down Expand Up @@ -415,9 +420,11 @@ - (void)createGLView
- (void)reachabilityChanged:(NSNotification *)notification
{
MGLReachability *reachability = [notification object];
if ([reachability isReachable]) {
if ( ! _isWaitingForRedundantReachableNotification && [reachability isReachable])
{
mbgl::NetworkStatus::Reachable();
}
_isWaitingForRedundantReachableNotification = NO;
}

- (void)dealloc
Expand Down

0 comments on commit 807d87f

Please sign in to comment.