removed util platform check
This commit is contained in:
parent
e0c03b0891
commit
b66eeae75a
@ -262,16 +262,11 @@ class AndroidInAppWebViewWidgetCreationParams
|
||||
final AndroidPullToRefreshController? pullToRefreshController;
|
||||
}
|
||||
|
||||
///{@template flutter_inappwebview.InAppWebView}
|
||||
///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- Android native WebView
|
||||
///- iOS
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewWidget}
|
||||
class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
/// Constructs a [AndroidInAppWebViewWidget].
|
||||
///
|
||||
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewWidget}
|
||||
AndroidInAppWebViewWidget(PlatformInAppWebViewWidgetCreationParams params)
|
||||
: super.implementation(
|
||||
params is AndroidInAppWebViewWidgetCreationParams
|
||||
|
@ -125,11 +125,9 @@ class IOSChromeSafariBrowser extends PlatformChromeSafariBrowser
|
||||
assert(!_isOpened, 'The browser is already opened.');
|
||||
_isOpened = true;
|
||||
|
||||
if (Util.isIOS) {
|
||||
assert(url != null, 'The specified URL must not be null on iOS.');
|
||||
assert(['http', 'https'].contains(url!.scheme),
|
||||
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');
|
||||
}
|
||||
if (url != null) {
|
||||
assert(url.toString().isNotEmpty, 'The specified URL must not be empty.');
|
||||
}
|
||||
|
@ -418,14 +418,9 @@ class IOSCookieManager extends PlatformCookieManager
|
||||
}
|
||||
|
||||
Future<bool> _shouldUseJavascript() async {
|
||||
if (Util.isIOS || Util.isMacOS) {
|
||||
final platformUtil = PlatformUtil.instance();
|
||||
final systemVersion = await platformUtil.getSystemVersion();
|
||||
return Util.isIOS
|
||||
? systemVersion.compareTo("11") == -1
|
||||
: systemVersion.compareTo("10.13") == -1;
|
||||
}
|
||||
return false;
|
||||
return systemVersion.compareTo("10.13") == -1;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -260,16 +260,11 @@ class IOSInAppWebViewWidgetCreationParams
|
||||
final IOSPullToRefreshController? pullToRefreshController;
|
||||
}
|
||||
|
||||
///{@template flutter_inappwebview.InAppWebView}
|
||||
///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- IOS native WebView
|
||||
///- iOS
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewWidget}
|
||||
class IOSInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
/// Constructs a [IOSInAppWebViewWidget].
|
||||
///
|
||||
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewWidget}
|
||||
IOSInAppWebViewWidget(PlatformInAppWebViewWidgetCreationParams params)
|
||||
: super.implementation(
|
||||
params is IOSInAppWebViewWidgetCreationParams
|
||||
|
@ -90,10 +90,8 @@ class IOSWebAuthenticationSession extends PlatformWebAuthenticationSession
|
||||
WebAuthenticationSessionSettings? initialSettings})
|
||||
: super.implementation(IOSWebAuthenticationSessionCreationParams()) {
|
||||
assert(url.toString().isNotEmpty);
|
||||
if (Util.isIOS || Util.isMacOS) {
|
||||
assert(['http', 'https'].contains(url.scheme),
|
||||
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');
|
||||
}
|
||||
|
||||
this.initialSettings =
|
||||
initialSettings ?? WebAuthenticationSessionSettings();
|
||||
|
@ -418,14 +418,9 @@ class MacOSCookieManager extends PlatformCookieManager
|
||||
}
|
||||
|
||||
Future<bool> _shouldUseJavascript() async {
|
||||
if (Util.isMacOS || Util.isMacOS) {
|
||||
final platformUtil = PlatformUtil.instance();
|
||||
final systemVersion = await platformUtil.getSystemVersion();
|
||||
return Util.isMacOS
|
||||
? systemVersion.compareTo("11") == -1
|
||||
: systemVersion.compareTo("10.13") == -1;
|
||||
}
|
||||
return false;
|
||||
return systemVersion.compareTo("11") == -1;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -65,7 +65,7 @@ class MacOSInAppBrowser extends PlatformInAppBrowser with ChannelController {
|
||||
return _staticValue;
|
||||
}
|
||||
|
||||
MacOSInAppBrowserCreationParams get _iosParams =>
|
||||
MacOSInAppBrowserCreationParams get _macosParams =>
|
||||
params as MacOSInAppBrowserCreationParams;
|
||||
|
||||
static const MethodChannel _staticChannel =
|
||||
@ -95,7 +95,7 @@ class MacOSInAppBrowser extends PlatformInAppBrowser with ChannelController {
|
||||
channel!,
|
||||
this,
|
||||
this.initialUserScripts);
|
||||
_iosParams.findInteractionController?.init(id);
|
||||
_macosParams.findInteractionController?.init(id);
|
||||
}
|
||||
|
||||
_debugLog(String method, dynamic args) {
|
||||
|
@ -274,7 +274,7 @@ class MacOSHeadlessInAppWebView extends PlatformHeadlessInAppWebView
|
||||
|
||||
dynamic _controllerFromPlatform;
|
||||
|
||||
MacOSHeadlessInAppWebViewCreationParams get _iosParams =>
|
||||
MacOSHeadlessInAppWebViewCreationParams get _macosParams =>
|
||||
params as MacOSHeadlessInAppWebViewCreationParams;
|
||||
|
||||
_init() {
|
||||
@ -285,7 +285,7 @@ class MacOSHeadlessInAppWebView extends PlatformHeadlessInAppWebView
|
||||
_controllerFromPlatform =
|
||||
params.controllerFromPlatform?.call(_webViewController!) ??
|
||||
_webViewController!;
|
||||
_iosParams.findInteractionController?.init(id);
|
||||
_macosParams.findInteractionController?.init(id);
|
||||
channel =
|
||||
MethodChannel('com.pichillilorenzo/flutter_headless_inappwebview_$id');
|
||||
handler = _handleMethod;
|
||||
@ -321,8 +321,8 @@ class MacOSHeadlessInAppWebView extends PlatformHeadlessInAppWebView
|
||||
initialSettings.toMap();
|
||||
|
||||
Map<String, dynamic> pullToRefreshSettings =
|
||||
_iosParams.pullToRefreshController?.params.settings.toMap() ??
|
||||
_iosParams.pullToRefreshController?.params.options.toMap() ??
|
||||
_macosParams.pullToRefreshController?.params.settings.toMap() ??
|
||||
_macosParams.pullToRefreshController?.params.options.toMap() ??
|
||||
PullToRefreshSettings(enabled: false).toMap();
|
||||
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
@ -421,8 +421,8 @@ class MacOSHeadlessInAppWebView extends PlatformHeadlessInAppWebView
|
||||
_webViewController?.dispose();
|
||||
_webViewController = null;
|
||||
_controllerFromPlatform = null;
|
||||
_iosParams.pullToRefreshController?.dispose();
|
||||
_iosParams.findInteractionController?.dispose();
|
||||
_macosParams.pullToRefreshController?.dispose();
|
||||
_macosParams.findInteractionController?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,16 +254,11 @@ class MacOSInAppWebViewWidgetCreationParams
|
||||
final MacOSFindInteractionController? findInteractionController;
|
||||
}
|
||||
|
||||
///{@template flutter_inappwebview.InAppWebView}
|
||||
///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree.
|
||||
///
|
||||
///**Supported Platforms/Implementations**:
|
||||
///- MacOS native WebView
|
||||
///- iOS
|
||||
///- Web
|
||||
///{@endtemplate}
|
||||
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewWidget}
|
||||
class MacOSInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
/// Constructs a [MacOSInAppWebViewWidget].
|
||||
///
|
||||
///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewWidget}
|
||||
MacOSInAppWebViewWidget(PlatformInAppWebViewWidgetCreationParams params)
|
||||
: super.implementation(
|
||||
params is MacOSInAppWebViewWidgetCreationParams
|
||||
@ -272,61 +267,61 @@ class MacOSInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
.fromPlatformInAppWebViewWidgetCreationParams(params),
|
||||
);
|
||||
|
||||
MacOSInAppWebViewWidgetCreationParams get _iosParams =>
|
||||
MacOSInAppWebViewWidgetCreationParams get _macosParams =>
|
||||
params as MacOSInAppWebViewWidgetCreationParams;
|
||||
|
||||
MacOSInAppWebViewController? _controller;
|
||||
|
||||
MacOSHeadlessInAppWebView? get _iosHeadlessInAppWebView =>
|
||||
_iosParams.headlessWebView as MacOSHeadlessInAppWebView?;
|
||||
MacOSHeadlessInAppWebView? get _macosHeadlessInAppWebView =>
|
||||
_macosParams.headlessWebView as MacOSHeadlessInAppWebView?;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final initialSettings =
|
||||
_iosParams.initialSettings ?? InAppWebViewSettings();
|
||||
_macosParams.initialSettings ?? InAppWebViewSettings();
|
||||
_inferInitialSettings(initialSettings);
|
||||
|
||||
Map<String, dynamic> settingsMap = (_iosParams.initialSettings != null
|
||||
Map<String, dynamic> settingsMap = (_macosParams.initialSettings != null
|
||||
? initialSettings.toMap()
|
||||
: null) ??
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
_iosParams.initialOptions?.toMap() ??
|
||||
_macosParams.initialOptions?.toMap() ??
|
||||
initialSettings.toMap();
|
||||
|
||||
Map<String, dynamic> pullToRefreshSettings =
|
||||
_iosParams.pullToRefreshController?.params.settings.toMap() ??
|
||||
_macosParams.pullToRefreshController?.params.settings.toMap() ??
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
_iosParams.pullToRefreshController?.params.options.toMap() ??
|
||||
_macosParams.pullToRefreshController?.params.options.toMap() ??
|
||||
PullToRefreshSettings(enabled: false).toMap();
|
||||
|
||||
if ((_iosParams.headlessWebView?.isRunning() ?? false) &&
|
||||
_iosParams.keepAlive != null) {
|
||||
final headlessId = _iosParams.headlessWebView?.id;
|
||||
if ((_macosParams.headlessWebView?.isRunning() ?? false) &&
|
||||
_macosParams.keepAlive != null) {
|
||||
final headlessId = _macosParams.headlessWebView?.id;
|
||||
if (headlessId != null) {
|
||||
// force keep alive id to match headless webview id
|
||||
_iosParams.keepAlive?.id = headlessId;
|
||||
_macosParams.keepAlive?.id = headlessId;
|
||||
}
|
||||
}
|
||||
|
||||
return UiKitView(
|
||||
viewType: 'com.pichillilorenzo/flutter_inappwebview',
|
||||
onPlatformViewCreated: _onPlatformViewCreated,
|
||||
gestureRecognizers: _iosParams.gestureRecognizers,
|
||||
gestureRecognizers: _macosParams.gestureRecognizers,
|
||||
creationParams: <String, dynamic>{
|
||||
'initialUrlRequest': _iosParams.initialUrlRequest?.toMap(),
|
||||
'initialFile': _iosParams.initialFile,
|
||||
'initialData': _iosParams.initialData?.toMap(),
|
||||
'initialUrlRequest': _macosParams.initialUrlRequest?.toMap(),
|
||||
'initialFile': _macosParams.initialFile,
|
||||
'initialData': _macosParams.initialData?.toMap(),
|
||||
'initialSettings': settingsMap,
|
||||
'contextMenu': _iosParams.contextMenu?.toMap() ?? {},
|
||||
'windowId': _iosParams.windowId,
|
||||
'headlessWebViewId': _iosParams.headlessWebView?.isRunning() ?? false
|
||||
? _iosParams.headlessWebView?.id
|
||||
'contextMenu': _macosParams.contextMenu?.toMap() ?? {},
|
||||
'windowId': _macosParams.windowId,
|
||||
'headlessWebViewId': _macosParams.headlessWebView?.isRunning() ?? false
|
||||
? _macosParams.headlessWebView?.id
|
||||
: null,
|
||||
'initialUserScripts':
|
||||
_iosParams.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
|
||||
_macosParams.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
|
||||
'pullToRefreshSettings': pullToRefreshSettings,
|
||||
'keepAliveId': _iosParams.keepAlive?.id,
|
||||
'preventGestureDelay': _iosParams.preventGestureDelay
|
||||
'keepAliveId': _macosParams.keepAlive?.id,
|
||||
'preventGestureDelay': _macosParams.preventGestureDelay
|
||||
},
|
||||
creationParamsCodec: const StandardMessageCodec(),
|
||||
);
|
||||
@ -335,16 +330,16 @@ class MacOSInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
void _onPlatformViewCreated(int id) {
|
||||
dynamic viewId = id;
|
||||
if (!kIsWeb) {
|
||||
if (_iosParams.headlessWebView?.isRunning() ?? false) {
|
||||
viewId = _iosParams.headlessWebView?.id;
|
||||
if (_macosParams.headlessWebView?.isRunning() ?? false) {
|
||||
viewId = _macosParams.headlessWebView?.id;
|
||||
}
|
||||
viewId = _iosParams.keepAlive?.id ?? viewId ?? id;
|
||||
viewId = _macosParams.keepAlive?.id ?? viewId ?? id;
|
||||
}
|
||||
_iosHeadlessInAppWebView?.internalDispose();
|
||||
_macosHeadlessInAppWebView?.internalDispose();
|
||||
_controller = MacOSInAppWebViewController(
|
||||
PlatformInAppWebViewControllerCreationParams(
|
||||
id: viewId, webviewParams: params));
|
||||
_iosParams.findInteractionController?.init(viewId);
|
||||
_macosParams.findInteractionController?.init(viewId);
|
||||
debugLog(
|
||||
className: runtimeType.toString(),
|
||||
id: viewId?.toString(),
|
||||
@ -352,42 +347,42 @@ class MacOSInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
PlatformInAppWebViewController.debugLoggingSettings,
|
||||
method: "onWebViewCreated",
|
||||
args: []);
|
||||
if (_iosParams.onWebViewCreated != null) {
|
||||
_iosParams.onWebViewCreated!(
|
||||
if (_macosParams.onWebViewCreated != null) {
|
||||
_macosParams.onWebViewCreated!(
|
||||
params.controllerFromPlatform?.call(_controller!) ?? _controller!);
|
||||
}
|
||||
}
|
||||
|
||||
void _inferInitialSettings(InAppWebViewSettings settings) {
|
||||
if (_iosParams.shouldOverrideUrlLoading != null &&
|
||||
if (_macosParams.shouldOverrideUrlLoading != null &&
|
||||
settings.useShouldOverrideUrlLoading == null) {
|
||||
settings.useShouldOverrideUrlLoading = true;
|
||||
}
|
||||
if (_iosParams.onLoadResource != null &&
|
||||
if (_macosParams.onLoadResource != null &&
|
||||
settings.useOnLoadResource == null) {
|
||||
settings.useOnLoadResource = true;
|
||||
}
|
||||
if (_iosParams.onDownloadStartRequest != null &&
|
||||
if (_macosParams.onDownloadStartRequest != null &&
|
||||
settings.useOnDownloadStart == null) {
|
||||
settings.useOnDownloadStart = true;
|
||||
}
|
||||
if (_iosParams.shouldInterceptAjaxRequest != null &&
|
||||
if (_macosParams.shouldInterceptAjaxRequest != null &&
|
||||
settings.useShouldInterceptAjaxRequest == null) {
|
||||
settings.useShouldInterceptAjaxRequest = true;
|
||||
}
|
||||
if (_iosParams.shouldInterceptFetchRequest != null &&
|
||||
if (_macosParams.shouldInterceptFetchRequest != null &&
|
||||
settings.useShouldInterceptFetchRequest == null) {
|
||||
settings.useShouldInterceptFetchRequest = true;
|
||||
}
|
||||
if (_iosParams.shouldInterceptRequest != null &&
|
||||
if (_macosParams.shouldInterceptRequest != null &&
|
||||
settings.useShouldInterceptRequest == null) {
|
||||
settings.useShouldInterceptRequest = true;
|
||||
}
|
||||
if (_iosParams.onRenderProcessGone != null &&
|
||||
if (_macosParams.onRenderProcessGone != null &&
|
||||
settings.useOnRenderProcessGone == null) {
|
||||
settings.useOnRenderProcessGone = true;
|
||||
}
|
||||
if (_iosParams.onNavigationResponse != null &&
|
||||
if (_macosParams.onNavigationResponse != null &&
|
||||
settings.useOnNavigationResponse == null) {
|
||||
settings.useOnNavigationResponse = true;
|
||||
}
|
||||
@ -403,11 +398,11 @@ class MacOSInAppWebViewWidget extends PlatformInAppWebViewWidget {
|
||||
PlatformInAppWebViewController.debugLoggingSettings,
|
||||
method: "dispose",
|
||||
args: []);
|
||||
final isKeepAlive = _iosParams.keepAlive != null;
|
||||
final isKeepAlive = _macosParams.keepAlive != null;
|
||||
_controller?.dispose(isKeepAlive: isKeepAlive);
|
||||
_controller = null;
|
||||
_iosParams.pullToRefreshController?.dispose(isKeepAlive: isKeepAlive);
|
||||
_iosParams.findInteractionController?.dispose(isKeepAlive: isKeepAlive);
|
||||
_macosParams.pullToRefreshController?.dispose(isKeepAlive: isKeepAlive);
|
||||
_macosParams.findInteractionController?.dispose(isKeepAlive: isKeepAlive);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -48,16 +48,17 @@ class MacOSInAppWebViewPlatform extends InAppWebViewPlatform {
|
||||
return MacOSInAppWebViewController.static();
|
||||
}
|
||||
|
||||
/// Creates a new [MacOSInAppWebViewWidget].
|
||||
///
|
||||
/// This function should only be called by the app-facing package.
|
||||
/// Look at using [InAppWebView] in `flutter_inappwebview` instead.
|
||||
@override
|
||||
MacOSInAppWebViewWidget createPlatformInAppWebViewWidget(
|
||||
PlatformInAppWebViewWidgetCreationParams params,
|
||||
) {
|
||||
return MacOSInAppWebViewWidget(params);
|
||||
}
|
||||
// TODO: unhide when Flutter official PlatformView for macOS is available
|
||||
// /// Creates a new [MacOSInAppWebViewWidget].
|
||||
// ///
|
||||
// /// This function should only be called by the app-facing package.
|
||||
// /// Look at using [InAppWebView] in `flutter_inappwebview` instead.
|
||||
// @override
|
||||
// MacOSInAppWebViewWidget createPlatformInAppWebViewWidget(
|
||||
// PlatformInAppWebViewWidgetCreationParams params,
|
||||
// ) {
|
||||
// return MacOSInAppWebViewWidget(params);
|
||||
// }
|
||||
|
||||
/// Creates a new [MacOSFindInteractionController].
|
||||
///
|
||||
|
@ -90,10 +90,8 @@ class MacOSWebAuthenticationSession extends PlatformWebAuthenticationSession
|
||||
WebAuthenticationSessionSettings? initialSettings})
|
||||
: super.implementation(MacOSWebAuthenticationSessionCreationParams()) {
|
||||
assert(url.toString().isNotEmpty);
|
||||
if (Util.isMacOS || Util.isMacOS) {
|
||||
assert(['http', 'https'].contains(url.scheme),
|
||||
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');
|
||||
}
|
||||
|
||||
this.initialSettings =
|
||||
initialSettings ?? WebAuthenticationSessionSettings();
|
||||
|
@ -60,9 +60,9 @@ class MacOSWebMessageChannel extends PlatformWebMessageChannel
|
||||
return _staticValue;
|
||||
}
|
||||
|
||||
MacOSWebMessagePort get _iosPort1 => port1 as MacOSWebMessagePort;
|
||||
MacOSWebMessagePort get _macosPort1 => port1 as MacOSWebMessagePort;
|
||||
|
||||
MacOSWebMessagePort get _iosPort2 => port2 as MacOSWebMessagePort;
|
||||
MacOSWebMessagePort get _macosPort2 => port2 as MacOSWebMessagePort;
|
||||
|
||||
static MacOSWebMessageChannel? _fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
@ -75,8 +75,8 @@ class MacOSWebMessageChannel extends PlatformWebMessageChannel
|
||||
MacOSWebMessagePortCreationParams(index: 0)),
|
||||
port2: MacOSWebMessagePort(
|
||||
MacOSWebMessagePortCreationParams(index: 1))));
|
||||
webMessageChannel._iosPort1.webMessageChannel = webMessageChannel;
|
||||
webMessageChannel._iosPort2.webMessageChannel = webMessageChannel;
|
||||
webMessageChannel._macosPort1.webMessageChannel = webMessageChannel;
|
||||
webMessageChannel._macosPort2.webMessageChannel = webMessageChannel;
|
||||
return webMessageChannel;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ class MacOSWebMessageChannel extends PlatformWebMessageChannel
|
||||
switch (call.method) {
|
||||
case "onMessage":
|
||||
int index = call.arguments["index"];
|
||||
var port = index == 0 ? _iosPort1 : _iosPort2;
|
||||
var port = index == 0 ? _macosPort1 : _macosPort2;
|
||||
if (port.onMessage != null) {
|
||||
WebMessage? message = call.arguments["message"] != null
|
||||
? WebMessage.fromMap(
|
||||
|
@ -47,7 +47,7 @@ class MacOSWebMessageListener extends PlatformWebMessageListener
|
||||
: MacOSWebMessageListenerCreationParams
|
||||
.fromPlatformWebMessageListenerCreationParams(params),
|
||||
) {
|
||||
assert(!this._iosParams.allowedOriginRules.contains(""),
|
||||
assert(!this._macosParams.allowedOriginRules.contains(""),
|
||||
"allowedOriginRules cannot contain empty strings");
|
||||
channel = MethodChannel(
|
||||
'com.pichillilorenzo/flutter_inappwebview_web_message_listener_${_id}_${params.jsObjectName}');
|
||||
@ -60,7 +60,7 @@ class MacOSWebMessageListener extends PlatformWebMessageListener
|
||||
|
||||
MacOSJavaScriptReplyProxy? _replyProxy;
|
||||
|
||||
MacOSWebMessageListenerCreationParams get _iosParams =>
|
||||
MacOSWebMessageListenerCreationParams get _macosParams =>
|
||||
params as MacOSWebMessageListenerCreationParams;
|
||||
|
||||
Future<dynamic> _handleMethod(MethodCall call) async {
|
||||
@ -99,7 +99,7 @@ class MacOSWebMessageListener extends PlatformWebMessageListener
|
||||
return {
|
||||
"id": _id,
|
||||
"jsObjectName": params.jsObjectName,
|
||||
"allowedOriginRules": _iosParams.allowedOriginRules.toList(),
|
||||
"allowedOriginRules": _macosParams.allowedOriginRules.toList(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -147,14 +147,14 @@ class MacOSJavaScriptReplyProxy extends PlatformJavaScriptReplyProxy {
|
||||
.fromPlatformJavaScriptReplyProxyCreationParams(params),
|
||||
);
|
||||
|
||||
MacOSWebMessageListener get _iosWebMessageListener =>
|
||||
MacOSWebMessageListener get _macosWebMessageListener =>
|
||||
params.webMessageListener as MacOSWebMessageListener;
|
||||
|
||||
@override
|
||||
Future<void> postMessage(WebMessage message) async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
args.putIfAbsent('message', () => message.toMap());
|
||||
await _iosWebMessageListener.channel?.invokeMethod('postMessage', args);
|
||||
await _macosWebMessageListener.channel?.invokeMethod('postMessage', args);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -144,7 +144,8 @@ class PlatformAssetsPathHandlerCreationParams
|
||||
///Developers should ensure that asset files are named using standard file extensions.
|
||||
///If the file does not have a recognised extension, `text/plain` will be used by default.
|
||||
///{@endtemplate}
|
||||
abstract class PlatformAssetsPathHandler extends PlatformInterface implements PlatformPathHandler {
|
||||
abstract class PlatformAssetsPathHandler extends PlatformInterface
|
||||
implements PlatformPathHandler {
|
||||
/// Creates a new [PlatformAssetsPathHandler]
|
||||
factory PlatformAssetsPathHandler(
|
||||
PlatformAssetsPathHandlerCreationParams params) {
|
||||
@ -216,7 +217,8 @@ class PlatformResourcesPathHandlerCreationParams
|
||||
///Developers should ensure that asset files are named using standard file extensions.
|
||||
///If the file does not have a recognised extension, `text/plain` will be used by default.
|
||||
///{@endtemplate}
|
||||
abstract class PlatformResourcesPathHandler extends PlatformInterface implements PlatformPathHandler {
|
||||
abstract class PlatformResourcesPathHandler extends PlatformInterface
|
||||
implements PlatformPathHandler {
|
||||
/// Creates a new [PlatformResourcesPathHandler]
|
||||
factory PlatformResourcesPathHandler(
|
||||
PlatformResourcesPathHandlerCreationParams params) {
|
||||
@ -239,7 +241,8 @@ abstract class PlatformResourcesPathHandler extends PlatformInterface implements
|
||||
/// Should only be used by platform implementations because they can't extend
|
||||
/// a class that only contains a factory constructor.
|
||||
@protected
|
||||
PlatformResourcesPathHandler.implementation(this.params) : super(token: _token);
|
||||
PlatformResourcesPathHandler.implementation(this.params)
|
||||
: super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
@ -299,7 +302,8 @@ class PlatformInternalStoragePathHandlerCreationParams
|
||||
///Developers should ensure that asset files are named using standard file extensions.
|
||||
///If the file does not have a recognised extension, `text/plain` will be used by default.
|
||||
///{@endtemplate}
|
||||
abstract class PlatformInternalStoragePathHandler extends PlatformInterface implements PlatformPathHandler {
|
||||
abstract class PlatformInternalStoragePathHandler extends PlatformInterface
|
||||
implements PlatformPathHandler {
|
||||
/// Creates a new [PlatformResourcesPathHandler]
|
||||
factory PlatformInternalStoragePathHandler(
|
||||
PlatformInternalStoragePathHandlerCreationParams params) {
|
||||
@ -322,7 +326,8 @@ abstract class PlatformInternalStoragePathHandler extends PlatformInterface impl
|
||||
/// Should only be used by platform implementations because they can't extend
|
||||
/// a class that only contains a factory constructor.
|
||||
@protected
|
||||
PlatformInternalStoragePathHandler.implementation(this.params) : super(token: _token);
|
||||
PlatformInternalStoragePathHandler.implementation(this.params)
|
||||
: super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user