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.
This commit is contained in:
Booker
2026-05-29 17:56:55 +07:00
parent 131df57dfe
commit a1e7b3e52c
11 changed files with 881 additions and 288 deletions

View File

@@ -1,25 +1,15 @@
# im_webview_app
Flutter WebView 套壳 App默认加载:
```text
https://h5-test.imharry.work/
```
Flutter WebView 套壳 App启动后会请求 `/client_config/query` 获取 H5 线路配置,并加载第一条可用线路。
## H5 线路切换
线路切换在 Flutter 套壳层完成H5 页面不需要承载线路切换逻辑。每条线路对应一个独立 WebView切换时只切换当前显示的 WebView不会改写 H5 页面运行中的请求地址
默认线路配置在:
```text
openim_common/lib/src/config.dart
```
也可以在打包时覆盖:
线路切换在 Flutter 套壳层完成。远程配置不可用时,会先使用启动兜底线路;也可以在打包时覆盖启动线路或配置接口地址
```bash
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/
```
## 本地打包