Merge branch 'dev_arch_opt_3.0' into dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0

This commit is contained in:
yangyakun
2023-03-01 21:12:46 +08:00
26 changed files with 839 additions and 411 deletions

View File

@@ -4,12 +4,11 @@ import android.content.Context
import com.mogo.aicloud.services.locationinfo.MogoLocationInfoServices
import com.mogo.aicloud.services.socket.IMogoLifecycleListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.httpdns.MogoHttpDnsConfig
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation
import com.mogo.cloud.httpdns.listener.IHttpDnsCurrentLocation
import com.mogo.cloud.passport.IMoGoTokenCallback
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.cloud.passport.location.ICurrentLocation
import com.mogo.cloud.passport.location.SimpleLocation
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.debug.DebugConfig
@@ -85,10 +84,10 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
private fun preparePassportEnvironment() {
// 设置网络环境HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV
when (DebugConfig.getNetMode()) {
DebugConfig.NET_MODE_DEV -> clientConfig.netMode = MogoHttpDnsConfig.HTTP_DNS_ENV_DEV
DebugConfig.NET_MODE_QA -> clientConfig.netMode = MogoHttpDnsConfig.HTTP_DNS_ENV_QA
DebugConfig.NET_MODE_DEMO -> clientConfig.netMode = MogoHttpDnsConfig.HTTP_DNS_ENV_DEMO
else -> clientConfig.netMode = MogoHttpDnsConfig.HTTP_DNS_ENV_RELEASE
DebugConfig.NET_MODE_DEV -> clientConfig.netMode = MoGoAiCloudClientConfig.HTTP_DNS_ENV_DEV
DebugConfig.NET_MODE_QA -> clientConfig.netMode = MoGoAiCloudClientConfig.HTTP_DNS_ENV_QA
DebugConfig.NET_MODE_DEMO -> clientConfig.netMode = MoGoAiCloudClientConfig.HTTP_DNS_ENV_DEMO
else -> clientConfig.netMode = MoGoAiCloudClientConfig.HTTP_DNS_ENV_RELEASE
}
// 设置是否是第三APP登录
clientConfig.isThirdLogin =
@@ -128,13 +127,13 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
//设置长链接的secretKey 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ"
clientConfig.iHttpDnsCurrentLocation = object : IHttpDnsCurrentLocation {
override fun getCurrentLocation(): HttpDnsSimpleLocation {
clientConfig.iHttpCurrentLocation = object : ICurrentLocation {
override fun getCurrentLocation(): SimpleLocation {
val envConfig = CallerDevaToolsManager.getEnvConfig()
if (envConfig != null) {
// 更新
httpDnsSimpleLocation =
HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
SimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
return httpDnsSimpleLocation
}
val mogoLocation: MogoLocation? = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
@@ -144,14 +143,14 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
mogoLocation.cityCode.isNullOrEmpty() &&
!CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty()
) {
HttpDnsSimpleLocation(
SimpleLocation(
CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode
?: "010",
mogoLocation.latitude,
mogoLocation.longitude
)
} else {
HttpDnsSimpleLocation(
SimpleLocation(
mogoLocation.cityCode,
mogoLocation.latitude,
mogoLocation.longitude
@@ -330,7 +329,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
MogoAiCloudSocketManager.getInstance(context).reConnect()
}
private fun getDefaultSimpleLocation(): HttpDnsSimpleLocation {
private fun getDefaultSimpleLocation(): SimpleLocation {
val ciyCode =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
@@ -347,11 +346,11 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
)
.getString(SharedPrefsConstants.LOCATION_LONGITUDE)
return try {
HttpDnsSimpleLocation(
SimpleLocation(
ciyCode, latitude.toDouble(), longitude.toDouble()
)
} catch (e: NumberFormatException) {
HttpDnsSimpleLocation("010", 1.0, 1.0)
SimpleLocation("010", 1.0, 1.0)
}
}