fix: potential fix to issue in some windows?

This commit is contained in:
Hiddify
2024-03-11 12:40:19 +01:00
parent a5ad15f7c2
commit c7ae444145
2 changed files with 117 additions and 110 deletions

View File

@@ -13,20 +13,24 @@ class DeepLinkNotifier extends _$DeepLinkNotifier
with ProtocolListener, InfraLogger {
@override
Future<NewProfileLink?> build() async {
if (Platform.isLinux) return null;
for (final protocol in LinkParser.protocols) {
await protocolHandler.register(protocol);
}
protocolHandler.addListener(this);
ref.onDispose(() {
protocolHandler.removeListener(this);
});
// if (Platform.isLinux) return null;
try {
for (final protocol in LinkParser.protocols) {
await protocolHandler.register(protocol);
}
protocolHandler.addListener(this);
ref.onDispose(() {
protocolHandler.removeListener(this);
});
final initialPayload = await protocolHandler.getInitialUrl();
if (initialPayload != null) {
loggy.debug('initial payload: [$initialPayload]');
final link = LinkParser.deep(initialPayload);
return link;
final initialPayload = await protocolHandler.getInitialUrl();
if (initialPayload != null) {
loggy.debug('initial payload: [$initialPayload]');
final link = LinkParser.deep(initialPayload);
return link;
}
} catch (e) {
loggy.error("failed to init deeplink", e);
}
return null;
}