feat: 添加 openim_common 依赖,重构环境配置和主页 URL 获取逻辑
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="集中营"
|
android:label="@string/app_name"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
|||||||
@@ -1,18 +1,8 @@
|
|||||||
enum Environment {
|
import 'package:openim_common/openim_common.dart' as openim_common;
|
||||||
production,
|
|
||||||
}
|
|
||||||
|
|
||||||
class AppConfig {
|
class AppConfig {
|
||||||
static const Environment currentEnvironment = Environment.production;
|
|
||||||
|
|
||||||
static final Map<Environment, List<String>> _environmentHosts = {
|
|
||||||
Environment.production: [
|
|
||||||
'h5-im.imharry.work',
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
static List<String> get environmentHosts {
|
static List<String> get environmentHosts {
|
||||||
return _environmentHosts[currentEnvironment] ?? const [];
|
return openim_common.Config.environmentHosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String get homeUrl {
|
static String get homeUrl {
|
||||||
|
|||||||
2
openim_common/lib/openim_common.dart
Normal file
2
openim_common/lib/openim_common.dart
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export 'src/config.dart';
|
||||||
|
|
||||||
17
openim_common/lib/src/config.dart
Normal file
17
openim_common/lib/src/config.dart
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
enum Environment {
|
||||||
|
production,
|
||||||
|
}
|
||||||
|
|
||||||
|
class Config {
|
||||||
|
static const Environment currentEnvironment = Environment.production;
|
||||||
|
|
||||||
|
static final Map<Environment, List<String>> _environmentHosts = {
|
||||||
|
Environment.production: [
|
||||||
|
'h5-im.imharry.work',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
static List<String> get environmentHosts {
|
||||||
|
return _environmentHosts[currentEnvironment] ?? const [];
|
||||||
|
}
|
||||||
|
}
|
||||||
7
openim_common/pubspec.yaml
Normal file
7
openim_common/pubspec.yaml
Normal file
@@ -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"
|
||||||
|
|
||||||
@@ -128,6 +128,13 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.17.0"
|
version: "1.17.0"
|
||||||
|
openim_common:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: openim_common
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "0.0.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ dependencies:
|
|||||||
webview_flutter: ^4.13.1
|
webview_flutter: ^4.13.1
|
||||||
webview_flutter_android: ^4.10.5
|
webview_flutter_android: ^4.10.5
|
||||||
webview_flutter_wkwebview: ^3.23.1
|
webview_flutter_wkwebview: ^3.23.1
|
||||||
|
openim_common:
|
||||||
|
path: openim_common
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user