Files
Flutter_Shell/README.md
Booker a1e7b3e52c Refactor H5 line management and cache handling in WebView app
- Introduced shared_preferences for initial H5 cache management.
- Added methods to clear H5 caches and probe line availability.
- Enhanced error handling for line loading and switching.
- Removed openim_common package and its configurations.
- Updated widget tests to reflect changes in H5 line handling and URL management.
2026-05-29 17:56:55 +07:00

1.4 KiB
Raw Blame History

im_webview_app

Flutter WebView 套壳 App启动后会请求 /client_config/query 获取 H5 线路配置,并加载第一条可用线路。

H5 线路切换

线路切换在 Flutter 套壳层完成。远程配置不可用时,会先使用启动兜底线路;也可以在打包时覆盖启动线路或配置接口地址:

flutter build apk --release --dart-define=H5_LINE_URLS=https://h5-one.example/,https://h5-two.example/
flutter build apk --release --dart-define=CLIENT_CONFIG_QUERY_URL=https://api.example.com/client_config/query
flutter build apk --release --dart-define=BOOTSTRAP_H5_LINE_URL=https://h5-one.example/

本地打包

flutter build apk --release

APK 产物:

build/app/outputs/flutter-apk/app-release.apk

自动部署 APK

app 目录执行:

./deploy-app.sh

这个命令会自动执行:

flutter build apk --release
scp -P 22 ./build/app/outputs/flutter-apk/app-release.apk root@54.116.29.247:/data/wwwroot/apk/
ssh -p 22 root@54.116.29.247 "bash /data/wwwroot/apk/show_apk_link.sh app-release.apk"

如果已经打包好了,只想上传现有 APK

./deploy-app.sh --skip-build

如果要上传自定义 APK

./deploy-app.sh --skip-build --apk ./build/app/outputs/flutter-apk/app-release.apk

远端配置也可以通过参数覆盖:

./deploy-app.sh --host 54.116.29.247 --user root --port 22