feat(common): 添加主从应用判断逻辑
- 在 GlobalData 中添加 isMaster 属性,用于判断是否为主应用 - 修改 ServiceLauncherActivity 启动逻辑,主应用直接跳转到订单状态页 - 更新 ZDManager 初始化方法,支持发布版本和 CRM 版本切换
This commit is contained in:
@ -2,6 +2,7 @@ package com.za.common
|
||||
|
||||
import android.app.Application
|
||||
import com.amap.api.location.AMapLocation
|
||||
import com.blankj.utilcode.util.AppUtils
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.za.bean.DriverInfo
|
||||
import com.za.bean.VehicleInfo
|
||||
@ -11,6 +12,7 @@ import com.za.room.RoomHelper
|
||||
object GlobalData {
|
||||
lateinit var application : Application
|
||||
var activityCount : Int = 0
|
||||
var isMaster = AppUtils.getAppPackageName() == "com.za.rescue.dealer"
|
||||
|
||||
var token : String? = null
|
||||
get() {
|
||||
|
@ -11,25 +11,22 @@ import com.za.service.location.ZdLocationManager
|
||||
|
||||
object ZDManager {
|
||||
lateinit var application : Application
|
||||
fun init(application : Application) {
|
||||
fun init(application : Application, isRelease : Boolean = false) {
|
||||
this.application = application
|
||||
thirdSdkInit()
|
||||
thirdSdkInit(isRelease)
|
||||
}
|
||||
|
||||
private fun thirdSdkInit() {
|
||||
private fun thirdSdkInit(isRelease : Boolean = false) {
|
||||
if (isRelease) {
|
||||
AppConfig.release()
|
||||
} else {
|
||||
AppConfig.crm1()
|
||||
}
|
||||
GlobalData.application = application
|
||||
MMKV.initialize(application, MMKVLogLevel.LevelInfo)
|
||||
Bugly.init(application, "6972a6b56d", true)
|
||||
AppConfig.crm1()
|
||||
LogUtil.init(application)
|
||||
RoomHelper.init(application)
|
||||
ZdLocationManager.init(application)
|
||||
|
||||
|
||||
// 初始化讯飞SDK
|
||||
//科大讯飞初始化
|
||||
// SpeechUtility.createUtility(application,
|
||||
// SpeechConstant.APPID + "=6fd4aabe," + SpeechConstant.FORCE_LOGIN + "=true")
|
||||
// SpeechManager.init(application)
|
||||
}
|
||||
}
|
@ -23,8 +23,6 @@ import com.za.base.BaseActivity
|
||||
import com.za.common.GlobalData
|
||||
import com.za.common.log.LogUtil
|
||||
import com.za.ext.goStatusPage
|
||||
import com.za.service.ServiceManager
|
||||
import com.za.service.location.ZdLocationManager
|
||||
import com.za.servicing.R
|
||||
|
||||
class ServiceLauncherActivity : BaseActivity() {
|
||||
@ -170,6 +168,11 @@ class ServiceLauncherActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
private fun navigateToNextScreen() {
|
||||
if (GlobalData.isMaster) {
|
||||
GlobalData.currentOrder?.goStatusPage(this)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
val driverName = intent.getStringExtra("driverName")
|
||||
val driverPhone = intent.getStringExtra("driverPhone")
|
||||
val taskCode = intent.getStringExtra("taskCode")
|
||||
@ -183,26 +186,6 @@ class ServiceLauncherActivity : BaseActivity() {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
if (GlobalData.token.isNullOrBlank()) {
|
||||
ServicingMainActivity.goToMain(
|
||||
this,
|
||||
driverName = driverName,
|
||||
driverPhone = driverPhone,
|
||||
taskCode = taskCode,
|
||||
rescueVehicle = rescueVehicle,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (GlobalData.currentOrder != null) {
|
||||
GlobalData.currentOrder?.goStatusPage(this)
|
||||
ServiceManager.initialize(GlobalData.application)
|
||||
ZdLocationManager.startContinuousLocation(GlobalData.application)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
ServicingMainActivity.goToMain(
|
||||
this,
|
||||
driverName = driverName,
|
||||
|
@ -41,6 +41,7 @@ class ServicingMainVm : BaseVm<ServicingMainVm.Action, ServicingMainVm.UiState>(
|
||||
deviceId : String? = null,
|
||||
rescueVehicle : String? = null) {
|
||||
LoadingManager.showLoading()
|
||||
|
||||
login(jobCode, phone, taskCode, vehicleId, deviceId, rescueVehicle, success = {
|
||||
CommonMethod.queryOrderList(context = ActivityUtils.getTopActivity(),
|
||||
success = { orderInfo : OrderInfo?, orderInfos : List<OrderInfo>? ->
|
||||
|
Reference in New Issue
Block a user