Merge remote-tracking branch 'origin/dev_opt_2.15.0' into dev_opt_2.15.0

This commit is contained in:
donghongyu
2023-04-04 17:53:34 +08:00
4 changed files with 71 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.network.utils.*
import com.mogo.eagle.core.utilcode.breakpoint.Config
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.*
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.eagle.core.utilcode.util.FileUtils
import kotlinx.coroutines.*
@@ -44,6 +45,8 @@ class UpgradeAppNetWorkManager private constructor() {
val sn = MoGoAiCloudClientConfig.getInstance().sn //null
val macAddress = mac //"48:b0:2d:4d:31:7f"
val type = screenType //10
SharedPrefsMgr.getInstance(context!!).putString(SharedPrefsConstants.HOST_ADDRESS, HostConst.getHost())
try {
val records = provider?.getUpgradeRecords()?.also {
MogoAnalyticUtils.track("AppUpgradeRecord", it.let { TreeMap<String, Any>().also { itx -> itx.putAll(it) } })
@@ -57,6 +60,11 @@ class UpgradeAppNetWorkManager private constructor() {
provider?.recordUpgradeRecord(sn ?: "", macAddress, type, FunctionBuildConfig.isSupportPatchUpgrade)
provider?.recordUpgradeRequestStart()
val info = mUpgradeApiService.getUpgradeInfo(requestBody)
if (info != null) {
SharedPrefsMgr.getInstance(context!!).putString(SharedPrefsConstants.APP_UPGRADE_CONTENT, if (info.result != null) GsonUtils.toJson(info) + "--mac:$macAddress --type:$type --sn:$sn --versionName:$versionName" else "info.result == null --mac:$macAddress --type:$type --sn:$sn --versionName:$versionName")
} else {
SharedPrefsMgr.getInstance(context!!).putString(SharedPrefsConstants.APP_UPGRADE_CONTENT, "info == null --mac:$macAddress --type:$type --sn:$sn --versionName:$versionName")
}
if (info.result != null) {
provider?.recordUpgradeRequestSuccess(GsonUtils.toJson(info))
doUpgrade(info)
@@ -65,6 +73,9 @@ class UpgradeAppNetWorkManager private constructor() {
}
} catch (t: Throwable) {
t.printStackTrace()
SharedPrefsMgr.getInstance(context!!).putString(SharedPrefsConstants.APP_UPGRADE_CONTENT,
"$t--mac:$macAddress --type:$type --sn:$sn "
)
provider?.recordUpgradeRequestFailed(t.message ?: "更新接口请求失败")
deleteApkFile()
}

View File

@@ -309,6 +309,9 @@ internal class DebugSettingView @JvmOverloads constructor(
}
}
/**
* 蘑方点击事件
*/
tbMojie.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconDown, null)
@@ -319,6 +322,21 @@ internal class DebugSettingView @JvmOverloads constructor(
}
}
/**
* APP升级点击事件
*/
tbAppUpgrade.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconDown, null)
tvAppHost.visibility = View.VISIBLE
tvAppContent.visibility = View.VISIBLE
} else {
buttonView.setCompoundDrawables(null, null, iconRight, null)
tvAppHost.visibility = View.GONE
tvAppContent.visibility = View.GONE
}
}
/**
* 蘑方控制 默认关闭
*/
@@ -1619,6 +1637,10 @@ internal class DebugSettingView @JvmOverloads constructor(
}
tvCmdbCarInfoContent.text = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO)?:""
//APP升级功能
tvAppHost.text = "HOST地址" + SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.HOST_ADDRESS)?:""
tvAppContent.text = "APP升级数据" + SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.APP_UPGRADE_CONTENT)?:""
tvCarInfo.text =
"GPS时间${(mGnssInfo?.satelliteTime?.times(1000))?.toLong()}\n" +
"自车经纬度:\n${mGnssInfo?.longitude}\n${mGnssInfo?.latitude}\n"

View File

@@ -289,6 +289,7 @@
android:textOn="关闭obu预警融合"
android:textSize="@dimen/dp_24" />
<!-- 蘑方控制 start -->
<ToggleButton
android:id="@+id/tbMojie"
android:layout_width="match_parent"
@@ -311,8 +312,41 @@
android:visibility="gone"
android:layout_marginLeft="10dp"
android:scaleY="1"
android:scaleX="1"
/>
android:scaleX="1" />
<!-- 蘑方控制 end -->
<!-- APP升级数据 start -->
<ToggleButton
android:id="@+id/tbAppUpgrade"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:drawableEnd="@drawable/icon_right"
android:padding="@dimen/dp_20"
android:textOff="APP升级信息"
android:textOn="APP升级信息"
android:textSize="@dimen/dp_24" />
<TextView
android:id="@+id/tvAppHost"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="域名: " />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0" />
<TextView
android:id="@+id/tvAppContent"
style="@style/DebugSettingText"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="5" />
<!-- APP升级数据 end -->
<Button
android:id="@+id/btnIpcReboot"