Skip to content

Commit

Permalink
fix: 修复下载崩溃的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xz-dev committed Aug 10, 2021
1 parent adccd73 commit 0d9db90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
minSdkVersion 21
targetSdkVersion 31
versionCode 85
versionName "0.10.0-alpha"
versionName "0.10.0-alpha.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
kapt {
arguments {
Expand Down Expand Up @@ -73,14 +73,14 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
implementation 'androidx.viewpager2:viewpager2:1.1.0-alpha01'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'

implementation 'androidx.fragment:fragment-ktx:1.3.6'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
Expand All @@ -102,7 +102,7 @@ dependencies {
// Firebase
implementation 'com.google.firebase:firebase-perf:20.0.2'
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation 'com.google.firebase:firebase-crashlytics:18.2.0'
implementation 'com.google.firebase:firebase-crashlytics:18.2.1'

// 数据处理
implementation 'com.jonathanfinerty.once:once:1.3.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal object WebApi {
val release = Gson().fromJson(responseStr, ReleaseGson::class.java)
callback(listOf(release))
}
410 -> callback(listOf())
410 -> callback(emptyList())
else -> {
Log.e(objectTag, TAG, "getAppRelease: $it")
callback(null)
Expand Down Expand Up @@ -75,7 +75,7 @@ internal object WebApi {
val releaseList = Gson().fromJson<List<ReleaseGson>>(responseStr, listType)
callback(releaseList)
}
410 -> callback(listOf())
410 -> callback(emptyList())
else -> {
Log.e(objectTag, TAG, "getAppReleaseList: $it")
callback(null)
Expand All @@ -95,6 +95,7 @@ internal object WebApi {
val url = "http://$host/v1/app/$hubUuid/${appIdPath}/extra_download/$assetIndexPath"
val response = callApiCore { OkHttpApi.get(url, authHeader) }
val responseStr = response?.body?.string()
if (responseStr.isNullOrBlank())return emptyList()
val listType = object : TypeToken<ArrayList<DownloadItem>>() {}.type
return Gson().fromJson(responseStr, listType)
}
Expand Down

0 comments on commit 0d9db90

Please sign in to comment.