-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add closing Browser Tab on iOS #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request! Overall looks great.
I've added a few stylistic comments so it follows the Google style guide. I realize some of the code you were changing was not compliant, but if you can fix it up it would be great!
@@ -18,8 +18,14 @@ | |||
#import <SafariServices/SafariServices.h> | |||
|
|||
@interface CBTBrowserTab : CDVPlugin | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move opening bracket to previous line
|
||
- (void) isAvailable:(CDVInvokedUrlCommand*)command; | ||
- (void) openUrl:(CDVInvokedUrlCommand*)command; | ||
- (void) close:(CDVInvokedUrlCommand*)command; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space before the asterisk, and remove the one after the (void)
, i.e.:
- (void)close:(CDVInvokedUrlCommand *)command;
(can you update the two previous lines as well?).
@@ -63,4 +62,11 @@ - (void) openUrl:(CDVInvokedUrlCommand*)command { | |||
callbackId:command.callbackId]; | |||
} | |||
|
|||
- (void) close:(CDVInvokedUrlCommand*)command { | |||
if (!_safari) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add brackets, i.e. if (!_safari) {
…
@@ -18,8 +18,14 @@ | |||
#import <SafariServices/SafariServices.h> | |||
|
|||
@interface CBTBrowserTab : CDVPlugin | |||
{ | |||
@protected | |||
SFSafariViewController* _safari; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we call it _safariViewController
so it's clear it's not mobile safari?
@@ -50,10 +50,9 @@ - (void) openUrl:(CDVInvokedUrlCommand*)command { | |||
callbackId:command.callbackId]; | |||
} | |||
|
|||
SFSafariViewController *sfvc = | |||
[[SFSafariViewController alloc] initWithURL: url]; | |||
_safari = [[SFSafariViewController alloc] initWithURL: url]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space before url
, i.e. initWithURL:url]
exports.close = function(opt_error) { | ||
var doNothing = function() {}; | ||
var error = (!opt_error) ? doNothing : opt_error; | ||
exec(doNothing, error, 'BrowserTab', 'close', []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line should be 2-space indented, not 4
@WilliamDenniss Done! Please review again. |
I still don't know if this is the right approach, because a close() method of this form cannot work for Android. @WilliamDenniss do we want platform-specific methods in this library? |
Thanks for your change, it was merged as part of #9. |
Fixes #4