llfbandit / app_links

Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
https://pub.dev/packages/app_links
Apache License 2.0
176 stars 68 forks source link

We need a way to manually fire the link event. #83

Closed azeek closed 7 months ago

azeek commented 7 months ago

Is your feature request related to a problem? Please describe. Currently on Windows, the app_link event can only be received on first run.

I want to manually send events to allUriLinkStream.listen.

This is because on desktop platforms, you can only send applink data on the first launch, which prevents duplicate launches, so you can send it to the instance created first via IPC, but there doesn't seem to be a manual way to send it to an allUriLinkStream.

llfbandit commented 7 months ago

You can already catch multiple links on the same instance on Windows. Did you fully follow the Windows setup?

The example provided is already set up in this way.

If you want to manually fire links from your app, you can directly call your processing function on incoming links from the stream.

azeek commented 7 months ago

We have identified the cause: the window_manager package is used to dynamically change the window title name.

When using FindWindow, if you set only the window class name to a unique value, you shouldn't need to find the window handle by the window title name.

win32_windows.cpp

- constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
+ constexpr const wchar_t kWindowClassName[] = L"MySampleClass"; 
- HWND hwnd = ::FindWindow(kWindowClassName, title.c_str());
+ HWND hwnd = ::FindWindow(kWindowClassName, NULL);