Commit 036b7e13 authored by mengcuiguang's avatar mengcuiguang

添加头条母包

parent 6851f0f5
...@@ -11,8 +11,8 @@ android { ...@@ -11,8 +11,8 @@ android {
applicationId "com.mints.highgold" applicationId "com.mints.highgold"
minSdkVersion rootProject.ext.androidMinSdkVersion minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 21 versionCode 22
versionName "1.2.0" versionName "1.2.1"
flavorDimensions "default" flavorDimensions "default"
// dex突破65535的限制 // dex突破65535的限制
...@@ -67,7 +67,8 @@ android { ...@@ -67,7 +67,8 @@ android {
// 不显示Log // 不显示Log
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "String", "AppKeyPre", "\"abcd\"" buildConfigField "String", "AppKeyPre", "\"abcd\""
buildConfigField "String", "MainIp", DEBUG_URL // buildConfigField "String", "MainIp", DEBUG_URL
buildConfigField "String", "MainIp", RELEASE_URL
manifestPlaceholders = [TD_SCHEMA_KEY: DEBUG_TD_SCHEMA_KEY, manifestPlaceholders = [TD_SCHEMA_KEY: DEBUG_TD_SCHEMA_KEY,
TD_KEY : DEBUG_TD_KEY] TD_KEY : DEBUG_TD_KEY]
...@@ -300,7 +301,8 @@ dependencies { ...@@ -300,7 +301,8 @@ dependencies {
implementation(name: 'wannuosili_ad_1.0.3', ext: 'aar') implementation(name: 'wannuosili_ad_1.0.3', ext: 'aar')
// implementation project(':lib-todaystepcounter') // implementation project(':lib-todaystepcounter')
// 应用管理中心分包
implementation(name: 'humesdk-1.0.0', ext: 'aar')
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
......
...@@ -2,6 +2,7 @@ package com.mints.highgold.net; ...@@ -2,6 +2,7 @@ package com.mints.highgold.net;
import android.text.TextUtils; import android.text.TextUtils;
import com.bytedance.hume.readapk.HumeSDK;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.mints.highgold.BuildConfig; import com.mints.highgold.BuildConfig;
import com.mints.highgold.MintsApplication; import com.mints.highgold.MintsApplication;
...@@ -44,7 +45,7 @@ public class OkHttpInterceptor implements Interceptor { ...@@ -44,7 +45,7 @@ public class OkHttpInterceptor implements Interceptor {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"); String channel = this.createChannel();
Request request = chain.request(); Request request = chain.request();
request = encrypt(request, tokenID, time, channel);//加密方法 request = encrypt(request, tokenID, time, channel);//加密方法
...@@ -60,6 +61,26 @@ public class OkHttpInterceptor implements Interceptor { ...@@ -60,6 +61,26 @@ public class OkHttpInterceptor implements Interceptor {
return chain.proceed(builder); return chain.proceed(builder);
} }
/**
* 创建渠道
*
* @return
*/
private String createChannel() {
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
try {
// 穿山甲分包渠道
String ttChannel = HumeSDK.getChannel(MintsApplication.getContext());
if (!TextUtils.isEmpty(ttChannel)) {
// 此处方式不能修改,已和后端约定
channel = channel + "_" + ttChannel;
}
} catch (Exception e) {
e.printStackTrace();
}
return channel;
}
// json加密 // json加密
private Request encrypt(Request request, String tokenID, long time, String channel) throws IOException { private Request encrypt(Request request, String tokenID, long time, String channel) throws IOException {
//这个是请求的url,也就是咱们前面配置的baseUrl //这个是请求的url,也就是咱们前面配置的baseUrl
......
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