Commit d224d0b3 authored by mengcuiguang's avatar mengcuiguang

添加拦截器,更新gradle版本

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