diff --git a/go.sum b/go.sum index fe369b9f54..b310192ba7 100644 --- a/go.sum +++ b/go.sum @@ -315,7 +315,7 @@ github.com/getlantern/fdcount v0.0.0-20210503151800-5decd65b3731/go.mod h1:XZwE+ github.com/getlantern/filepersist v0.0.0-20160317154340-c5f0cd24e799/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8= github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c h1:mcz27xtAkb1OuOLBct/uFfL1p3XxAIcFct82GbT+UZM= github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8= -github.com/getlantern/flashlight/v7 v7.6.173 h1:JvFMZlysbBcURai0JsuIrnlku6EUsbWuqcSn3aTbcYI= +github.com/getlantern/flashlight/v7 v7.6.173 h1:xb/F7mTjI+w1yXht/P2bNnVluRvg5tz537e1gdv7+28= github.com/getlantern/flashlight/v7 v7.6.173/go.mod h1:2HDjD6lx7W5hbTh3Vg572bHVFd9YZ4YODLl2b+d7JBw= github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede h1:yrU6Px3ZkvCsDLPryPGi6FN+2iqFPq+JeCb7EFoDBhw= github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede/go.mod h1:nhnoiS6DE6zfe+BaCMU4YI01UpsuiXnDqM5S8jxHuuI= diff --git a/liblantern.dll b/liblantern.dll new file mode 100644 index 0000000000..8d8610806e Binary files /dev/null and b/liblantern.dll differ diff --git a/windows/packaging/msix/make_config.yaml b/windows/packaging/msix/make_config.yaml index d3ab30c377..1808b84f2d 100644 --- a/windows/packaging/msix/make_config.yaml +++ b/windows/packaging/msix/make_config.yaml @@ -3,5 +3,7 @@ msix_version: 2.1.5.0 publisher_display_name: lantern identity_name: org.getlantern.lantern logo_path: windows/runner/resources/app_icon.ico +protocol_activation: https +app_uri_handler_hosts: www.lantern.io, lantern.io # Add the app uri handler hosts. You capabilities: internetClient, internetClientServer, privateNetworkClientServer install_certificate: "false" \ No newline at end of file diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp index 554797e152..fd56925ca3 100644 --- a/windows/runner/main.cpp +++ b/windows/runner/main.cpp @@ -7,6 +7,42 @@ #include "app_links/app_links_plugin_c_api.h" +bool SendAppLinkToInstance(const std::wstring& title) { + // Find our exact window + HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", title.c_str()); + + if (hwnd) { + // Dispatch new link to current window + SendAppLink(hwnd); + + // (Optional) Restore our window to front in same state + WINDOWPLACEMENT place = { sizeof(WINDOWPLACEMENT) }; + GetWindowPlacement(hwnd, &place); + + switch(place.showCmd) { + case SW_SHOWMAXIMIZED: + ShowWindow(hwnd, SW_SHOWMAXIMIZED); + break; + case SW_SHOWMINIMIZED: + ShowWindow(hwnd, SW_RESTORE); + break; + default: + ShowWindow(hwnd, SW_NORMAL); + break; + } + + SetWindowPos(0, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE); + SetForegroundWindow(hwnd); + // END (Optional) Restore + + // Window has been found, don't create another one. + return true; + } + + return false; +} + + int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, _In_ wchar_t *command_line, _In_ int show_command) { // You may ignore the result if you need to create another window. @@ -49,37 +85,3 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, return EXIT_SUCCESS; } -bool SendAppLinkToInstance(const std::wstring& title) { - // Find our exact window - HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", title.c_str()); - - if (hwnd) { - // Dispatch new link to current window - SendAppLink(hwnd); - - // (Optional) Restore our window to front in same state - WINDOWPLACEMENT place = { sizeof(WINDOWPLACEMENT) }; - GetWindowPlacement(hwnd, &place); - - switch(place.showCmd) { - case SW_SHOWMAXIMIZED: - ShowWindow(hwnd, SW_SHOWMAXIMIZED); - break; - case SW_SHOWMINIMIZED: - ShowWindow(hwnd, SW_RESTORE); - break; - default: - ShowWindow(hwnd, SW_NORMAL); - break; - } - - SetWindowPos(0, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE); - SetForegroundWindow(hwnd); - // END (Optional) Restore - - // Window has been found, don't create another one. - return true; - } - - return false; -}