From 5dbf24f96868188985abce1cb29cccdb695af0dc Mon Sep 17 00:00:00 2001 From: Booker Date: Fri, 22 May 2026 17:32:29 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20openim=5Fcommon=20?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=EF=BC=8C=E9=87=8D=E6=9E=84=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=92=8C=E4=B8=BB=E9=A1=B5=20URL=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/src/main/AndroidManifest.xml | 2 +- lib/config/app_config.dart | 14 ++------------ openim_common/lib/openim_common.dart | 2 ++ openim_common/lib/src/config.dart | 17 +++++++++++++++++ openim_common/pubspec.yaml | 7 +++++++ pubspec.lock | 7 +++++++ pubspec.yaml | 2 ++ 7 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 openim_common/lib/openim_common.dart create mode 100644 openim_common/lib/src/config.dart create mode 100644 openim_common/pubspec.yaml diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 06bda76..4dada59 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -22,7 +22,7 @@ > _environmentHosts = { - Environment.production: [ - 'h5-im.imharry.work', - ], - }; - static List get environmentHosts { - return _environmentHosts[currentEnvironment] ?? const []; + return openim_common.Config.environmentHosts; } static String get homeUrl { diff --git a/openim_common/lib/openim_common.dart b/openim_common/lib/openim_common.dart new file mode 100644 index 0000000..b6b61a0 --- /dev/null +++ b/openim_common/lib/openim_common.dart @@ -0,0 +1,2 @@ +export 'src/config.dart'; + diff --git a/openim_common/lib/src/config.dart b/openim_common/lib/src/config.dart new file mode 100644 index 0000000..a60a951 --- /dev/null +++ b/openim_common/lib/src/config.dart @@ -0,0 +1,17 @@ +enum Environment { + production, +} + +class Config { + static const Environment currentEnvironment = Environment.production; + + static final Map> _environmentHosts = { + Environment.production: [ + 'h5-im.imharry.work', + ], + }; + + static List get environmentHosts { + return _environmentHosts[currentEnvironment] ?? const []; + } +} diff --git a/openim_common/pubspec.yaml b/openim_common/pubspec.yaml new file mode 100644 index 0000000..7ff1d22 --- /dev/null +++ b/openim_common/pubspec.yaml @@ -0,0 +1,7 @@ +name: openim_common +description: Build-server compatible configuration bridge for the H5 shell. +publish_to: 'none' + +environment: + sdk: ">=3.6.0 <4.0.0" + diff --git a/pubspec.lock b/pubspec.lock index 27a5ae9..8209563 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -128,6 +128,13 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.0" + openim_common: + dependency: "direct main" + description: + path: openim_common + relative: true + source: path + version: "0.0.0" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 8aa8066..f360909 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,6 +36,8 @@ dependencies: webview_flutter: ^4.13.1 webview_flutter_android: ^4.10.5 webview_flutter_wkwebview: ^3.23.1 + openim_common: + path: openim_common dev_dependencies: flutter_test: