Skip to content

Commit

Permalink
hack: disable close button on the toolbar in the inAppBrowser
Browse files Browse the repository at this point in the history
  • Loading branch information
Andythurlow committed Dec 5, 2019
1 parent 87857d5 commit e503da5
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 128 deletions.
10 changes: 5 additions & 5 deletions src/ios/CDVUIInAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ - (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*
BOOL useBeforeLoad = NO;
NSString* httpMethod = request.HTTPMethod;
NSString* errorMessage = nil;

if([_beforeload isEqualToString:@"post"]){
//TODO handle POST requests by preserving POST data then remove this condition
errorMessage = @"beforeload doesn't yet support POST requests";
Expand Down Expand Up @@ -525,11 +525,11 @@ - (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsDictionary:@{@"type":@"beforeload", @"url":[url absoluteString]}];
[pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];

[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
return NO;
}

if(errorMessage != nil){
NSLog(errorMessage);
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
Expand Down Expand Up @@ -685,7 +685,7 @@ - (void)createViews
[self.spinner stopAnimating];

self.closeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close)];
self.closeButton.enabled = YES;
self.closeButton.enabled = NO;

UIBarButtonItem* flexibleSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

Expand Down Expand Up @@ -793,7 +793,7 @@ - (void)setCloseButtonTitle:(NSString*)title : (NSString*) colorString : (int) b
self.closeButton = nil;
// Initialize with title if title is set, otherwise the title will be 'Done' localized
self.closeButton = title != nil ? [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStyleBordered target:self action:@selector(close)] : [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close)];
self.closeButton.enabled = YES;
self.closeButton.enabled = NO;
// If color on closebutton is requested then initialize with that that color, otherwise use initialize with default
self.closeButton.tintColor = colorString != nil ? [self colorFromHexString:colorString] : [UIColor colorWithRed:60.0 / 255.0 green:136.0 / 255.0 blue:230.0 / 255.0 alpha:1];

Expand Down
Loading

0 comments on commit e503da5

Please sign in to comment.