Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
pichillilorenzo committed Sep 23, 2024
1 parent edc24eb commit e59072d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
doc/api/
.dart_tool/
.packages
build/
Expand Down
18 changes: 11 additions & 7 deletions flutter_inappwebview_web/lib/web/in_app_web_view_web_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class InAppWebViewWebElement implements Disposable {
}
});

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

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

jsWebView = flutterInAppWebView?.createFlutterInAppWebView(_viewId, iframe, iframeContainer);
jsWebView = flutterInAppWebView?.createFlutterInAppWebView(
_viewId, iframe, iframeContainer);
}
}
}
Expand Down Expand Up @@ -273,8 +275,7 @@ class InAppWebViewWebElement implements Disposable {
String _convertHttpResponseToData(XMLHttpRequest httpRequest) {
final String contentType =
httpRequest.getResponseHeader('content-type') ?? 'text/html';
return 'data:$contentType,' +
Uri.encodeComponent(httpRequest.responseText);
return 'data:$contentType,' + Uri.encodeComponent(httpRequest.responseText);
}

String getIFrameId() {
Expand Down Expand Up @@ -355,7 +356,8 @@ class InAppWebViewWebElement implements Disposable {
Future<void> injectJavascriptFileFromUrl(
{required String urlFile,
Map<String, dynamic>? scriptHtmlTagAttributes}) async {
jsWebView?.injectJavascriptFileFromUrl(urlFile.toJS, scriptHtmlTagAttributes?.jsify());
jsWebView?.injectJavascriptFileFromUrl(
urlFile.toJS, scriptHtmlTagAttributes?.jsify());
}

Future<void> injectCSSCode({required String source}) async {
Expand All @@ -365,7 +367,8 @@ class InAppWebViewWebElement implements Disposable {
Future<void> injectCSSFileFromUrl(
{required String urlFile,
Map<String, dynamic>? cssLinkHtmlTagAttributes}) async {
jsWebView?.injectCSSFileFromUrl(urlFile.toJS, cssLinkHtmlTagAttributes?.jsify());
jsWebView?.injectCSSFileFromUrl(
urlFile.toJS, cssLinkHtmlTagAttributes?.jsify());
}

Future<void> scrollTo(
Expand Down Expand Up @@ -458,7 +461,8 @@ class InAppWebViewWebElement implements Disposable {
iframe.allowFullscreen = newSettings.iframeAllowFullscreen ?? false;
}
if (settings!.iframeReferrerPolicy != newSettings.iframeReferrerPolicy) {
iframe.referrerPolicy = newSettings.iframeReferrerPolicy?.toNativeValue() ?? '';
iframe.referrerPolicy =
newSettings.iframeReferrerPolicy?.toNativeValue() ?? '';
}
if (settings!.iframeName != newSettings.iframeName) {
iframe.name = newSettings.iframeName ?? '';
Expand Down
10 changes: 7 additions & 3 deletions flutter_inappwebview_web/lib/web/js_bridge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ extension type JSWebView._(JSObject _) implements JSObject {
external void stopLoading();
external JSString? getUrl();
external JSString? getTitle();
external void injectJavascriptFileFromUrl(JSString urlFile, JSAny? scriptHtmlTagAttributes);
external void injectJavascriptFileFromUrl(
JSString urlFile, JSAny? scriptHtmlTagAttributes);
external void injectCSSCode(JSString source);
external void injectCSSFileFromUrl(JSString urlFile, JSAny? cssLinkHtmlTagAttributes);
external void injectCSSFileFromUrl(
JSString urlFile, JSAny? cssLinkHtmlTagAttributes);
external void scrollTo(JSNumber x, JSNumber y, JSBoolean animated);
external void scrollBy(JSNumber x, JSNumber y, JSBoolean animated);
external void printCurrentPage();
Expand All @@ -43,8 +45,10 @@ external FlutterInAppWebViewBridge? get flutterInAppWebView;

extension type FlutterInAppWebViewBridge._(JSObject _) implements JSObject {
external JSObject webViews;
external JSWebView createFlutterInAppWebView(JSAny viewId, HTMLIFrameElement iframe, HTMLDivElement iframeContainer);
external JSWebView createFlutterInAppWebView(
JSAny viewId, HTMLIFrameElement iframe, HTMLDivElement iframeContainer);
external JSString getCookieExpirationDate(num timestamp);

/// Allows assigning a function to be callable from `window.flutter_inappwebview.nativeCommunication()`
external JSFunction nativeCommunication;
}
9 changes: 5 additions & 4 deletions flutter_inappwebview_web/lib/web/web_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class InAppWebViewFlutterPlugin {
final platformUtil = PlatformUtil(messenger: registrar);
// ignore: unused_local_variable
final headlessManager = HeadlessInAppWebViewManager(messenger: registrar);
flutterInAppWebView?.nativeCommunication = (
(String method, JSAny viewId, [JSArray? args]) => _dartNativeCommunication(method, viewId, args?.toDart).toJS
).toJS;
flutterInAppWebView?.nativeCommunication = ((String method, JSAny viewId,
[JSArray? args]) =>
_dartNativeCommunication(method, viewId, args?.toDart).toJS).toJS;
}
}

Expand Down Expand Up @@ -73,7 +73,8 @@ Future<JSAny?> _dartNativeCommunication(String method, dynamic viewId,
String? target = args[2];
String? windowFeatures = args[3];
return (await webViewHtmlElement.onCreateWindow(
windowId, url, target, windowFeatures))?.toJS;
windowId, url, target, windowFeatures))
?.toJS;
case 'onWindowFocus':
webViewHtmlElement.onWindowFocus();
break;
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
},
"private": true,
"scripts": {
"build": "flutter pub run build_runner build --delete-conflicting-outputs",
"watch": "flutter pub run build_runner watch --delete-conflicting-outputs",
"publish:dry": "flutter pub publish --dry-run",
"publish": "flutter pub publish",
"format": "dart format flutter_inappwebview/lib flutter_inappwebview/example/integration_test flutter_inappwebview_platform_interface/lib flutter_inappwebview_android/lib flutter_inappwebview_ios/lib flutter_inappwebview_macos/lib flutter_inappwebview_web/lib flutter_inappwebview_windows/lib",
"build:publish": "npm run format && npm run build && flutter pub publish",
"docs:gen": "flutter pub global activate dartdoc && flutter pub global run dartdoc:dartdoc",
"docs:serve": "flutter pub global activate dhttpd && flutter pub global run dhttpd:dhttpd --path doc/api"
"build": ".fvm/flutter_sdk/bin/flutter pub run build_runner build --delete-conflicting-outputs",
"watch": ".fvm/flutter_sdk/bin/flutter pub run build_runner watch --delete-conflicting-outputs",
"publish:dry": ".fvm/flutter_sdk/bin/flutter pub publish --dry-run",
"publish": ".fvm/flutter_sdk/bin/flutter pub publish",
"format": ".fvm/flutter_sdk/bin/dart format flutter_inappwebview/lib flutter_inappwebview/example/integration_test flutter_inappwebview_platform_interface/lib flutter_inappwebview_android/lib flutter_inappwebview_ios/lib flutter_inappwebview_macos/lib flutter_inappwebview_web/lib flutter_inappwebview_windows/lib",
"build:publish": "npm run format && npm run build && .fvm/flutter_sdk/bin/flutter pub publish",
"docs:gen": ".fvm/flutter_sdk/bin/dart doc",
"docs:serve": ".fvm/flutter_sdk/bin/flutter pub global activate dhttpd && .fvm/flutter_sdk/bin/flutter pub global run dhttpd:dhttpd --path doc/api"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit e59072d

Please sign in to comment.