From aadff6230c927196aa656de1c54efc471e3d5396 Mon Sep 17 00:00:00 2001 From: "AFASGROEP\\dvy" Date: Tue, 23 Dec 2025 16:18:41 +0100 Subject: [PATCH 1/4] fix version --- packages/protocol_handler_windows/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol_handler_windows/pubspec.yaml b/packages/protocol_handler_windows/pubspec.yaml index 4d1408f..db1bfc3 100644 --- a/packages/protocol_handler_windows/pubspec.yaml +++ b/packages/protocol_handler_windows/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter protocol_handler_platform_interface: ^0.2.0 - win32_registry: ^1.0.2 + win32_registry: ^2.1.0 dev_dependencies: flutter_test: From 50ee986508bd523e03713093ecbfc8a9c50c018a Mon Sep 17 00:00:00 2001 From: Dick Verweij Date: Tue, 23 Dec 2025 17:01:37 +0100 Subject: [PATCH 2/4] Fix registry value creation for protocol registration --- .../lib/src/protocol_handler_windows.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart b/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart index 609831c..c0b8056 100644 --- a/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart +++ b/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart @@ -17,15 +17,13 @@ class ProtocolHandlerWindows extends MethodChannelProtocolHandler { String appPath = Platform.resolvedExecutable; String protocolRegKey = 'Software\\Classes\\$scheme'; - RegistryValue protocolRegValue = const RegistryValue( + RegistryValue protocolRegValue = const RegistryValue.string( 'URL Protocol', - RegistryValueType.string, '', ); String protocolCmdRegKey = 'shell\\open\\command'; - RegistryValue protocolCmdRegValue = RegistryValue( + RegistryValue protocolCmdRegValue = RegistryValue.string( '', - RegistryValueType.string, '$appPath "%1"', ); From 97d69c7444121f7a5e65cb5f6255252f6ecc779b Mon Sep 17 00:00:00 2001 From: "AFASGROEP\\dvy" Date: Wed, 24 Dec 2025 10:36:07 +0100 Subject: [PATCH 3/4] add application name --- .../lib/src/protocol_handler_windows.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart b/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart index c0b8056..2951388 100644 --- a/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart +++ b/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart @@ -13,7 +13,7 @@ class ProtocolHandlerWindows extends MethodChannelProtocolHandler { } @override - Future register(String scheme) async { + Future register(String scheme, {String? friendlyAppName}) async { String appPath = Platform.resolvedExecutable; String protocolRegKey = 'Software\\Classes\\$scheme'; @@ -30,5 +30,14 @@ class ProtocolHandlerWindows extends MethodChannelProtocolHandler { final regKey = Registry.currentUser.createKey(protocolRegKey); regKey.createValue(protocolRegValue); regKey.createKey(protocolCmdRegKey).createValue(protocolCmdRegValue); + + if (friendlyAppName != null) { + String applicationRegKey = 'Application'; + RegistryValue friendlyAppNameRegValue = RegistryValue.string( + 'ApplicationName', + friendlyAppName, + ); + regKey.createKey(applicationRegKey).createValue(friendlyAppNameRegValue); + } } } From d15b557b5b23d585721272c960ff43ca5b4920d7 Mon Sep 17 00:00:00 2001 From: "AFASGROEP\\dvy" Date: Tue, 30 Dec 2025 18:34:45 +0100 Subject: [PATCH 4/4] update deps --- .../lib/protocol_handler_windows.dart | 2 +- .../lib/src/protocol_handler_helper.dart | 3 +++ .../lib/src/protocol_handler_helper_web.dart | 14 ++++++++++++++ ...dows.dart => protocol_handler_helpter_ffi.dart} | 0 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 packages/protocol_handler_windows/lib/src/protocol_handler_helper.dart create mode 100644 packages/protocol_handler_windows/lib/src/protocol_handler_helper_web.dart rename packages/protocol_handler_windows/lib/src/{protocol_handler_windows.dart => protocol_handler_helpter_ffi.dart} (100%) diff --git a/packages/protocol_handler_windows/lib/protocol_handler_windows.dart b/packages/protocol_handler_windows/lib/protocol_handler_windows.dart index a1c6c06..c3b4d34 100644 --- a/packages/protocol_handler_windows/lib/protocol_handler_windows.dart +++ b/packages/protocol_handler_windows/lib/protocol_handler_windows.dart @@ -1,3 +1,3 @@ library protocol_handler_windows; -export 'src/protocol_handler_windows.dart'; +export 'src/protocol_handler_helper.dart'; diff --git a/packages/protocol_handler_windows/lib/src/protocol_handler_helper.dart b/packages/protocol_handler_windows/lib/src/protocol_handler_helper.dart new file mode 100644 index 0000000..baa6425 --- /dev/null +++ b/packages/protocol_handler_windows/lib/src/protocol_handler_helper.dart @@ -0,0 +1,3 @@ +export 'protocol_handler_helper.dart' + if (dart.library.ffi) 'protocol_handler_helpter_ffi.dart' + if (dart.library.html) 'protocol_handler_helper_web.dart'; diff --git a/packages/protocol_handler_windows/lib/src/protocol_handler_helper_web.dart b/packages/protocol_handler_windows/lib/src/protocol_handler_helper_web.dart new file mode 100644 index 0000000..3f34bde --- /dev/null +++ b/packages/protocol_handler_windows/lib/src/protocol_handler_helper_web.dart @@ -0,0 +1,14 @@ +import 'package:protocol_handler_platform_interface/protocol_handler_platform_interface.dart'; + +class ProtocolHandlerWindows extends MethodChannelProtocolHandler { + /// The [ProtocolHandlerWindows] constructor. + ProtocolHandlerWindows() : super(); + + static void registerWith() { + ProtocolHandlerPlatform.instance = ProtocolHandlerWindows(); + } + + Future register(String scheme, {String? friendlyAppName}) async { + // Web implementation does nothing. + } +} diff --git a/packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart b/packages/protocol_handler_windows/lib/src/protocol_handler_helpter_ffi.dart similarity index 100% rename from packages/protocol_handler_windows/lib/src/protocol_handler_windows.dart rename to packages/protocol_handler_windows/lib/src/protocol_handler_helpter_ffi.dart