Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
Widget
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 Widget
Widget
Commits
60639b0d
Commit
60639b0d
authored
May 23, 2023
by
快乐石头111
Browse files
Options
Browse Files
Download
Plain Diff
修改fetch库context获取路径导致的anr问题&v1.0.5发布
parents
c0cb7b48
b77be41d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
7 deletions
+7
-7
build.gradle
fetch/build.gradle
+1
-1
KotlinCoroutinesCallAdapterFactory.kt
...d/fetch/callAdapter/KotlinCoroutinesCallAdapterFactory.kt
+1
-1
OkHttpConfig.kt
.../main/java/com/qimai/android/fetch/config/OkHttpConfig.kt
+3
-3
ViewModelExtention.kt
...a/com/qimai/android/fetch/extention/ViewModelExtention.kt
+1
-1
AndroidNetWorkTools.kt
.../java/com/qimai/android/fetch/tool/AndroidNetWorkTools.kt
+1
-1
No files found.
fetch/build.gradle
View file @
60639b0d
...
@@ -63,7 +63,7 @@ repositories {
...
@@ -63,7 +63,7 @@ repositories {
mavenCentral
()
mavenCentral
()
}
}
group
'com.qmai.android.fetch'
group
'com.qmai.android.fetch'
version
'1.0.
2
'
version
'1.0.
5
'
gradlePublish
{
gradlePublish
{
...
...
fetch/src/main/java/com/qimai/android/fetch/callAdapter/KotlinCoroutinesCallAdapterFactory.kt
View file @
60639b0d
...
@@ -227,7 +227,7 @@ class KotlinCoroutinesCallAdapterFactory(
...
@@ -227,7 +227,7 @@ class KotlinCoroutinesCallAdapterFactory(
charset
=
contentType
.
charset
(
Charset
.
forName
(
"UTF-8"
))
charset
=
contentType
.
charset
(
Charset
.
forName
(
"UTF-8"
))
}
}
if
(
isPlaintext
(
buffer
))
{
if
(
isPlaintext
(
buffer
))
{
Log
.
d
(
TAG
,
"getRequestInfo: requestMessage = $requestMessage requestMessage size = ${requestMessage.length} bytes buffer size = ${buffer.size()}"
)
//
Log.d(TAG, "getRequestInfo: requestMessage = $requestMessage requestMessage size = ${requestMessage.length} bytes buffer size = ${buffer.size()}")
requestMessage
.
append
(
buffer
.
readString
(
charset
))
requestMessage
.
append
(
buffer
.
readString
(
charset
))
buffer
.
clear
()
buffer
.
clear
()
requestMessage
.
append
(
requestMessage
.
append
(
...
...
fetch/src/main/java/com/qimai/android/fetch/config/OkHttpConfig.kt
View file @
60639b0d
...
@@ -190,12 +190,12 @@ class OkHttpConfig private constructor(builder: Builder) {
...
@@ -190,12 +190,12 @@ class OkHttpConfig private constructor(builder: Builder) {
* 配置缓存
* 配置缓存
*/
*/
private
fun
setCacheConfig
()
{
private
fun
setCacheConfig
()
{
val
externalCacheDir
=
HolderContext
.
getContext
().
externalCacheDir
?:
return
if
(
isCache
)
{
defaultCachePath
=
externalCacheDir
.
path
+
"/RxHttpCacheData"
if
(
isCache
)
{
val
cache
:
Cache
=
if
(!
TextUtils
.
isEmpty
(
cachePath
)
&&
cacheMaxSize
>
0
)
{
val
cache
:
Cache
=
if
(!
TextUtils
.
isEmpty
(
cachePath
)
&&
cacheMaxSize
>
0
)
{
Cache
(
File
(
cachePath
!!
),
cacheMaxSize
)
Cache
(
File
(
cachePath
!!
),
cacheMaxSize
)
}
else
{
}
else
{
val
externalCacheDir
=
HolderContext
.
getContext
().
externalCacheDir
?:
return
defaultCachePath
=
externalCacheDir
.
path
+
"/RxHttpCacheData"
Cache
(
File
(
defaultCachePath
!!
),
defaultCacheSize
)
Cache
(
File
(
defaultCachePath
!!
),
defaultCacheSize
)
}
}
...
...
fetch/src/main/java/com/qimai/android/fetch/extention/ViewModelExtention.kt
View file @
60639b0d
...
@@ -96,7 +96,7 @@ fun <T> ViewModel.flowSafeCall(request: () -> T) = liveData<Resource<T>> {
...
@@ -96,7 +96,7 @@ fun <T> ViewModel.flowSafeCall(request: () -> T) = liveData<Resource<T>> {
}
}
fun
<
T
>
handleResponseError
(
throwable
:
Throwable
?):
Resource
<
T
>
{
fun
<
T
>
handleResponseError
(
throwable
:
Throwable
?):
Resource
<
T
>
{
Log
.
d
(
TAG
,
"handleResponseError: throwable= $throwable"
)
//
Log.d(TAG, "handleResponseError: throwable= $throwable")
return
when
(
throwable
)
{
return
when
(
throwable
)
{
null
->
Resource
.
error
(
"程序出错"
,
ErrorData
(
originThrowable
=
throwable
))
null
->
Resource
.
error
(
"程序出错"
,
ErrorData
(
originThrowable
=
throwable
))
is
HttpException
->
when
(
throwable
.
code
())
{
is
HttpException
->
when
(
throwable
.
code
())
{
...
...
fetch/src/main/java/com/qimai/android/fetch/tool/AndroidNetWorkTools.kt
View file @
60639b0d
...
@@ -15,7 +15,7 @@ import android.net.ConnectivityManager
...
@@ -15,7 +15,7 @@ import android.net.ConnectivityManager
**/
**/
fun
isNetworkConnected
(
context
:
Context
):
Boolean
{
fun
isNetworkConnected
(
context
:
Context
):
Boolean
{
val
mConnectivityManager
=
val
mConnectivityManager
=
context
!!
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
)
as
ConnectivityManager
context
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
)
as
ConnectivityManager
val
mNetworkInfo
=
mConnectivityManager
.
activeNetworkInfo
val
mNetworkInfo
=
mConnectivityManager
.
activeNetworkInfo
if
(
mNetworkInfo
!=
null
)
{
if
(
mNetworkInfo
!=
null
)
{
return
mNetworkInfo
.
isAvailable
return
mNetworkInfo
.
isAvailable
...
...
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