diff --git a/.editorconfig b/.editorconfig index 8419a67..87c4c7e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ root = true [*] charset = utf-8 -end_of_line = crlf +end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f1f03e..fa56ff3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,17 +27,13 @@ jobs: with: flutter-version: ${{ env.FLUTTER_VERSION }} channel: 'stable' - - name: Mkdir core - run: mkdir core - name: Build env: VERSION: ${{ needs.get-release.outputs.tag_name }} run: | - pushd core curl -L "https://github.com/mapleafgo/cff-core/releases/download/$env:CORE_VERSION/libclash-$env:CORE_VERSION-windows-amd64.tar.gz" -o "libclash.tar.gz" tar -zxf libclash.tar.gz - mv build/*.dll libclash.dll - popd + mv build/*.dll windows/core/libclash.dll Invoke-WebRequest -Uri "https://github.com/jrsoftware/issrc/raw/main/Files/Languages/Unofficial/ChineseSimplified.isl" -OutFile "ChineseSimplified.isl" mv ChineseSimplified.isl "C:\Program Files (x86)\Inno Setup 6\Languages\" @@ -133,8 +129,6 @@ jobs: sudo apt-get update -y sudo apt-get install -y locate ninja-build libgtk-3-dev libayatana-appindicator3-dev libnotify-dev \ binutils coreutils desktop-file-utils fakeroot fuse libgdk-pixbuf2.0-dev patchelf python3-pip python3-setuptools squashfs-tools strace util-linux zsync - - name: Mkdir core - run: mkdir core - name: Build env: VERSION: ${{ needs.get-release.outputs.tag_name }} @@ -142,47 +136,9 @@ jobs: curl -L https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -o /usr/local/bin/appimagetool chmod +x /usr/local/bin/appimagetool - pushd core curl -L https://github.com/mapleafgo/cff-core/releases/download/$CORE_VERSION/libclash-$CORE_VERSION-linux-amd64.tar.gz -o libclash.tar.gz tar -zxf libclash.tar.gz - mv build/*.so libclash.so - popd - - dart pub global activate flutter_distributor - flutter_distributor package --platform=linux --targets=appimage,zip - - name: Upload - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ needs.get-release.outputs.upload_url }} - asset_path: dist/*/* - overwrite: true - build-linux-arm64: - runs-on: ubuntu-20.04 - needs: [ get-release ] - steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 - with: - flutter-version: ${{ env.FLUTTER_VERSION }} - channel: 'stable' - - run: | - sudo apt-get update -y - sudo apt-get install -y locate ninja-build libgtk-3-dev libayatana-appindicator3-dev libnotify-dev \ - binutils coreutils desktop-file-utils fakeroot fuse libgdk-pixbuf2.0-dev patchelf python3-pip python3-setuptools squashfs-tools strace util-linux zsync - - name: Mkdir core - run: mkdir core - - name: Build - env: - VERSION: ${{ needs.get-release.outputs.tag_name }} - run: | - curl -L https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -o /usr/local/bin/appimagetool - chmod +x /usr/local/bin/appimagetool - - pushd core - curl -L https://github.com/mapleafgo/cff-core/releases/download/$CORE_VERSION/libclash-$CORE_VERSION-linux-arm64.tar.gz -o libclash.tar.gz - tar -zxf libclash.tar.gz - mv build/*.so libclash.so - popd + mv build/*.so linux/core/libclash.so dart pub global activate flutter_distributor flutter_distributor package --platform=linux --targets=appimage,zip @@ -253,7 +209,7 @@ jobs: upload_url: ${{ needs.get-release.outputs.upload_url }} asset_path: build/macos/Build/Products/Release/dist/*.dmg overwrite: true - build-android: + build-android-arm64: runs-on: ubuntu-latest needs: [ get-release ] steps: @@ -266,20 +222,13 @@ jobs: with: flutter-version: ${{ env.FLUTTER_VERSION }} channel: 'stable' - - name: Mkdir core - run: mkdir core - name: Build env: VERSION: ${{ needs.get-release.outputs.tag_name }} run: | - pushd core curl -L https://github.com/mapleafgo/cff-core/releases/download/$CORE_VERSION/libclash-$CORE_VERSION-android-arm64.tar.gz -o libclash.tar.gz tar -zxf libclash.tar.gz - mv build/*.aar libclash.aar - popd - - mkdir -p android/app/libs - mv core/libclash.aar android/app/libs/libclash.aar + mv build/*.aar android/app/libs/libclash.aar flutter build apk --release --target-platform android-arm64 cd build/app/outputs/flutter-apk @@ -290,3 +239,33 @@ jobs: upload_url: ${{ needs.get-release.outputs.upload_url }} asset_path: build/app/outputs/flutter-apk/*.apk overwrite: true + build-android-x64: + runs-on: ubuntu-latest + needs: [ get-release ] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + distribution: "liberica" + java-version: "17" + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + channel: 'stable' + - name: Build + env: + VERSION: ${{ needs.get-release.outputs.tag_name }} + run: | + curl -L https://github.com/mapleafgo/cff-core/releases/download/$CORE_VERSION/libclash-$CORE_VERSION-android-amd64.tar.gz -o libclash.tar.gz + tar -zxf libclash.tar.gz + mv build/*.aar android/app/libs/libclash.aar + + flutter build apk --release --target-platform android-x64 + cd build/app/outputs/flutter-apk + mv app-release.apk clash_for_flutter-$VERSION-x64.apk + - name: Upload + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ needs.get-release.outputs.upload_url }} + asset_path: build/app/outputs/flutter-apk/*.apk + overwrite: true diff --git a/.gitignore b/.gitignore index ff4da2a..c4ced68 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ app.*.map.json /appimage-build/ /AppDir/ + +libclash.* diff --git a/README.md b/README.md index 8a20e65..ed2b3f6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Clash for Flutter -这是一个 **Clash** 的桌面客户端,支持 windows、linux、macos。 +这是一个 **Clash** 的多平台客户端,支持 windows、linux、macos、android、~~ios~~。 > [使用说明](https://mapleafgo.github.io/clash-for-flutter) @@ -10,6 +10,10 @@ ![代理页](./docs/images/proxy_page.png) +![代理页](./docs/images/log_page.png) + +![连接页](./docs/images/connect_page.png) + ![订阅页](./docs/images/profile_page.png) ![设置页](./docs/images/settings_page.png) @@ -18,10 +22,33 @@ - 基础环境 - `GCC`、`Go v1.20+`、`Flutter v3.10+` + `Flutter v3.16+` + + > 对目标平台时,需要参照 Flutter 官方文档进行对应平台的环境搭建。如 Android 开发时,需要 Android-SDK > `Linux`环境下 [tray_manager](https://github.com/leanflutter/tray_manager) 需要 `libayatana-appindicator3-dev` - or `libappindicator3-dev` + +- 下载内核 + + 从 https://github.com/mapleafgo/cff-core/releases/latest 下载对应平台需要的内核, + 然后将解压出来的内核文件移动到对应的路径,各平台路径如下: + + ```shell + # windows + windows/core/libclash.dll + # linux + linux/core/libclash.so + # android + android/app/libs/libclash.aar + # macos + macos/Frameworks/libclash.dylib + # ios + ios/Frameworks/libclash.xcframework + ``` + + > 注意:解压出来的文件,仅保留所需的后缀名文件即可,且将其改名为路径的文件名 + + > 内核是在 Clash v1.18.0 (非premium) 的基础上进行二次开发的,仅加入了 tun 模式(参照 Meta 进行) - 编译项目 @@ -31,25 +58,13 @@ # 2. 生成 .g.dart 文件 $ dart run build_runner build --delete-conflicting-outputs - # 3. 编译 Clash 内核 - $ cd core - # windows - $ go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.dll - # Linux - $ go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.so - # macos - $ go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.dylib - - # 回到项目根目录 - $ cd ../ - # macos 系统需要移动下编译的内核路径 - $ cp -f ./core/dist/libclash.dylib ./macos/Frameworks/libclash.dylib - - # 4. 运行项目 (linux) + # 3. 运行项目 (linux) $ flutter run -d linux - # 4. 运行项目 (windows) + # 3. 运行项目 (windows) $ flutter run -d windows - # 4. 运行项目 (macos) + # 3. 运行项目 (android) + $ flutter run -d android + # 3. 运行项目 (macos) $ flutter run -d macos ``` @@ -62,10 +77,11 @@ - [Go](https://go.dev/) - [Clash](https://github.com/Dreamacro/clash) - [Flutter](https://flutter.dev) -- [system_tray](https://github.com/antler119/system_tray) +- [tray_manager](https://github.com/leanflutter/tray_manager) - [window_manager](https://github.com/leanflutter/window_manager) - [proxy_manager](https://github.com/Kingtous/proxy_manager) - [flutter_modular](https://github.com/Flutterando/modular) +- [dio](https://github.com/cfug/dio) - [flutter_distributor](https://distributor.leanflutter.org/) ## 写在后面 diff --git a/android/app/libs/.gitkeep b/android/app/libs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/README.md b/docs/README.md index b990966..c47bed3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,23 +1,23 @@ # Clash for Flutter -> 该软件是 Clash 的桌面端实现,使用[Flutter](https://flutter.dev/)开发。支持 Windows、~~Linux、MacOS~~ +> 该软件是 Clash 的多平台端实现,使用[Flutter](https://flutter.dev/)开发。支持 Windows、Linux、MacOS、Android、~~IOS~~ ### 下载 -当前下载页面都只提供了 64 位的安装包[releases](https://github.com/mapleafgo/clash-for-flutter/releases) +当前下载页面都只提供了 64 位的安装包[releases](https://github.com/mapleafgo/clash-for-flutter/releases/latest) ,由于当前是我自己手动在各个平台打包,所以做不到每个版本都提供的了安装包 -~~- Linux:~~ +- Linux: -~~linux 安装包目前打包的为`appimage`的,这种包各个发行版都能直接使用~~ + linux 安装包目前打包的为`appimage`的,这种包各个发行版都能直接使用 - Windows: windows 提供的是`msi`包 -~~- MacOS:~~ +- MacOS: -~~macos 提供的是`dmg`包~~ + macos 提供的是`dmg`包 ### 开始使用 @@ -60,7 +60,7 @@ - 代理端口 - 对于代理端口,其它都默认为 0 就可以(设置为 0 表示不开启),只需要注意 Mixed。Mixed 是一个复合代理端口,它一个就可以转发 http/https/socks 的所有业务 + 对于代理端口,默认为 7890 (设置为 0 表示不开启) 至于 Redir 和 Tproxy 的代理,目前我没用到过,都是默认为 0 的状态,这里就引入 Clash 官方的话来解释这两个吧 ```yaml diff --git a/docs/images/connect_page.png b/docs/images/connect_page.png new file mode 100644 index 0000000..ec9d160 Binary files /dev/null and b/docs/images/connect_page.png differ diff --git a/docs/images/home_page.png b/docs/images/home_page.png index 2f143c2..7d834e4 100644 Binary files a/docs/images/home_page.png and b/docs/images/home_page.png differ diff --git a/docs/images/log_page.png b/docs/images/log_page.png new file mode 100644 index 0000000..4f35502 Binary files /dev/null and b/docs/images/log_page.png differ diff --git a/docs/images/profile_menu.png b/docs/images/profile_menu.png deleted file mode 100644 index 3fd6689..0000000 Binary files a/docs/images/profile_menu.png and /dev/null differ diff --git a/docs/images/profile_page.png b/docs/images/profile_page.png index 7c39731..80d3f30 100644 Binary files a/docs/images/profile_page.png and b/docs/images/profile_page.png differ diff --git a/docs/images/proxy_page.png b/docs/images/proxy_page.png index a99a808..3469e99 100644 Binary files a/docs/images/proxy_page.png and b/docs/images/proxy_page.png differ diff --git a/docs/images/settings_page.png b/docs/images/settings_page.png index 2e8d310..29ff106 100644 Binary files a/docs/images/settings_page.png and b/docs/images/settings_page.png differ diff --git a/lib/app/pages/index/index_page_desktop.dart b/lib/app/pages/index/index_page_desktop.dart index 51c1723..50aad5d 100644 --- a/lib/app/pages/index/index_page_desktop.dart +++ b/lib/app/pages/index/index_page_desktop.dart @@ -48,6 +48,7 @@ class _IndexDesktopPageState extends State @override void dispose() { + _tray.dispose(); windowManager.removeListener(this); protocolHandler.removeListener(this); WidgetsBinding.instance.removeObserver(this); diff --git a/lib/app/pages/index/tray_controller.dart b/lib/app/pages/index/tray_controller.dart index 84124ba..4fcdb23 100644 --- a/lib/app/pages/index/tray_controller.dart +++ b/lib/app/pages/index/tray_controller.dart @@ -5,82 +5,114 @@ import 'package:clash_for_flutter/app/source/app_config.dart'; import 'package:clash_for_flutter/app/source/core_config.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:mobx/mobx.dart'; -import 'package:system_tray/system_tray.dart'; +import 'package:tray_manager/tray_manager.dart'; import 'package:window_manager/window_manager.dart'; /// 托盘菜单控制类 -class TrayController { - final SystemTray _tray = SystemTray(); +class TrayController extends Disposable with TrayListener { final _config = Modular.get(); final _core = Modular.get(); - void init() { + Future init() async { + trayManager.addListener(this); // 监听系统代理 reaction( (_) => _config.systemProxy, - (status) => _menuReset(isChecked: status, mode: _core.clash.mode ?? Mode.Rule), + (status) { + _menuReset(isChecked: status, mode: _core.clash.mode ?? Mode.Rule); + }, ); // 监听代理模式 reaction( (_) => _core.clash.mode, - (mode) => _menuReset(isChecked: _config.systemProxy, mode: mode ?? Mode.Rule), + (mode) { + _menuReset(isChecked: _config.systemProxy, mode: mode ?? Mode.Rule); + }, ); - _tray.initSystemTray( - iconPath: Platform.isWindows ? 'assets/icon.ico' : 'assets/logo_64.png', - toolTip: "Clash for Flutter", + await trayManager.setIcon( + Platform.isWindows ? 'assets/icon.ico' : 'assets/logo_64.png', ); - _tray.registerSystemTrayEventHandler((e) { - if (e == kSystemTrayEventClick) { - windowManager.show(); - } else if (e == kSystemTrayEventRightClick) { - _tray.popUpContextMenu(); - } - }); // 初始化托盘菜单 - _menuReset(isChecked: _config.systemProxy, mode: _core.clash.mode ?? Mode.Rule); + await _menuReset( + isChecked: _config.systemProxy, + mode: _core.clash.mode ?? Mode.Rule, + ); } - void _menuReset({required bool isChecked, required Mode mode}) async { - final menu = Menu(); - await menu.buildFrom([ - MenuItemLabel(label: "显示窗口", onClicked: (_) => windowManager.show()), - MenuSeparator(), - MenuItemCheckbox( - label: "代理", - checked: isChecked, - onClicked: (b) async { - if (b.checked) { - await _config.closeProxy(); - } else { - await _config.openProxy(); - } - }, - ), - SubMenu(label: "模式", children: [ - MenuItemCheckbox( - checked: mode == Mode.Rule, - label: Mode.Rule.value, - onClicked: (_) => _core.setState(mode: Mode.Rule), - ), - MenuItemCheckbox( - checked: mode == Mode.Global, - label: Mode.Global.value, - onClicked: (_) => _core.setState(mode: Mode.Global), + @override + void dispose() { + trayManager.removeListener(this); + } + + Future _menuReset({required bool isChecked, required Mode mode}) async { + final Menu menu = Menu( + items: [ + MenuItem( + key: 'show_window', + label: '显示窗口', ), - MenuItemCheckbox( - checked: mode == Mode.Direct, - label: Mode.Direct.value, - onClicked: (_) => _core.setState(mode: Mode.Direct), + MenuItem.separator(), + MenuItem.checkbox(key: 'proxy', label: '代理', checked: isChecked), + MenuItem.submenu( + label: '模式', + submenu: Menu( + items: [ + MenuItem.checkbox( + key: Mode.Rule.value, + label: Mode.Rule.value, + checked: mode == Mode.Rule, + ), + MenuItem.checkbox( + key: Mode.Global.value, + label: Mode.Global.value, + checked: mode == Mode.Global, + ), + MenuItem.checkbox( + key: Mode.Direct.value, + label: Mode.Direct.value, + checked: mode == Mode.Direct, + ), + ], + ), ), - ]), - MenuItemLabel( - label: "退出", - onClicked: (_) async { - await _config.closeProxy(); - windowManager.close().then((_) => windowManager.destroy()); - }, - ), - ]); - await _tray.setContextMenu(menu); + MenuItem( + label: '退出', + key: 'exit_app', + ) + ], + ); + await trayManager.setContextMenu(menu); + } + + @override + void onTrayIconMouseDown() { + windowManager.show(); + } + + @override + void onTrayIconRightMouseDown() { + trayManager.popUpContextMenu(); + } + + @override + void onTrayMenuItemClick(MenuItem menuItem) async { + if (menuItem.key == 'show_window') { + windowManager.show(); + } else if (menuItem.key == 'proxy') { + if (menuItem.checked ?? false) { + await _config.closeProxy(); + } else { + await _config.openProxy(); + } + } else if (menuItem.key == 'exit_app') { + await _config.closeProxy(); + windowManager.close().then((_) => windowManager.destroy()); + } else if (menuItem.key == Mode.Rule.value) { + _core.setState(mode: Mode.Rule); + } else if (menuItem.key == Mode.Global.value) { + _core.setState(mode: Mode.Global); + } else if (menuItem.key == Mode.Direct.value) { + _core.setState(mode: Mode.Direct); + } } } diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 871ad12..5851e68 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -116,7 +116,7 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR} install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -install(FILES "../core/libclash.so" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" +install(FILES "core/libclash.so" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) diff --git a/linux/core/.gitkeep b/linux/core/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index dee0595..834cf86 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -27,9 +27,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) screen_retriever_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); - g_autoptr(FlPluginRegistrar) system_tray_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "SystemTrayPlugin"); - system_tray_plugin_register_with_registrar(system_tray_registrar); + g_autoptr(FlPluginRegistrar) tray_manager_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "TrayManagerPlugin"); + tray_manager_plugin_register_with_registrar(tray_manager_registrar); g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 3a1ec60..9e3ec81 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -7,7 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST local_notifier proxy_manager screen_retriever - system_tray + tray_manager url_launcher_linux window_manager ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 91aa0e5..bafe166 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -12,7 +12,7 @@ import path_provider_foundation import protocol_handler import proxy_manager import screen_retriever -import system_tray +import tray_manager import url_launcher_macos import window_manager @@ -24,7 +24,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ProtocolHandlerPlugin.register(with: registry.registrar(forPlugin: "ProtocolHandlerPlugin")) ProxyManagerPlugin.register(with: registry.registrar(forPlugin: "ProxyManagerPlugin")) ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin")) - SystemTrayPlugin.register(with: registry.registrar(forPlugin: "SystemTrayPlugin")) + TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index bd884eb..5abd585 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -93,18 +93,18 @@ packages: dependency: transitive description: name: build_resolvers - sha256: "64e12b0521812d1684b1917bc80945625391cb9bdd4312536b1d69dcb6133ed8" + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.1" + version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" + sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.6" + version: "2.4.8" build_runner_core: dependency: transitive description: @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: built_value - sha256: "69acb7007eb2a31dc901512bfe0f7b767168be34cb734835d54c070bfa74c1b2" + sha256: a3ec2e0f967bc47f69f95009bb93db936288d61d5343b9436e378b28a2f830c6 url: "https://pub.flutter-io.cn" source: hosted - version: "8.8.0" + version: "8.9.0" characters: dependency: transitive description: @@ -157,10 +157,10 @@ packages: dependency: transitive description: name: cli_util - sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.0" + version: "0.4.1" clock: dependency: transitive description: @@ -173,10 +173,10 @@ packages: dependency: transitive description: name: code_builder - sha256: b2151ce26a06171005b379ecff6e08d34c470180ffe16b8e14b6d52be292b55f + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 url: "https://pub.flutter-io.cn" source: hosted - version: "4.8.0" + version: "4.10.0" collection: dependency: transitive description: @@ -237,10 +237,10 @@ packages: dependency: "direct main" description: name: data_table_2 - sha256: "3ce61e066aba255b2b346a62984dfb0effddb8ca34c123c23c5c3d0f3c4e9fb7" + sha256: cec4010dd756bd7d0cc3eb8a30932b8109608132c6c8d643e80ea412d3e51a9c url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.9" + version: "2.5.10" dcli_core: dependency: transitive description: @@ -261,10 +261,10 @@ packages: dependency: "direct main" description: name: dio - sha256: "01870acd87986f768e0c09cc4d7a19a59d814af7b34cbeb0b437d2c33bdfea4c" + sha256: "797e1e341c3dd2f69f2dad42564a6feff3bfb87187d05abb93b9609e6f1645c3" url: "https://pub.flutter-io.cn" source: hosted - version: "5.3.4" + version: "5.4.0" easy_sidemenu: dependency: "direct main" description: @@ -277,10 +277,10 @@ packages: dependency: "direct main" description: name: extended_text - sha256: "7096a1e9a029534257d70f7dafb2798f932d589079e67ef3f58fdf0805f2f627" + sha256: "4a7b0338de2a72f690925381ec5f515ca425c011c269971406db1a038fd108fc" url: "https://pub.flutter-io.cn" source: hosted - version: "12.0.0" + version: "12.0.1" extended_text_library: dependency: transitive description: @@ -309,10 +309,10 @@ packages: dependency: "direct dev" description: name: ffigen - sha256: "0a4e9c5437c5c4600fa583141508beaf90fe29b58b0fd7437a9b022cda228747" + sha256: dead012f29db2be71ea152458f5eab600de98fbc244e01088ae6bf2616bceca7 url: "https://pub.flutter-io.cn" source: hosted - version: "10.0.0" + version: "11.0.0" file: dependency: transitive description: @@ -359,10 +359,10 @@ packages: dependency: "direct main" description: name: flutter_mobx - sha256: d1d379561fe84675cc099bc42e99456f73a77fff475d0e2e9bda271751a11a91 + sha256: "4a5d062ff85ed3759f4aac6410ff0ffae32e324b2e71ca722ae1b37b32e865f4" url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.0" + version: "2.2.0+2" flutter_modular: dependency: "direct main" description: @@ -425,10 +425,10 @@ packages: dependency: transitive description: name: http - sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.2.0" http_multi_server: dependency: transitive description: @@ -465,10 +465,10 @@ packages: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: "4186c61b32f99e60f011f7160e32c89a758ae9b1d0c6d28e2c02ef0382300e2b" url: "https://pub.flutter-io.cn" source: hosted - version: "0.6.7" + version: "0.7.0" json_annotation: dependency: transitive description: @@ -525,6 +525,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.5.0" + menu_base: + dependency: transitive + description: + name: menu_base + sha256: "820368014a171bd1241030278e6c2617354f492f5c703d7b7d4570a6b8b84405" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.1" meta: dependency: transitive description: @@ -537,26 +545,26 @@ packages: dependency: transitive description: name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.4" + version: "1.0.5" mobx: dependency: "direct main" description: name: mobx - sha256: "42ae7277ec5c36fa5ce02aa14551065babce3c38a35947330144ff47bc775c75" + sha256: "74ee54012dc7c1b3276eaa960a600a7418ef5f9997565deb8fca1fd88fb36b78" url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.1" + version: "2.3.0+1" mobx_codegen: dependency: "direct dev" description: name: mobx_codegen - sha256: "52a6904b93fa1ceadc5ed4cd67e24fd05a21340d39cff0a213179fc83e179dba" + sha256: b26c7f9c20b38f0ea572c1ed3f29d8e027cb265538bbd1aed3ec198642cfca42 url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.0" + version: "2.6.0+1" modular_core: dependency: transitive description: @@ -609,26 +617,26 @@ packages: dependency: "direct main" description: name: path_provider - sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.1" + version: "2.2.2" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.1" + version: "2.3.2" path_provider_linux: dependency: transitive description: @@ -641,10 +649,10 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_windows: dependency: transitive description: @@ -657,18 +665,18 @@ packages: dependency: transitive description: name: platform - sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.3" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.7" + version: "2.1.8" pool: dependency: transitive description: @@ -681,10 +689,10 @@ packages: dependency: "direct main" description: name: protocol_handler - sha256: be85285f5cdc2541bb5ae5368f1c9924eeaae8d28e74c7235b7cd2c02521d760 + sha256: fb1882bd6cf767114f46b4708d1794fcd662e0a9b9b4512519adeaff3f931d7d url: "https://pub.flutter-io.cn" source: hosted - version: "0.1.5" + version: "0.1.6" provider: dependency: transitive description: @@ -789,6 +797,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" + shortid: + dependency: transitive + description: + name: shortid + sha256: d0b40e3dbb50497dad107e19c54ca7de0d1a274eb9b4404991e443dadb9ebedb + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2" sky_engine: dependency: transitive description: flutter @@ -798,10 +814,10 @@ packages: dependency: transitive description: name: source_gen - sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" url: "https://pub.flutter-io.cn" source: hosted - version: "1.4.0" + version: "1.5.0" source_span: dependency: transitive description: @@ -842,14 +858,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" - system_tray: - dependency: "direct main" - description: - name: system_tray - sha256: "40444e5de8ed907822a98694fd031b8accc3cb3c0baa547634ce76189cf3d9cf" - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.3" term_glyph: dependency: transitive description: @@ -870,10 +878,10 @@ packages: dependency: "direct main" description: name: timeago - sha256: c44b80cbc6b44627c00d76960f2af571f6f50e5dbedef4d9215d455e4335165b + sha256: d3204eb4c788214883380253da7f23485320a58c11d145babc82ad16bf4e7764 url: "https://pub.flutter-io.cn" source: hosted - version: "3.6.0" + version: "3.6.1" timing: dependency: transitive description: @@ -882,6 +890,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" + tray_manager: + dependency: "direct main" + description: + name: tray_manager + sha256: "4ab709d70a4374af172f8c39e018db33a4271265549c6fc9d269a65e5f4b0225" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.2.1" typed_data: dependency: transitive description: @@ -894,34 +910,34 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: b1c9e98774adf8820c96fbc7ae3601231d324a7d5ebd8babe27b6dfac91357ba + sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c url: "https://pub.flutter-io.cn" source: hosted - version: "6.2.1" + version: "6.2.4" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" + sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f" url: "https://pub.flutter-io.cn" source: hosted - version: "6.2.0" + version: "6.2.2" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: bba3373219b7abb6b5e0d071b0fe66dfbe005d07517a68e38d4fc3638f35c6d3 + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" url: "https://pub.flutter-io.cn" source: hosted - version: "6.2.1" + version: "6.2.4" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd" + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.0" + version: "3.1.1" url_launcher_macos: dependency: transitive description: @@ -934,26 +950,26 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" + sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.0" + version: "2.3.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "138bd45b3a456dcfafc46d1a146787424f8d2edfbf2809c9324361e58f851cf7" + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.1" + version: "2.2.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc" + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.0" + version: "3.1.1" uuid: dependency: transitive description: @@ -998,10 +1014,10 @@ packages: dependency: transitive description: name: win32 - sha256: "7c99c0e1e2fa190b48d25c81ca5e42036d5cac81430ef249027d97b0935c553f" + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" url: "https://pub.flutter-io.cn" source: hosted - version: "5.1.0" + version: "5.2.0" win32_registry: dependency: transitive description: @@ -1014,18 +1030,18 @@ packages: dependency: "direct main" description: name: window_manager - sha256: dcc865277f26a7dad263a47d0e405d77e21f12cb71f30333a52710a408690bd7 + sha256: b3c895bdf936c77b83c5254bec2e6b3f066710c1f89c38b20b8acc382b525494 url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.7" + version: "0.3.8" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.3" + version: "1.0.4" yaml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 395f70b..450a9a1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,128 +1,128 @@ -name: clash_for_flutter -description: A multi-platform Clash client. - -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. -version: 1.2.7 - -environment: - sdk: '>=3.2.0 <4.0.0' - -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. -dependencies: - flutter: - sdk: flutter - flutter_localizations: - sdk: flutter - - window_manager: ^0.3.7 - launch_at_startup: ^0.2.2 - system_tray: ^2.0.3 - desktop_lifecycle: ^0.1.1 - proxy_manager: ^0.0.3 - local_notifier: ^0.1.5 - - dio: ^5.3.3 - flutter_modular: ^6.3.2 - path_provider: ^2.1.0 - ffi: ^2.1.0 - protocol_handler: ^0.1.5 - file_picker: ^6.1.1 - package_info_plus: ^5.0.1 - url_launcher: ^6.2.1 - web_socket_channel: ^2.4.0 - - dart_json_mapper: ^2.2.9 - dart_json_mapper_mobx: ^2.0.5 - mobx: ^2.2.1 - flutter_mobx: ^2.0.6+5 - - easy_sidemenu: ^0.5.0 - asuka: ^2.2.0 - settings_yaml: ^7.0.0 - settings_ui: ^2.0.2 - cupertino_icons: ^1.0.6 - data_table_2: ^2.5.8 - timeago: ^3.6.0 - flutter_staggered_grid_view: ^0.7.0 - extended_text: ^12.0.0 - -dev_dependencies: - flutter_test: - sdk: flutter - - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. - flutter_lints: ^3.0.1 - build_runner: ^2.4.6 - ffigen: ^10.0.0 - mobx_codegen: ^2.3.0 - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. -flutter: - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - uses-material-design: true - # To add assets to your application, add an assets section, like this: - assets: - - assets/ - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages - -ffigen: - name: "Clash" - output: 'lib/clash_generated_bindings.dart' - headers: - entry-points: - - 'core/libclash.h' - llvm-path: - - 'D:\Scoop\apps\llvm\current' +name: clash_for_flutter +description: A multi-platform Clash client. + +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.2.7 + +environment: + sdk: '>=3.2.0 <4.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + flutter_localizations: + sdk: flutter + + window_manager: ^0.3.8 + launch_at_startup: ^0.2.2 + tray_manager: ^0.2.1 + desktop_lifecycle: ^0.1.1 + proxy_manager: ^0.0.3 + local_notifier: ^0.1.5 + + dio: ^5.3.3 + flutter_modular: ^6.3.2 + path_provider: ^2.1.0 + ffi: ^2.1.0 + file_picker: ^6.1.1 + package_info_plus: ^5.0.1 + url_launcher: ^6.2.1 + web_socket_channel: ^2.4.0 + + dart_json_mapper: ^2.2.9 + dart_json_mapper_mobx: ^2.0.5 + mobx: ^2.2.1 + flutter_mobx: ^2.0.6+5 + + easy_sidemenu: ^0.5.0 + asuka: ^2.2.0 + settings_yaml: ^7.0.0 + settings_ui: ^2.0.2 + cupertino_icons: ^1.0.6 + data_table_2: ^2.5.8 + timeago: ^3.6.0 + flutter_staggered_grid_view: ^0.7.0 + extended_text: ^12.0.0 + protocol_handler: 0.1.6 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^3.0.1 + build_runner: ^2.4.6 + ffigen: ^11.0.0 + mobx_codegen: ^2.3.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + # To add assets to your application, add an assets section, like this: + assets: + - assets/ + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages + +ffigen: + name: "Clash" + output: 'lib/clash_generated_bindings.dart' + headers: + entry-points: + - 'core/libclash.h' + llvm-path: + - 'D:\Scoop\apps\llvm\current' diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 446fa3e..b677311 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -80,7 +80,7 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR} install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -install(FILES "../core/libclash.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" +install(FILES "core/libclash.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) diff --git a/windows/core/.gitkeep b/windows/core/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 7b6c4ca..cf1fd7d 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -26,8 +26,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("ProxyManagerPlugin")); ScreenRetrieverPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); - SystemTrayPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("SystemTrayPlugin")); + TrayManagerPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("TrayManagerPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); WindowManagerPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 3f04389..ff21c4d 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -8,7 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST protocol_handler proxy_manager screen_retriever - system_tray + tray_manager url_launcher_windows window_manager ) diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp index 0c82bf2..323ee31 100644 --- a/windows/runner/main.cpp +++ b/windows/runner/main.cpp @@ -5,15 +5,11 @@ #include "flutter_window.h" #include "utils.h" -#include - int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, _In_ wchar_t *command_line, _In_ int show_command) { // TODO: 单例应用 HWND hwnd = ::FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"clash_for_flutter"); if (hwnd != NULL) { - DispatchToProtocolHandler(hwnd); - ::ShowWindow(hwnd, SW_NORMAL); ::SetForegroundWindow(hwnd); return EXIT_FAILURE;