[fea]
[删除BusinessEnum]
This commit is contained in:
yangyakun
2024-12-12 18:15:30 +08:00
parent 162d96de9a
commit 8290cc4b0c
13 changed files with 165 additions and 152 deletions

View File

@@ -47,6 +47,7 @@ object AppIdentityModeUtils {
const val SWEEPER = "Sweeper"
const val SHUTTLE = "Shuttle"
const val CHARTER = "Charter"
const val SCHEDULED = "Scheduled"
// 车型
private const val M1 = "M1"
@@ -102,6 +103,21 @@ object AppIdentityModeUtils {
return false
}
/**
* 是否是 班车
*
* @param appIdentityMode productFlavors 配置的类型
* @return true - 班车 false - 不是班车
*/
@JvmStatic
fun isScheduled(appIdentityMode: String): Boolean {
val (bussness, _, _) = getInfo(appIdentityMode)
if (bussness.isNotEmpty()) {
return bussness == SCHEDULED
}
return false
}
/**
* 是否是 小巴车端(这里不细分具体是:司机、乘客等类型)
*
@@ -247,7 +263,6 @@ object AppIdentityModeUtils {
}
@JvmStatic
fun isT1T2(appIdentityMode: String): Boolean {
val (_, _, model) = getInfo(appIdentityMode)
@@ -256,6 +271,7 @@ object AppIdentityModeUtils {
}
return false
}
@JvmStatic
fun isC1(appIdentityMode: String): Boolean {
val (_, _, model) = getInfo(appIdentityMode)
@@ -275,19 +291,19 @@ object AppIdentityModeUtils {
}
@JvmStatic
fun isM1(appIdentityMode: String): Boolean {
fun isB2(appIdentityMode: String): Boolean {
val (_, _, model) = getInfo(appIdentityMode)
if (model.isNotEmpty()) {
return model == M1
return model == B2
}
return false
}
@JvmStatic
fun isB2(appIdentityMode: String): Boolean {
fun isM1(appIdentityMode: String): Boolean {
val (_, _, model) = getInfo(appIdentityMode)
if (model.isNotEmpty()) {
return model == B2
return model == M1
}
return false
}
@@ -301,6 +317,7 @@ object AppIdentityModeUtils {
SWEEPER -> Product.SWEEPER
SHUTTLE -> Product.SHUTTLE
CHARTER -> Product.CHARTER
SCHEDULED -> Product.SCHEDULED
else -> Product.NONE
}
}
@@ -326,10 +343,6 @@ object AppIdentityModeUtils {
}
}
enum class Product {
NONE, BUS, TAXI, SWEEPER, SHUTTLE, CHARTER
}
enum class Role {
NONE, Driver, PASSENGER
}
@@ -340,3 +353,24 @@ object AppIdentityModeUtils {
}
enum class Product(val code: Int) {
NONE(0),
BUS(10),
TAXI(9),
SWEEPER(-1),
SHUTTLE(11),
CHARTER(13) ,
SCHEDULED(14);
companion object {
@JvmStatic
fun valueOf(code: Int): Product {
for (value in values()) {
if (value.code == code) {
return value
}
}
return NONE
}
}
}