Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

chuchuva
Copy link

Fixes #4

Copy link
Collaborator

@WilliamDenniss WilliamDenniss left a 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
{
Copy link
Collaborator

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;
Copy link
Collaborator

@WilliamDenniss WilliamDenniss Nov 22, 2016

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)
Copy link
Collaborator

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;
Copy link
Collaborator

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];
Copy link
Collaborator

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', []);
Copy link
Collaborator

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

@chuchuva
Copy link
Author

@WilliamDenniss Done! Please review again.

@iainmcgin
Copy link
Contributor

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?

@WilliamDenniss
Copy link
Collaborator

Thanks for your change, it was merged as part of #9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants