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

iOS: add IOS delegate, rect, userAgent and evalJavascript #18

Closed
wants to merge 10 commits into from
Closed

Conversation

pedia
Copy link
Contributor

@pedia pedia commented Dec 9, 2017

add UIWebViewDelegate for UIWebView
add rect/hidden argument for the first launch

@pedia pedia mentioned this pull request Dec 9, 2017
Copy link
Collaborator

@lejard-h lejard-h 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 your pull request, can you add your name to the authors list and take a look at my comments ?

_channel.setMethodCallHandler(_handleMessages);
}

Future<Null> _handleMessages(MethodCall call) async {
print("_handleMessages $call");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove print

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad.

_init() {
FlutterWebviewPlugin() :
_channel = const MethodChannel(_kChannel),
_event = const EventChannel(_kEvent) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why a new channel and not use the existing MethodChannel ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final EventChannel _event;
Stream<String> _stateChanged;

Stream<String> get stateChanged {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onUrlChanged Stream already exist for this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a difference could you document it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is difficult to implement onUrlchanged, I will try this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add comment ?
iOS implemented,
Android not implemented

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

NSNumber *clearCache = call.arguments[@"clearCache"];
NSNumber *clearCookies = call.arguments[@"clearCookies"];
NSNumber *fullScreen = call.arguments[@"fullScreen"];
NSNumber *hidden = call.arguments[@"hidden"];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you document this ? removing fullscreen is a breaking change and I need to know if I can do the same thing for Android

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I will add some document.

fullScreen is default.

}

- (void)initWebView:(FlutterMethodCall*)call {
// NSNumber *withJavascript = call.arguments[@"withJavascript"];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea, but can we deactivate/activate javascript for iOS webview ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's easy.

@lejard-h
Copy link
Collaborator

@toufikzitouni do you have time to review the iOS part ?

kpedia and others added 2 commits December 12, 2017 12:02
add eval javascript
sink onUrlChanged ...
/// android: Implemented
/// [fullScreen]: show in full screen mode, default true
/// iOS WebView: without rect, show in full screen mode
/// android: Not implemented yet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fullscreen is implemented on Android, but hidden is not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

/// [rect]: show in rect(not full screen)
/// iOS WebView: worked
/// android: Not implemented yet
/// [enableAppScheme]: false will enable all schemes, true only for
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS implemented,
Android not implemented

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@@ -90,6 +142,10 @@ class FlutterWebviewPlugin {
await _channel.invokeMethod('launch', args);
}

Future<String> evalJavascript(String code) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOS implemented
Android not implemented

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

_channel = const MethodChannel(_kChannel),
_event = const EventChannel(_kEvent) {
FlutterWebViewPlugin()
: _channel = const MethodChannel(_kChannel),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we use on MethodChannel instead of 2 channels ?

final EventChannel _event;
Stream<String> _stateChanged;

Stream<String> get stateChanged {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add comment ?
iOS implemented,
Android not implemented

@pedia pedia changed the title iOS: add delegate and some argument iOS: add IOS delegate, rect, userAgent and evalJavascript Dec 15, 2017
kpedia and others added 2 commits December 16, 2017 18:05
android: add rect, fullScreen, userAgent, eval
ios and android more implement
@pedia
Copy link
Contributor Author

pedia commented Dec 16, 2017

@lejard-h
I removed ios event channel, add android implement of rect, userAgent ...

@pedia
Copy link
Contributor Author

pedia commented Dec 18, 2017

@lejard-h

Maybe I should close this pull request, and request a new one.

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