23 lines
615 B
Dart
23 lines
615 B
Dart
import 'package:openim_common/openim_common.dart' as openim_common;
|
|
|
|
class AppConfig {
|
|
static List<String> get environmentHosts {
|
|
return openim_common.Config.environmentHosts;
|
|
}
|
|
|
|
static String get homeUrl {
|
|
final host = environmentHosts.isNotEmpty
|
|
? environmentHosts.first
|
|
: 'h5-im.imharry.work';
|
|
return _normalizeHomeUrl(host);
|
|
}
|
|
|
|
static String _normalizeHomeUrl(String host) {
|
|
final value = host.trim();
|
|
if (value.startsWith('http://') || value.startsWith('https://')) {
|
|
return value.endsWith('/') ? value : '$value/';
|
|
}
|
|
return 'https://$value/';
|
|
}
|
|
}
|