revert changes for test

This commit is contained in:
Hiddify
2024-03-11 15:40:29 +01:00
parent 9d2097a425
commit 291bc46d19
3 changed files with 111 additions and 126 deletions

View File

@@ -13,24 +13,21 @@ class DeepLinkNotifier extends _$DeepLinkNotifier
with ProtocolListener, InfraLogger {
@override
Future<NewProfileLink?> build() async {
// if (Platform.isLinux) return null;
try {
for (final protocol in LinkParser.protocols) {
await protocolHandler.register(protocol);
}
protocolHandler.addListener(this);
ref.onDispose(() {
protocolHandler.removeListener(this);
});
if (Platform.isLinux) return null;
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);
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;
}
return null;
}