Skip to content

Commit

Permalink
fix(feat/coolapk): fix coolapk download
Browse files Browse the repository at this point in the history
  • Loading branch information
xz-dev committed Jul 3, 2022
1 parent 5eb09f2 commit 4679518
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/src/main/res/layout/item_hub_app_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
android:background="@drawable/bg_update_btn"
android:onClick="@{(view) -> handler.clickDownload(item.app, view)}"
android:text="@string/update"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/xml/file_paths.xml

This file was deleted.

1 change: 1 addition & 0 deletions core-websdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies {

// OkHttp
api 'com.squareup.okhttp3:okhttp:5.0.0-alpha.10'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:5.0.0-alpha.10'
// dom4j, xml support
implementation 'org.dom4j:dom4j:2.1.3'
// markdown support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ internal class CoolApk(
?: return null
return listOf(
DownloadItem(
newAssets.fileName, newAssets.downloadUrl ?: return null, headerMap, null
newAssets.fileName, newAssets.downloadUrl ?: return null, null, null
)
)
} else {
Log.i(logObjectTag, TAG, "getDownload: 网址验证正确")
return listOf(DownloadItem(assetGson.fileName, request.url.toString(), headerMap, null))
return listOf(DownloadItem(assetGson.fileName, request.url.toString(), null, null))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import net.xzos.upgradeall.core.utils.log.Log
import net.xzos.upgradeall.core.utils.log.ObjectTag
import net.xzos.upgradeall.core.utils.log.msg
import okhttp3.*
import okhttp3.FormBody
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONObject
import java.io.IOException
import java.net.CookieManager
import java.util.concurrent.TimeUnit


Expand All @@ -20,6 +19,7 @@ class OkHttpApi internal constructor() {
}

private val client = OkHttpClient().newBuilder()
.cookieJar(cookieJar)
.dispatcher(dispatcher)
.callTimeout(15, TimeUnit.SECONDS)
.connectTimeout(15, TimeUnit.SECONDS)
Expand Down Expand Up @@ -86,6 +86,8 @@ class OkHttpApi internal constructor() {
companion object {
private const val TAG = "OkHttpApi"

private val cookieJar = JavaNetCookieJar(CookieManager())

fun callHttpFunc(objectTag: ObjectTag, url: String, core: () -> Response): Response? {
return try {
core()
Expand Down

0 comments on commit 4679518

Please sign in to comment.