Commit 7e13a0bd authored by shiyuelong's avatar shiyuelong

add 新增动态配置应用名称、服务器地址功能

parent 3c02412f
package com.yidian.common package com.yidian.common
class AppConfig { class AppConfig {
companion object{ companion object {
//生活圈项目 //生活圈项目
const val IS_ENCRYPT = false const val IS_ENCRYPT = false
const val KUANGSHI_ALIVE_API_KEY = "32f9XIsReV4S15Ck_Sa3ky43XgAHUB9v" const val KUANGSHI_ALIVE_API_KEY = "32f9XIsReV4S15Ck_Sa3ky43XgAHUB9v"
const val KUANGSHI_SECRET = "usZbQYdI4PQeXhMftsRfHK2msj0DmSIl" const val KUANGSHI_SECRET = "usZbQYdI4PQeXhMftsRfHK2msj0DmSIl"
const val appid = "merchant-b" const val appid = "merchant-b"
const val cv = "1.0.0" const val cv = "1.0.0"
const val version = "000100" const val version = "000100"
const val distribution = "official" const val distribution = "official"
const val platform = "1" const val platform = "1"
//地铁项目 //地铁项目
const val WeChatAppKey = "wxef4c37f254e29e84" const val WeChatAppKey = "wxef4c37f254e29e84"
const val WeChatAppSecret = "fb596ed3641b481b6f973774987fd04f" const val WeChatAppSecret = "fb596ed3641b481b6f973774987fd04f"
const val QQAppKey = "101923771" const val QQAppKey = "101923771"
const val QQAppSecret = "c34d63cfcf9f8b13a71f48424b48d692" const val QQAppSecret = "c34d63cfcf9f8b13a71f48424b48d692"
const val SinaAppKey = "4157874278" const val SinaAppKey = "4157874278"
const val SinaAppSecret = "85c422bc0a1e0553e6a6a075701422a7" const val SinaAppSecret = "85c422bc0a1e0553e6a6a075701422a7"
const val SinaCallBackUrl = "https://api.weibo.com/oauth2/default.html" const val SinaCallBackUrl = "https://api.weibo.com/oauth2/default.html"
const val FileProvider = "com.shenghuoquan.business.provider" const val FileProvider = "com.shenghuoquan.business.provider"
const val privacyPolicyStatement = "https://www.appgc.cn/plugins/privacy/content?type=privacy&appId=1080334&ver=210601" const val privacyPolicyStatement = "https://www.appgc.cn/plugins/privacy/content?type=privacy&appId=1080334&ver=210601"
const val userProtocol = "https://www.appgc.cn/plugins/privacy/content?type=mp&appId=1080334&ver=210601" const val userProtocol = "https://www.appgc.cn/plugins/privacy/content?type=mp&appId=1080334&ver=210601"
const val UMAppKey = "60c8479fe044530ff0a49936"//umeng统计key注释 // 友盟测试环境配置
const val UMChannel = "ANDROID_CHANNEL" const val UMAppTestKey = "60c8479fe044530ff0a49936"//umeng统计key注释
const val UMType = "metro" const val UMTestChannel = "ANDROID_CHANNEL"
const val UMSecret = "e78446e86d153e2891ae7523e1532f13" const val UMTestType = "metro"
const val PUSH_XIAOMI_SUPPORT_MASK = 0x40000000 const val UMTestSecret = "e78446e86d153e2891ae7523e1532f13"
const val PUSH_UMENG_SUPPORT_MASK = 0x20000000 // 友盟线上环境配置
const val PUSH_GETUI_SUPPORT_MASK = 0x10000000 const val UMAppKey = "60c8479fe044530ff0a49936"//umeng统计key注释
const val PUSH_PASS_THROGH_UNIQUE_MASK = 0x00000001 const val UMChannel = "ANDROID_CHANNEL"
const val ZIXUN_PUSH_LEVEL = PUSH_XIAOMI_SUPPORT_MASK const val UMType = "metro"
const val UMSecret = "e78446e86d153e2891ae7523e1532f13"
const val PUSH_LEVEL = (PUSH_XIAOMI_SUPPORT_MASK or PUSH_UMENG_SUPPORT_MASK const val PUSH_XIAOMI_SUPPORT_MASK = 0x40000000
or PUSH_GETUI_SUPPORT_MASK or PUSH_PASS_THROGH_UNIQUE_MASK) const val PUSH_UMENG_SUPPORT_MASK = 0x20000000
} const val PUSH_GETUI_SUPPORT_MASK = 0x10000000
const val PUSH_PASS_THROGH_UNIQUE_MASK = 0x00000001
const val ZIXUN_PUSH_LEVEL = PUSH_XIAOMI_SUPPORT_MASK
const val PUSH_LEVEL = (PUSH_XIAOMI_SUPPORT_MASK or PUSH_UMENG_SUPPORT_MASK
or PUSH_GETUI_SUPPORT_MASK or PUSH_PASS_THROGH_UNIQUE_MASK)
}
} }
...@@ -14,6 +14,7 @@ import com.umeng.message.UmengNotificationClickHandler ...@@ -14,6 +14,7 @@ import com.umeng.message.UmengNotificationClickHandler
import com.umeng.message.entity.UMessage import com.umeng.message.entity.UMessage
import com.umeng.socialize.PlatformConfig import com.umeng.socialize.PlatformConfig
import com.yidian.common.AppConfig import com.yidian.common.AppConfig
import com.yidian.common.BuildConfig
import com.yidian.common.HawkConfig import com.yidian.common.HawkConfig
import com.yidian.common.XRouterPathConstants import com.yidian.common.XRouterPathConstants
import com.yidian.xpage.XPageManager import com.yidian.xpage.XPageManager
...@@ -26,7 +27,11 @@ class UMConfigUtils { ...@@ -26,7 +27,11 @@ class UMConfigUtils {
companion object { companion object {
fun init(context: Context) { fun init(context: Context) {
//release环境上报错误信息,参数有:上下文、APPkey、渠道号、设备类型、推送密钥 //release环境上报错误信息,参数有:上下文、APPkey、渠道号、设备类型、推送密钥
UMConfigure.init(context, AppConfig.UMAppKey, AppConfig.UMChannel, UMConfigure.DEVICE_TYPE_PHONE, AppConfig.UMSecret) if (BuildConfig.ENV_DEBUG) {
UMConfigure.init(context, AppConfig.UMAppTestKey, AppConfig.UMChannel, UMConfigure.DEVICE_TYPE_PHONE, AppConfig.UMTestSecret)
} else {
UMConfigure.init(context, AppConfig.UMAppKey, AppConfig.UMChannel, UMConfigure.DEVICE_TYPE_PHONE, AppConfig.UMSecret)
}
// //
// // 推送设置 // // 推送设置
// PlatformConfig.setWeixin(AppConfig.WeChatAppKey, AppConfig.WeChatAppSecret) // PlatformConfig.setWeixin(AppConfig.WeChatAppKey, AppConfig.WeChatAppSecret)
......
...@@ -8,7 +8,7 @@ android { ...@@ -8,7 +8,7 @@ android {
compileSdkVersion build_versions.compileSdkVersion compileSdkVersion build_versions.compileSdkVersion
defaultConfig { defaultConfig {
applicationId "com.shenghuoquan.business" applicationId rootProject.ext.android.applicationId
minSdkVersion build_versions.minSdkVersion minSdkVersion build_versions.minSdkVersion
targetSdkVersion build_versions.targetSdkVersion targetSdkVersion build_versions.targetSdkVersion
versionCode rootProject.ext.android.versionCode versionCode rootProject.ext.android.versionCode
...@@ -23,15 +23,7 @@ android { ...@@ -23,15 +23,7 @@ android {
} }
} }
signingConfigs { signingConfigs {
debug { production {
storeFile file("shenghuoquan-b.jks")
keyAlias 'shenghuoquan_key'
keyPassword 'shenghuoquan000'
storePassword 'shenghuoquan000'
v1SigningEnabled true
v2SigningEnabled true
}
release {
storeFile file("shenghuoquan-b.jks") storeFile file("shenghuoquan-b.jks")
keyAlias 'shenghuoquan_key' keyAlias 'shenghuoquan_key'
keyPassword 'shenghuoquan000' keyPassword 'shenghuoquan000'
...@@ -42,17 +34,43 @@ android { ...@@ -42,17 +34,43 @@ android {
} }
buildTypes { buildTypes {
debug { debug {
signingConfig signingConfigs.debug applicationIdSuffix ".debug"
buildConfigField("String", "API_URL", rootProject.ext.buildParams.debug.API_URL)
buildConfigField("String", "PROVIDER_NAME", '\"' + rootProject.ext.android.applicationId + ".debug.fileprovider" + '\"')
manifestPlaceholders = [
app_name : "B端测试",
file_provider: rootProject.ext.android.applicationId + ".debug.fileprovider",
]
//不混淆
minifyEnabled false minifyEnabled false
//Zipalign优化
zipAlignEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.production
} }
release { release {
signingConfig signingConfigs.release buildConfigField("String", "API_URL", rootProject.ext.buildParams.release.API_URL)
buildConfigField("String", "PROVIDER_NAME", '\"' + rootProject.ext.android.applicationId + ".fileprovider" + '\"')
manifestPlaceholders = [
app_name : "B端",
file_provider: rootProject.ext.android.applicationId + ".fileprovider",
]
//混淆
minifyEnabled true minifyEnabled true
//Zipalign优化
zipAlignEnabled true
//移除无用的resource文件
shrinkResources true
signingConfig signingConfigs.production
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "business-${variant.name}-${defaultConfig.versionName}-${defaultConfig.versionCode}.apk"
}
}
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
......
...@@ -23,18 +23,19 @@ ...@@ -23,18 +23,19 @@
android:name=".YdSubwayApplication" android:name=".YdSubwayApplication"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="${app_name}"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
tools:replace="android:allowBackup,android:label"
tools:targetApi="n"> tools:targetApi="n">
<!-- 以下为友盟分享基本配置信息 start--> <!-- 以下为友盟分享基本配置信息 start-->
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="com.shenghuoquan.business.provider" android:authorities="${file_provider}"
android:exported="false" android:exported="false"
android:grantUriPermissions="true" android:grantUriPermissions="true"
tools:replace="android:authorities"> tools:replace="android:authorities">
...@@ -76,7 +77,7 @@ ...@@ -76,7 +77,7 @@
android:name="com.umeng.socialize.media.WBShareCallBackActivity" android:name="com.umeng.socialize.media.WBShareCallBackActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:exported="false" android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity> android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity <activity
android:name="com.sina.weibo.sdk.web.WeiboSdkWebActivity" android:name="com.sina.weibo.sdk.web.WeiboSdkWebActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
...@@ -227,6 +228,7 @@ ...@@ -227,6 +228,7 @@
android:exported="false" android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" /> android:permission="android.permission.BIND_JOB_SERVICE" />
<!--此处注意下包名💊-->
<provider <provider
android:name="com.umeng.message.provider.MessageProvider" android:name="com.umeng.message.provider.MessageProvider"
android:authorities="com.shenghuoquan.business.umeng.message" android:authorities="com.shenghuoquan.business.umeng.message"
......
...@@ -110,7 +110,8 @@ class YdSubwayApplication : YdBaseApplication() { ...@@ -110,7 +110,8 @@ class YdSubwayApplication : YdBaseApplication() {
// header["Content-Type"] = "application/json" // header["Content-Type"] = "application/json"
// header["charset"] = "UTF-8" // header["charset"] = "UTF-8"
// ServiceFactory.getInstance().addInterceptor(HttpInterceptor(header)) // ServiceFactory.getInstance().addInterceptor(HttpInterceptor(header))
ServiceFactory.getInstance().init(true, URLs.BASE_URL, 10, 10) // ServiceFactory.getInstance().init(true, URLs.BASE_URL, 10, 10)
ServiceFactory.getInstance().init(true, BuildConfig.API_URL, 10, 10)
ServiceFactory.getInstance().addInterceptor(ApiSaveCookiesInterceptor()) ServiceFactory.getInstance().addInterceptor(ApiSaveCookiesInterceptor())
ServiceFactory.getInstance().addInterceptor(ApiSetCookiesInterceptor()) ServiceFactory.getInstance().addInterceptor(ApiSetCookiesInterceptor())
...@@ -173,4 +174,4 @@ class YdSubwayApplication : YdBaseApplication() { ...@@ -173,4 +174,4 @@ class YdSubwayApplication : YdBaseApplication() {
Zap.addService(XPageService.name, XPageService()) Zap.addService(XPageService.name, XPageService())
Zap.addService(XEventService.name, XEventService()) Zap.addService(XEventService.name, XEventService())
} }
} }
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
apply from: "https://git.yidian-inc.com:8021/arc-android/config/raw/master/version.gradle" apply from: "https://git.yidian-inc.com:8021/arc-android/config/raw/master/version.gradle"
apply from:"config/config.gradle" apply from: "config/config.gradle"
addRepos(repositories) addRepos(repositories)
ext.kotlin_version=build_versions.kotlin_version ext.kotlin_version = build_versions.kotlin_version
repositories { repositories {
google() google()
jcenter() jcenter()
...@@ -27,7 +27,7 @@ allprojects { ...@@ -27,7 +27,7 @@ allprojects {
google() google()
jcenter() jcenter()
mavenCentral() mavenCentral()
maven { url "https://jitpack.io" } maven { url "https://www.jitpack.io" }
maven { url 'https://repo1.maven.org/maven2/' } maven { url 'https://repo1.maven.org/maven2/' }
maven { url "https://dl.bintray.com/thelasterstar/maven/" } maven { url "https://dl.bintray.com/thelasterstar/maven/" }
maven { url "http://dailybuild2.yidian-inc.com:8088/repository/maven-public/" } maven { url "http://dailybuild2.yidian-inc.com:8088/repository/maven-public/" }
......
ext.android = [ ext {
versionCode : 1, android = [
versionName : "1.0", applicationId : "com.shenghuoquan.business",
isApplication: false versionCode : 100,
] versionName : "1.0.0",
isApplication : false
]
buildParams = [
debug : [
API_URL: '"http://bp-dev.go2yd.com"',
],
release: [
API_URL: '"http://bp-dev.go2yd.com"',
]
]
}
ext.dependencies = [ ext.dependencies = [
publicImplementation :[ publicImplementation :[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment