diff --git a/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview_controller.dart b/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview_controller.dart index ceb4bc9a9ef4f34a19f56dc3db70101331f2203d..410b39cfd447563b8b725d9fa84e9fbe3686a9d4 100644 --- a/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/flutter_inappwebview_android/lib/src/in_app_webview/in_app_webview_controller.dart @@ -1238,6 +1238,7 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController if (contextMenu != null) { int? androidId = call.arguments["androidId"]; + int? ohosId = call.arguments["ohosId"]; String? iosId = call.arguments["iosId"]; dynamic id = call.arguments["id"]; String title = call.arguments["title"]; @@ -1247,6 +1248,8 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController // ignore: deprecated_member_use_from_same_package androidId: androidId, // ignore: deprecated_member_use_from_same_package + ohosId: ohosId, + // ignore: deprecated_member_use_from_same_package iosId: iosId, title: title, action: null); diff --git a/flutter_inappwebview_ios/lib/src/in_app_webview/in_app_webview_controller.dart b/flutter_inappwebview_ios/lib/src/in_app_webview/in_app_webview_controller.dart index 7e847f14f7144e746d202f78aef1673cc1e5426b..61dd3249f48c905338d618dbb9e23e40d4f5dba1 100644 --- a/flutter_inappwebview_ios/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/flutter_inappwebview_ios/lib/src/in_app_webview/in_app_webview_controller.dart @@ -1234,6 +1234,7 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController if (contextMenu != null) { int? androidId = call.arguments["androidId"]; + int? ohosId = call.arguments["ohosId"]; String? iosId = call.arguments["iosId"]; dynamic id = call.arguments["id"]; String title = call.arguments["title"]; @@ -1243,6 +1244,8 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController // ignore: deprecated_member_use_from_same_package androidId: androidId, // ignore: deprecated_member_use_from_same_package + ohosId: ohosId, + // ignore: deprecated_member_use_from_same_package iosId: iosId, title: title, action: null); diff --git a/flutter_inappwebview_macos/lib/src/in_app_webview/in_app_webview_controller.dart b/flutter_inappwebview_macos/lib/src/in_app_webview/in_app_webview_controller.dart index 38ab1bc7634ae06febb734e7238159dd02782ce2..721a64eec33dfbe5bcda6876a72a29f2fc690282 100644 --- a/flutter_inappwebview_macos/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/flutter_inappwebview_macos/lib/src/in_app_webview/in_app_webview_controller.dart @@ -1235,6 +1235,7 @@ class MacOSInAppWebViewController extends PlatformInAppWebViewController if (contextMenu != null) { int? androidId = call.arguments["androidId"]; + int? ohosId = call.arguments["ohosId"]; String? iosId = call.arguments["iosId"]; dynamic id = call.arguments["id"]; String title = call.arguments["title"]; @@ -1244,6 +1245,8 @@ class MacOSInAppWebViewController extends PlatformInAppWebViewController // ignore: deprecated_member_use_from_same_package androidId: androidId, // ignore: deprecated_member_use_from_same_package + ohosId: ohosId, + // ignore: deprecated_member_use_from_same_package iosId: iosId, title: title, action: null); diff --git a/flutter_inappwebview_ohos/lib/src/in_app_webview/in_app_webview_controller.dart b/flutter_inappwebview_ohos/lib/src/in_app_webview/in_app_webview_controller.dart index 926c3c68c7eceb95dc027c4d0f3b02654ac17e54..c461b138b3ba94097667956b12bbc106f159cdd3 100644 --- a/flutter_inappwebview_ohos/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/flutter_inappwebview_ohos/lib/src/in_app_webview/in_app_webview_controller.dart @@ -1253,6 +1253,7 @@ class OhosInAppWebViewController extends PlatformInAppWebViewController if (contextMenu != null) { int? androidId = call.arguments["androidId"]; + int? ohosId = call.arguments["ohosId"]; String? iosId = call.arguments["iosId"]; dynamic id = call.arguments["id"]; String title = call.arguments["title"]; @@ -1262,6 +1263,8 @@ class OhosInAppWebViewController extends PlatformInAppWebViewController // ignore: deprecated_member_use_from_same_package androidId: androidId, // ignore: deprecated_member_use_from_same_package + ohosId: ohosId, + // ignore: deprecated_member_use_from_same_package iosId: iosId, title: title, action: null); diff --git a/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu_item.dart b/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu_item.dart index ec7a29bcde7297f0abdae9ec4e6ad1d64dbe3ccc..7a614ace045737329df0266b6e0ec953383a2f13 100644 --- a/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu_item.dart +++ b/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu_item.dart @@ -12,6 +12,10 @@ class ContextMenuItem_ { @Deprecated("Use id instead") int? androidId; + ///Use [id] instead. + @Deprecated("Use id instead") + int? ohosId; + ///Use [id] instead. @Deprecated("Use id instead") String? iosId; @@ -31,6 +35,7 @@ class ContextMenuItem_ { ContextMenuItem_( {this.id, @Deprecated("Use id instead") this.androidId, + @Deprecated("Use id instead") this.ohosId, @Deprecated("Use id instead") this.iosId, required this.title, this.action}) { @@ -38,6 +43,9 @@ class ContextMenuItem_ { // ignore: deprecated_member_use_from_same_package this.id = this.id ?? this.androidId; assert(this.id is int); + } else if (Util.isOhos) { + // ignore: deprecated_member_use_from_same_package + this.id = this.id ?? this.ohosId; } else if (Util.isIOS) { // ignore: deprecated_member_use_from_same_package this.id = this.id ?? this.iosId; @@ -48,6 +56,6 @@ class ContextMenuItem_ { @ExchangeableObjectMethod(toMapMergeWith: true) // ignore: unused_element Map _toMapMergeWith() { - return {"androidId": androidId, "iosId": iosId}; + return {"androidId": androidId, "ohosId": ohosId, "iosId": iosId}; } } diff --git a/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu_item.g.dart b/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu_item.g.dart index 242c1f2b55ef63e9f0805d5aac317c121154d452..0c62382730c273b60338635a454456cbe530fea7 100644 --- a/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu_item.g.dart +++ b/flutter_inappwebview_platform_interface/lib/src/context_menu/context_menu_item.g.dart @@ -24,17 +24,24 @@ class ContextMenuItem { @Deprecated('Use id instead') String? iosId; + ///Use [id] instead. + @Deprecated('Use id instead') + int? ohosId; + ///Menu item title. String title; ContextMenuItem( {this.id, @Deprecated("Use id instead") this.androidId, + @Deprecated("Use id instead") this.ohosId, @Deprecated("Use id instead") this.iosId, required this.title, this.action}) { if (Util.isAndroid) { this.id = this.id ?? this.androidId; assert(this.id is int); + } else if (Util.isOhos) { + this.id = this.id ?? this.ohosId; } else if (Util.isIOS) { this.id = this.id ?? this.iosId; } @@ -50,6 +57,7 @@ class ContextMenuItem { androidId: map['id'], id: map['id'], iosId: map['id'], + ohosId: map['id'], title: map['title'], ); return instance; @@ -57,7 +65,7 @@ class ContextMenuItem { @ExchangeableObjectMethod(toMapMergeWith: true) Map _toMapMergeWith() { - return {"androidId": androidId, "iosId": iosId}; + return {"androidId": androidId, "ohosId": ohosId, "iosId": iosId}; } ///Converts instance to a map. diff --git a/flutter_inappwebview_platform_interface/lib/src/util.dart b/flutter_inappwebview_platform_interface/lib/src/util.dart index 113ccf782f263f3b98a6822ddfe8dca647b37224..7ca5f269186d5b22889c4a1b272e9282cd24324b 100644 --- a/flutter_inappwebview_platform_interface/lib/src/util.dart +++ b/flutter_inappwebview_platform_interface/lib/src/util.dart @@ -15,6 +15,9 @@ class Util { static bool get isAndroid => !isWeb && defaultTargetPlatform == TargetPlatform.android; + static bool get isOhos => + !isWeb && defaultTargetPlatform == TargetPlatform.ohos; + static bool get isIOS => !isWeb && defaultTargetPlatform == TargetPlatform.iOS;