CB-8659: ios: 4.0.x Compatibility: Remove use of initWebView method

This commit is contained in:
Ian Clelland 2015-03-13 11:03:29 -04:00
parent 9e57b0227f
commit 6ae87c9dc0

View File

@ -110,22 +110,18 @@
[self updateReachability:self.internetReach]; [self updateReachability:self.internetReach];
} }
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView - (void)pluginInitialize
{ {
self = [super initWithWebView:theWebView]; self.connectionType = @"none";
if (self) { self.internetReach = [CDVReachability reachabilityForInternetConnection];
self.connectionType = @"none"; self.connectionType = [self w3cConnectionTypeFor:self.internetReach];
self.internetReach = [CDVReachability reachabilityForInternetConnection]; [self.internetReach startNotifier];
self.connectionType = [self w3cConnectionTypeFor:self.internetReach]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:)
[self.internetReach startNotifier]; name:kReachabilityChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:) if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
name:kReachabilityChangedNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
}
} }
return self;
} }
@end @end