[6.10.0]
[fea] [音乐、媒体信息分离车型]
This commit is contained in:
@@ -8,7 +8,6 @@ project.android.productFlavors {
|
||||
buildConfigField 'int', 'ttsLanguage', "1" // 仅中文
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("mogo").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("mogo").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'musicUrlConfig', "\"${readMusicUrlConfigFromJsonFile("mogo").replace("\"", "\\\"")}\""
|
||||
}
|
||||
yantai {
|
||||
dimension "project"
|
||||
@@ -16,7 +15,6 @@ project.android.productFlavors {
|
||||
buildConfigField 'int', 'ttsLanguage', "1 << 1" // 中英韩
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("yantai").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("yantai").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'musicUrlConfig', "\"${readMusicUrlConfigFromJsonFile("yantai").replace("\"", "\\\"")}\""
|
||||
}
|
||||
|
||||
dali {
|
||||
@@ -25,7 +23,6 @@ project.android.productFlavors {
|
||||
buildConfigField 'int', 'ttsLanguage', "1" // 仅中文
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("dali").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("dali").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'musicUrlConfig', "\"${readMusicUrlConfigFromJsonFile("dali").replace("\"", "\\\"")}\""
|
||||
}
|
||||
saas {
|
||||
dimension "project"
|
||||
@@ -33,7 +30,6 @@ project.android.productFlavors {
|
||||
buildConfigField 'int', 'ttsLanguage', "1" // 仅中文
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("saas").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("saas").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'musicUrlConfig', "\"${readMusicUrlConfigFromJsonFile("saas").replace("\"", "\\\"")}\""
|
||||
}
|
||||
|
||||
// 配置网络环境,QA、线上、演示
|
||||
|
||||
@@ -13,17 +13,9 @@ Object readMediaUrlConfigFromJsonFile(env){
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
// 解析json
|
||||
def config = jsonSlurper.parse(file)
|
||||
def flavorNames = variantVehicleName()
|
||||
def jsonOutput = new JsonOutput()
|
||||
def getKey = flavorNames
|
||||
config.get(env).each {key, value ->
|
||||
// 匹配flavor对应的 json
|
||||
if(flavorNames.toLowerCase().contains(key)){
|
||||
getKey = key
|
||||
return true
|
||||
}
|
||||
}
|
||||
return jsonOutput.toJson(config.get(env).get(getKey))
|
||||
printf("----------------"+config.get(env))
|
||||
return jsonOutput.toJson(config.get(env))
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
@@ -32,35 +24,6 @@ Object readMediaUrlConfigFromJsonFile(env){
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 读取各车型宣传视频本地配置
|
||||
* @param env
|
||||
* @return
|
||||
*/
|
||||
Object readMusicUrlConfigFromJsonFile(env){
|
||||
try {
|
||||
// 加载config.json 文件
|
||||
File file = new File("${rootDir}/app/config/MusicUrlConfig.json")
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
// 解析json
|
||||
def config = jsonSlurper.parse(file)
|
||||
def flavorNames = variantVehicleName()
|
||||
def jsonOutput = new JsonOutput()
|
||||
def getKey = flavorNames
|
||||
config.get(env).each {key, value ->
|
||||
// 匹配flavor对应的 json
|
||||
if(flavorNames.toLowerCase().contains(key)){
|
||||
getKey = key
|
||||
return true
|
||||
}
|
||||
}
|
||||
return jsonOutput.toJson(config.get(env).get(getKey))
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
def variantVehicleName() {
|
||||
if(gradle.startParameter.taskNames.size()>0) {
|
||||
for (String taskName : gradle.startParameter.taskNames) {
|
||||
@@ -106,5 +69,4 @@ ext {
|
||||
isDriver = this.&isDriver
|
||||
isBaiLing = this.&isBaiLing
|
||||
readMediaUrlConfigFromJsonFile = this.&readMediaUrlConfigFromJsonFile
|
||||
readMusicUrlConfigFromJsonFile = this.&readMusicUrlConfigFromJsonFile
|
||||
}
|
||||
Reference in New Issue
Block a user