Commit d224d0b3 authored by mengcuiguang's avatar mengcuiguang

添加拦截器,更新gradle版本

parent df5b0ceb
GoodNews
\ No newline at end of file
......@@ -18,6 +18,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
......
......@@ -31,5 +31,10 @@
<option name="name" value="maven3" />
<option name="url" value="https://oss.jfrog.org/libs-snapshot" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
/build
\ No newline at end of file
/build
mapping.txt
seeds.txt
unused.txt
\ No newline at end of file
......@@ -10,16 +10,8 @@ android {
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled true
}
......
......@@ -2,7 +2,7 @@
apply from: "config.gradle"
buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.3.72'
repositories {
maven { url "https://jitpack.io" }
......@@ -10,7 +10,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
......
......@@ -8,10 +8,10 @@ ext {
//android开发版本配置
android = [
compileSdkVersion: 30,
buildToolsVersion: "29.0.2",
buildToolsVersion: "30.0.2",
applicationId : "com.mints.goodnews",
minSdkVersion : 21,
targetSdkVersion : 29,
targetSdkVersion : 30,
versionCode : 1,
versionName : "1.0.0",
]
......
......@@ -19,3 +19,21 @@ android.useAndroidX=true
android.enableJetifier=true
isBuildModule=false
DEBUG_URL="http://test.mints-id.com/camera-api/"
RELEASE_URL="https://api.mints-id.com/gc-api/"
RELEASE_KEY_PASSWORD=mints.goodnews
RELEASE_KEY_ALIAS=mints_goodnews
RELEASE_STORE_PASSWORD=mints.goodnews
RELEASE_STORE_FILE=mints_goodnews.jks
#ShareSDK
RELEASE_SHARESDK_KEY=
RELEASE_SHARESDK_SECRET=
#友盟
RELEASE_UMENG_KEY=
#JPush
RELEASE_JPUSH_KEY=
\ No newline at end of file
......@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
......@@ -16,6 +16,8 @@ android {
flavorDimensions '23'
multiDexEnabled true
buildConfigField ("boolean","IS_DEV","false")
buildConfigField ("String","AppKeyPre","abcd")
}
defaultConfig {
......
......@@ -22,6 +22,7 @@ android {
defaultConfig {
buildConfigField ("int","BUILD_VERSION","${buildVersion}")
}
// noArg {
// annotation("com.jeme.base.annotation.Poko")
// }
......
......@@ -6,6 +6,8 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.fry.base.BuildConfig;
import com.fry.base.netwrok.OkHttpInterceptor;
import com.fry.base.utils.encry.AESUtils;
import java.util.concurrent.TimeUnit;
......@@ -49,7 +51,7 @@ public class RetrofitClient {
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder()
.cookieJar(new CookieJarImpl(new PersistentCookieStore(mContext)))
// .cache(cache)
.addInterceptor(new BaseInterceptor(mHttpConfig.getHeads()))
.addInterceptor(new OkHttpInterceptor(AESUtils.getDefaultKey()))
// .addInterceptor(new CacheInterceptor(mContext))
.sslSocketFactory(sslParams.sSLSocketFactory, sslParams.trustManager)
.connectTimeout(mHttpConfig.getTimeOut(), TimeUnit.SECONDS)
......
package com.mints.camera.data.model.bean.net
package com.fry.base.bean
import android.annotation.SuppressLint
import android.os.Parcelable
......
package com.mints.camera.app.network
package com.fry.base.netwrok
import android.text.TextUtils
import com.bytedance.hume.readapk.HumeSDK
import android.util.Log
import com.fry.base.bean.AppRequest
import com.fry.base.utils.encry.AESUtils
import com.fry.base.utils.encry.Base64
import com.fry.base.utils.encry.MD5
import com.google.gson.Gson
import com.mints.camera.BuildConfig
import com.mints.camera.app.App
import com.mints.camera.app.ext.getTrackViewModel
import com.mints.camera.app.manager.UserManager
import com.mints.camera.app.util.CommonUtils
import com.mints.camera.app.util.LogUtil
import com.mints.camera.app.util.encry.AESUtils
import com.mints.camera.app.util.encry.Base64
import com.mints.camera.app.util.encry.MD5
import com.mints.camera.data.model.bean.net.AppRequest
import okhttp3.*
import okio.Buffer
import org.json.JSONObject
......@@ -35,7 +29,8 @@ class OkHttpInterceptor(aesKey: String) : Interceptor {
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val tokenID: String = UserManager.INSTANCE.getTokenID()
// val tokenID: String = UserManager.INSTANCE.getTokenID()
val tokenID: String = ""
val time = System.currentTimeMillis()
val channel = createChannel()
var request = chain.request()
......@@ -55,17 +50,18 @@ class OkHttpInterceptor(aesKey: String) : Interceptor {
* @return
*/
private fun createChannel(): String {
var channel: String = CommonUtils.getAppMetaData(App.instance, "CHANNEL_NAME")
try {
// 穿山甲分包渠道
val ttChannel = HumeSDK.getChannel(App.instance)
if (!TextUtils.isEmpty(ttChannel)) {
// 此处方式不能修改,已和后端约定
channel = channel + "_" + ttChannel
}
} catch (e: Exception) {
e.printStackTrace()
}
var channel: String = ""
// var channel: String = CommonUtils.getAppMetaData(App.instance, "CHANNEL_NAME")
// try {
// // 穿山甲分包渠道
// val ttChannel = HumeSDK.getChannel(App.instance)
// if (!TextUtils.isEmpty(ttChannel)) {
// // 此处方式不能修改,已和后端约定
// channel = channel + "_" + ttChannel
// }
// } catch (e: Exception) {
// e.printStackTrace()
// }
return channel
}
......@@ -175,8 +171,7 @@ class OkHttpInterceptor(aesKey: String) : Interceptor {
// rspString = json.toString().replace("\\", "");
}
} catch (e: Exception) {
LogUtil.d("OkHttpInterceptor", "json解密失败。url:${response.request.url}响应报文:${buffer.clone().readString(charset)}")
App.instance.getTrackViewModel().reportErrornterface(response.request.url.toString(), buffer.clone().readString(charset))
Log.d("OkHttpInterceptor", "json解密失败。url:${response.request.url}响应报文:${buffer.clone().readString(charset)}")
e.printStackTrace()
}
val responseBody = ResponseBody.create(contentType, rspString!!)
......
package com.mints.camera.app.util.encry;
package com.fry.base.utils.encry;
import android.util.Log;
import com.mints.camera.BuildConfig;
import com.mints.camera.app.common.Constants;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
......@@ -38,7 +36,6 @@ public class AESUtils {
byte[] encrypted = cipher.doFinal(message.getBytes("UTF-8"));
return new BASE64Encoder().encode(encrypted);
} catch (Exception e) {
Log.e(Constants.TAG_NAME, "aes加密失败");
}
return "";
}
......@@ -54,7 +51,6 @@ public class AESUtils {
byte[] detrypted = cipher.doFinal(res);
return new String(detrypted, "UTF-8");
} catch (Exception e) {
Log.e(Constants.TAG_NAME, "aes解密失败");
}
return "";
}
......@@ -82,17 +78,4 @@ public class AESUtils {
.append(getBK3(6));
return sb.toString();
}
public static void main(String[] args) throws Exception {
// String message = "123456wwe";
// String entryptedMsg = encrypt(message, key);
// System.out.println("encrypted message is below :");
// System.out.println("加密结果:" + entryptedMsg);
// String dexryptedmsg = "Dj4MYXI5X6gL3H+bBjAhspXibZVhO79bgzoIawpl/6NNJWsjTHKMJGLtTPmvInRmbK3ipi4NvxsU\n" + "FtSufnPbZCtpydpNldkXCJ3vNALju60=";
// String decryptedMsg = detrypt(dexryptedmsg, key);
// System.out.println("decrypted message is below :");
// System.out.println(MD5.GetMD5Code("meijie_2016").substring(8, 24));
System.out.println(MD5.GetMD5Code("mints_2021").substring(8, 24));
}
}
package com.mints.camera.app.util.encry;
package com.fry.base.utils.encry;
import java.io.ByteArrayOutputStream;
......
package com.mints.camera.app.util.encry;
package com.fry.base.utils.encry;
import android.util.Log;
......
package com.mints.camera.app.util.encry;
package com.fry.base.utils.encry;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
......
#Wed Jun 30 14:54:57 CST 2021
VERSION_BUILD=2207
#Wed Jun 30 15:47:03 CST 2021
VERSION_BUILD=2230
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