66 lines
1.5 KiB
Dart
66 lines
1.5 KiB
Dart
/// 应用商店枚举
|
|
enum AppMarket {
|
|
googlePlay,
|
|
appStore,
|
|
huawei,
|
|
oppo,
|
|
vivo,
|
|
xiaomi,
|
|
tencent,
|
|
coolapk,
|
|
custom,
|
|
unknown;
|
|
|
|
/// 从字符串创建
|
|
static AppMarket fromString(String? market) {
|
|
switch (market?.toLowerCase()) {
|
|
case 'googleplay':
|
|
return AppMarket.googlePlay;
|
|
case 'appstore':
|
|
return AppMarket.appStore;
|
|
case 'huawei':
|
|
return AppMarket.huawei;
|
|
case 'oppo':
|
|
return AppMarket.oppo;
|
|
case 'vivo':
|
|
return AppMarket.vivo;
|
|
case 'xiaomi':
|
|
return AppMarket.xiaomi;
|
|
case 'tencent':
|
|
return AppMarket.tencent;
|
|
case 'coolapk':
|
|
return AppMarket.coolapk;
|
|
case 'custom':
|
|
return AppMarket.custom;
|
|
default:
|
|
return AppMarket.unknown;
|
|
}
|
|
}
|
|
|
|
/// 获取显示名称
|
|
String get displayName {
|
|
switch (this) {
|
|
case AppMarket.googlePlay:
|
|
return 'Google Play';
|
|
case AppMarket.appStore:
|
|
return 'App Store';
|
|
case AppMarket.huawei:
|
|
return '华为应用市场';
|
|
case AppMarket.oppo:
|
|
return 'OPPO软件商店';
|
|
case AppMarket.vivo:
|
|
return 'vivo应用商店';
|
|
case AppMarket.xiaomi:
|
|
return '小米应用商店';
|
|
case AppMarket.tencent:
|
|
return '腾讯应用宝';
|
|
case AppMarket.coolapk:
|
|
return '酷安';
|
|
case AppMarket.custom:
|
|
return '自定义';
|
|
default:
|
|
return '未知';
|
|
}
|
|
}
|
|
}
|