调试窗

版本信息增加版本构建时间
This commit is contained in:
xuxinchao
2022-04-25 19:19:11 +08:00
parent 6d76863eba
commit 382fd6a36b
5 changed files with 27 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'com.alibaba.arouter'
apply plugin: 'kotlin-android'
@@ -180,6 +182,7 @@ android {
buildConfigField 'String', 'SOCKET_APP_ID', '\"com.mogo.launcher\"'
buildConfigField 'String', 'WORKING_BRANCH_NAME', getWorkingBranchName()
buildConfigField 'String', 'WORKING_BRANCH_HASH', getWorkingBranchHash()
buildConfigField 'String', 'APP_BUILD_TIME', getBuildTime()
// 是否支持目的地导航策略
buildConfigField 'boolean', 'IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH', 'false'
}
@@ -331,6 +334,16 @@ def getWorkingBranchHash() {
return "\"${workingBranchHash}\""
}
static def getBuildTime() {
def buildTimeFormat = "yyyy-MM-dd HH:mm:ss"
//设置时间格式
SimpleDateFormat formatter = new SimpleDateFormat(buildTimeFormat, Locale.getDefault())
//获取当前时间
Date curDate = new Date(System.currentTimeMillis())
def buildTime = formatter.format(curDate)
return "\"${buildTime}\""
}
boolean isAndroidTestBuild() {
for (String s : gradle.startParameter.taskNames) {

View File

@@ -73,6 +73,7 @@ public class MogoApplication extends MainMoGoApplication {
// 初始化构建APP的时候的分支及提交HASH用于辅助定位问题
AppConfigInfo.INSTANCE.setWorkingBranchName(BuildConfig.WORKING_BRANCH_NAME);
AppConfigInfo.INSTANCE.setWorkingBranchHash(BuildConfig.WORKING_BRANCH_HASH);
AppConfigInfo.INSTANCE.setAppBuildTime(BuildConfig.APP_BUILD_TIME);
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
FunctionBuildConfig.gpsProvider = BuildConfig.GPS_PROVIDER;

View File

@@ -1424,6 +1424,7 @@ class DebugSettingView @JvmOverloads constructor(
}
tvMoGoMapVersion.text = "HD-Map版本${MogoMap.getInstance().mogoMap.mapVersion}"
tvGitBranchInfo.text = "Git分支${AppConfigInfo.workingBranchName}"
tvAppBuildTimeInfo.text = "版本构建时间:${AppConfigInfo.appBuildTime}"
tvGitHashInfo.text = "Git-Hash${AppConfigInfo.workingBranchHash}"
tvAndroidSystemVersion.text = "Android系统版本" + DeviceUtils.getSDKVersionName()

View File

@@ -300,6 +300,17 @@
android:layout_height="1dp"
android:background="#F0F0F0" />
<TextView
android:id="@+id/tvAppBuildTimeInfo"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0" />
<TextView
android:id="@+id/tvGitHashInfo"
style="@style/DebugSettingText"

View File

@@ -9,6 +9,7 @@ object AppConfigInfo {
/*应用构建基本信息*/
var workingBranchName: String? = null
var workingBranchHash: String? = null
var appBuildTime: String? = null
/*应用基本信息*/
var appName: String? = null