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:
18
README.md
18
README.md
@@ -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/
|
||||
```
|
||||
|
||||
## 本地打包
|
||||
|
||||
Reference in New Issue
Block a user