Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_fiveworld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_fiveworld
Commits
d224d0b3
Commit
d224d0b3
authored
Jun 30, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加拦截器,更新gradle版本
parent
df5b0ceb
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
69 additions
and
66 deletions
+69
-66
.name
.idea/.name
+1
-0
gradle.xml
.idea/gradle.xml
+1
-0
jarRepositories.xml
.idea/jarRepositories.xml
+5
-0
misc.xml
.idea/misc.xml
+1
-1
.gitignore
app/.gitignore
+4
-1
build.gradle
app/build.gradle
+0
-8
build.gradle
build.gradle
+2
-2
config.gradle
config.gradle
+2
-2
gradle.properties
gradle.properties
+18
-0
gradle-wrapper.properties
gradle/wrapper/gradle-wrapper.properties
+1
-1
library.build.gradle
library.build.gradle
+2
-0
build.gradle
library_base/build.gradle
+1
-0
RetrofitClient.java
...rc/main/java/com/fry/base/basenetwork/RetrofitClient.java
+3
-1
AppRequest.kt
library_base/src/main/java/com/fry/base/bean/AppRequest.kt
+1
-1
OkHttpInterceptor.kt
...e/src/main/java/com/fry/base/netwrok/OkHttpInterceptor.kt
+21
-26
AESUtils.java
...base/src/main/java/com/fry/base/utils/encry/AESUtils.java
+1
-18
Base64.java
...y_base/src/main/java/com/fry/base/utils/encry/Base64.java
+1
-1
Des3.java
...ary_base/src/main/java/com/fry/base/utils/encry/Des3.java
+1
-1
MD5.java
library_base/src/main/java/com/fry/base/utils/encry/MD5.java
+1
-1
version.properties
library_base/version.properties
+2
-2
No files found.
.idea/.name
0 → 100644
View file @
d224d0b3
GoodNews
\ No newline at end of file
.idea/gradle.xml
View file @
d224d0b3
...
...
@@ -18,6 +18,7 @@
</set>
</option>
<option
name=
"resolveModulePerSourceSet"
value=
"false"
/>
<option
name=
"useQualifiedModuleNames"
value=
"true"
/>
</GradleProjectSettings>
</option>
</component>
...
...
.idea/jarRepositories.xml
View file @
d224d0b3
...
...
@@ -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
.idea/misc.xml
View file @
d224d0b3
...
...
@@ -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"
>
...
...
app/.gitignore
View file @
d224d0b3
/build
\ No newline at end of file
/build
mapping.txt
seeds.txt
unused.txt
\ No newline at end of file
app/build.gradle
View file @
d224d0b3
...
...
@@ -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
}
...
...
build.gradle
View file @
d224d0b3
...
...
@@ -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"
...
...
config.gradle
View file @
d224d0b3
...
...
@@ -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"
,
]
...
...
gradle.properties
View file @
d224d0b3
...
...
@@ -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
gradle/wrapper/gradle-wrapper.properties
View file @
d224d0b3
...
...
@@ -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
library.build.gradle
View file @
d224d0b3
...
...
@@ -16,6 +16,8 @@ android {
flavorDimensions
'23'
multiDexEnabled
true
buildConfigField
(
"boolean"
,
"IS_DEV"
,
"false"
)
buildConfigField
(
"String"
,
"AppKeyPre"
,
"abcd"
)
}
defaultConfig
{
...
...
library_base/build.gradle
View file @
d224d0b3
...
...
@@ -22,6 +22,7 @@ android {
defaultConfig
{
buildConfigField
(
"int"
,
"BUILD_VERSION"
,
"${buildVersion}"
)
}
// noArg {
// annotation("com.jeme.base.annotation.Poko")
// }
...
...
library_base/src/main/java/com/fry/base/basenetwork/RetrofitClient.java
View file @
d224d0b3
...
...
@@ -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
)
...
...
library_base/src/main/java/com/fry/base/bean/AppRequest.kt
View file @
d224d0b3
package
com.
mints.camera.data.model.bean.net
package
com.
fry.base.bean
import
android.annotation.SuppressLint
import
android.os.Parcelable
...
...
library_base/src/main/java/com/fry/base/netw
or
k/OkHttpInterceptor.kt
→
library_base/src/main/java/com/fry/base/netw
ro
k/OkHttpInterceptor.kt
View file @
d224d0b3
package
com.
mints.camera.app.networ
k
package
com.
fry.base.netwro
k
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
!!
)
...
...
library_base/src/main/java/com/fry/base/utils/encry/AESUtils.java
View file @
d224d0b3
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
));
}
}
library_base/src/main/java/com/fry/base/utils/encry/Base64.java
View file @
d224d0b3
package
com
.
mints
.
camera
.
app
.
util
.
encry
;
package
com
.
fry
.
base
.
utils
.
encry
;
import
java.io.ByteArrayOutputStream
;
...
...
library_base/src/main/java/com/fry/base/utils/encry/Des3.java
View file @
d224d0b3
package
com
.
mints
.
camera
.
app
.
util
.
encry
;
package
com
.
fry
.
base
.
utils
.
encry
;
import
android.util.Log
;
...
...
library_base/src/main/java/com/fry/base/utils/encry/MD5.java
View file @
d224d0b3
package
com
.
mints
.
camera
.
app
.
util
.
encry
;
package
com
.
fry
.
base
.
utils
.
encry
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
...
...
library_base/version.properties
View file @
d224d0b3
#Wed Jun 30 1
4:54:57
CST 2021
VERSION_BUILD
=
22
07
#Wed Jun 30 1
5:47:03
CST 2021
VERSION_BUILD
=
22
30
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment