win: fix potential bugs
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
0db60865c4
commit
e6d4e5b42c
flutter
@ -1210,23 +1210,21 @@ Future<void> initUniLinks() async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamSubscription listenUniLinks() {
|
StreamSubscription? listenUniLinks() {
|
||||||
if (Platform.isWindows || Platform.isMacOS) {
|
if (!(Platform.isWindows || Platform.isMacOS)) {
|
||||||
final sub = uriLinkStream.listen((Uri? uri) {
|
return null;
|
||||||
if (uri != null) {
|
|
||||||
callUniLinksUriHandler(uri);
|
|
||||||
} else {
|
|
||||||
print("uni listen error: uri is empty.");
|
|
||||||
}
|
|
||||||
}, onError: (err) {
|
|
||||||
print("uni links error: $err");
|
|
||||||
});
|
|
||||||
return sub;
|
|
||||||
} else {
|
|
||||||
// return empty stream subscription for uniform logic
|
|
||||||
final stream = Stream.empty();
|
|
||||||
return stream.listen((event) {/*ignore*/});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final sub = uriLinkStream.listen((Uri? uri) {
|
||||||
|
if (uri != null) {
|
||||||
|
callUniLinksUriHandler(uri);
|
||||||
|
} else {
|
||||||
|
print("uni listen error: uri is empty.");
|
||||||
|
}
|
||||||
|
}, onError: (err) {
|
||||||
|
print("uni links error: $err");
|
||||||
|
});
|
||||||
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkArguments() {
|
void checkArguments() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <flutter/dart_project.h>
|
#include <flutter/dart_project.h>
|
||||||
#include <flutter/flutter_view_controller.h>
|
#include <flutter/flutter_view_controller.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "flutter_window.h"
|
#include "flutter_window.h"
|
||||||
@ -54,7 +55,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
|||||||
// only do uni links when dispatch a rustdesk links
|
// only do uni links when dispatch a rustdesk links
|
||||||
auto prefix = std::string(uniLinksPrefix);
|
auto prefix = std::string(uniLinksPrefix);
|
||||||
if (!command_line_arguments.empty() && command_line_arguments.front().compare(0, prefix.size(), prefix.c_str()) == 0) {
|
if (!command_line_arguments.empty() && command_line_arguments.front().compare(0, prefix.size(), prefix.c_str()) == 0) {
|
||||||
HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"rustdesk");
|
HWND hwnd = ::FindWindow(_T("FLUTTER_RUNNER_WIN32_WINDOW"), _T("RustDesk"));
|
||||||
if (hwnd != NULL) {
|
if (hwnd != NULL) {
|
||||||
DispatchToUniLinksDesktop(hwnd);
|
DispatchToUniLinksDesktop(hwnd);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user