Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class InAppWebViewWebElement implements Disposable {
});

jsWebView = flutterInAppWebView?.createFlutterInAppWebView(
_viewId, iframe, iframeContainer);
_viewId.toString(), iframe, iframeContainer);
}

/// Handles method calls over the MethodChannel of this plugin.
Expand Down Expand Up @@ -208,7 +208,7 @@ class InAppWebViewWebElement implements Disposable {
initialFile = webView.initialFile;

jsWebView = flutterInAppWebView?.createFlutterInAppWebView(
_viewId, iframe, iframeContainer);
_viewId.toString(), iframe, iframeContainer);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion flutter_inappwebview_web/lib/web/js_bridge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ external FlutterInAppWebViewBridge? get flutterInAppWebView;
extension type FlutterInAppWebViewBridge._(JSObject _) implements JSObject {
external JSObject webViews;
external JSWebView createFlutterInAppWebView(
JSAny viewId, HTMLIFrameElement iframe, HTMLDivElement iframeContainer);
String viewId, HTMLIFrameElement iframe, HTMLDivElement iframeContainer);
Comment on lines 48 to +49
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should also update type in flutter_inappwebview_web/lib/assets/web/web_support.js and in nativeCommunication-related code:

  • flutter_inappwebview_web/lib/web/web_platform.dart: JSAny viewId, dynamic viewId
  • flutter_inappwebview_web/lib/web/web_platform_manager.dart: webViews should have Map<String, dynamic> type
  • flutter_inappwebview_web/lib/web/in_app_web_view_web_element.dart: dynamic _viewId
  • other places where viewId is used as int or dynamic

As is, this PR could break functionality for cases where viewId is still used as int.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thank you @p-mazhnik .. I edited the part of flutter_inappwebview_web\lib\web\web_platform.dart to change int to string .. other parts are dynamic which should work without breaking functionality.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@alikamal1 i tried your solution after this changes. now it fails :(
image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@ArturLevchuk I have revert it back for now

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@alikamal1 also as mentioned @p-mazhnik with String value only changed here it brokes callbacks like 'onLoadStart' , 'onLoadStop'... But if we passing value like (_viewId as int).toJS it works. Anyway callbacks on wasm mode still dead. I tested your solution on version 6.1.5 because on 6.2 callbacks dead on web in general

external JSString getCookieExpirationDate(num timestamp);

/// Allows assigning a function to be callable from `window.flutter_inappwebview.nativeCommunication()`
Expand Down