web uni link (#9697)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-10-19 15:32:17 +08:00 committed by GitHub
parent 8c8a643cce
commit 1212d9fa2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 70 additions and 3 deletions

View file

@ -2038,6 +2038,8 @@ Future<bool> restoreWindowPosition(WindowType type,
return false;
}
var webInitialLink = "";
/// Initialize uni links for macos/windows
///
/// [Availability]
@ -2054,7 +2056,12 @@ Future<bool> initUniLinks() async {
if (initialLink == null || initialLink.isEmpty) {
return false;
}
return handleUriLink(uriString: initialLink);
if (isWeb) {
webInitialLink = initialLink;
return false;
} else {
return handleUriLink(uriString: initialLink);
}
} catch (err) {
debugPrintStack(label: "$err");
return false;
@ -2067,7 +2074,7 @@ Future<bool> initUniLinks() async {
///
/// Returns a [StreamSubscription] which can listen the uni links.
StreamSubscription? listenUniLinks({handleByFlutter = true}) {
if (isLinux) {
if (isLinux || isWeb) {
return null;
}