Skip to content

Commit

Permalink
Sending close button click event
Browse files Browse the repository at this point in the history
  • Loading branch information
muneer-khan committed Aug 1, 2023
1 parent 914bdf2 commit 8dd3aa2
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/ios/CDVWKInAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ - (void)close:(CDVInvokedUrlCommand*)command
NSLog(@"IAB.close() called but it was already closed.");
return;
}
if (self.callbackId != nil) {
NSLog(@"Sending close button click");

CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsDictionary:@{@"type":@"message", @"data":"closeClick"}];
[pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];

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

// Things are cleaned up in browserExit.
[self.inAppBrowserViewController close];
Expand Down Expand Up @@ -1087,20 +1096,8 @@ - (BOOL)prefersStatusBarHidden {
return NO;
}

- (void)closeClick
{
if (self.callbackId != nil) {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsDictionary:@{@"type":@"message", @"data":"closeClick"}];
[pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];

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

- (void)close
{
[self.navigationDelegate closeClick];
{
self.currentURL = nil;

__weak UIViewController* weakSelf = self;
Expand Down

0 comments on commit 8dd3aa2

Please sign in to comment.