diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h index 0ba07f1..c92d9b7 100644 --- a/src/ios/CDVInAppBrowser.h +++ b/src/ios/CDVInAppBrowser.h @@ -98,4 +98,5 @@ @property (nonatomic, weak) id orientationDelegate; -@end \ No newline at end of file +@end + diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 8037a91..059fcde 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -73,7 +73,7 @@ if ([[url host] isEqualToString:@"itunes.apple.com"]) { return YES; } - + return NO; } @@ -90,7 +90,7 @@ if (url != nil) { NSURL* baseUrl = [self.webView.request URL]; NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL]; - + if ([self isSystemUrl:absoluteUrl]) { target = kInAppBrowserTargetSystem; } @@ -187,7 +187,7 @@ } } } - + // UIWebView options self.inAppBrowserViewController.webView.scalesPageToFit = browserOptions.enableviewportscale; self.inAppBrowserViewController.webView.mediaPlaybackRequiresUserAction = browserOptions.mediaplaybackrequiresuseraction; @@ -196,7 +196,7 @@ self.inAppBrowserViewController.webView.keyboardDisplayRequiresUserAction = browserOptions.keyboarddisplayrequiresuseraction; self.inAppBrowserViewController.webView.suppressesIncrementalRendering = browserOptions.suppressesincrementalrendering; } - + [self.inAppBrowserViewController navigateTo:url]; if (!browserOptions.hidden) { [self show:nil]; @@ -213,9 +213,9 @@ NSLog(@"Tried to show IAB while already shown"); return; } - + _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; - + CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc] initWithRootViewController:self.inAppBrowserViewController]; nav.orientationDelegate = self.inAppBrowserViewController; @@ -439,7 +439,7 @@ // Don't recycle the ViewController since it may be consuming a lot of memory. // Also - this is required for the PDF/User-Agent bug work-around. self.inAppBrowserViewController = nil; - + _previousStatusBarStyle = -1; if (IsAtLeastiOSVersion(@"7.0")) { @@ -477,7 +477,7 @@ BOOL toolbarIsAtBottom = ![_browserOptions.toolbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]; webViewBounds.size.height -= _browserOptions.location ? FOOTER_HEIGHT : TOOLBAR_HEIGHT; self.webView = [[UIWebView alloc] initWithFrame:webViewBounds]; - + self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); [self.view addSubview:self.webView]; @@ -519,7 +519,7 @@ float toolbarY = toolbarIsAtBottom ? self.view.bounds.size.height - TOOLBAR_HEIGHT : 0.0; CGRect toolbarFrame = CGRectMake(0.0, toolbarY, self.view.bounds.size.width, TOOLBAR_HEIGHT); - + self.toolbar = [[UIToolbar alloc] initWithFrame:toolbarFrame]; self.toolbar.alpha = 1.000; self.toolbar.autoresizesSubviews = YES; @@ -535,7 +535,7 @@ CGFloat labelInset = 5.0; float locationBarY = toolbarIsAtBottom ? self.view.bounds.size.height - FOOTER_HEIGHT : self.view.bounds.size.height - LOCATIONBAR_HEIGHT; - + self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(labelInset, locationBarY, self.view.bounds.size.width - labelInset, LOCATIONBAR_HEIGHT)]; self.addressLabel.adjustsFontSizeToFitWidth = NO; self.addressLabel.alpha = 1.000; @@ -549,13 +549,13 @@ self.addressLabel.enabled = YES; self.addressLabel.hidden = NO; self.addressLabel.lineBreakMode = NSLineBreakByTruncatingTail; - + if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumScaleFactor:")]) { [self.addressLabel setValue:@(10.0/[UIFont labelFontSize]) forKey:@"minimumScaleFactor"]; } else if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumFontSize:")]) { [self.addressLabel setValue:@(10.0) forKey:@"minimumFontSize"]; } - + self.addressLabel.multipleTouchEnabled = NO; self.addressLabel.numberOfLines = 1; self.addressLabel.opaque = NO; @@ -668,7 +668,7 @@ if (show) { self.toolbar.hidden = NO; CGRect webViewBounds = self.view.bounds; - + if (locationbarVisible) { // locationBar at the bottom, move locationBar up // put toolBar at the bottom @@ -682,7 +682,7 @@ webViewBounds.size.height -= TOOLBAR_HEIGHT; self.toolbar.frame = toolbarFrame; } - + if ([toolbarPosition isEqualToString:kInAppBrowserToolbarBarPositionTop]) { toolbarFrame.origin.y = 0; webViewBounds.origin.y += toolbarFrame.size.height; @@ -691,7 +691,7 @@ toolbarFrame.origin.y = (webViewBounds.size.height + LOCATIONBAR_HEIGHT); } [self setWebViewFrame:webViewBounds]; - + } else { self.toolbar.hidden = YES; @@ -725,7 +725,7 @@ [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; [super viewDidUnload]; } - + - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleDefault; @@ -735,7 +735,7 @@ { [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; self.currentURL = nil; - + if ((self.navigationDelegate != nil) && [self.navigationDelegate respondsToSelector:@selector(browserExit)]) { [self.navigationDelegate browserExit]; } @@ -774,14 +774,14 @@ { [self.webView goForward]; } - + - (void)viewWillAppear:(BOOL)animated { if (IsAtLeastiOSVersion(@"7.0")) { [[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]]; } [self rePositionViews]; - + [super viewWillAppear:animated]; } @@ -982,7 +982,7 @@ if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) { return [self.orientationDelegate supportedInterfaceOrientations]; } - + return 1 << UIInterfaceOrientationPortrait; } @@ -991,9 +991,10 @@ if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) { return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation]; } - + return YES; } @end +