Skip to content

Commit

Permalink
mod 支持 Android 4.4 Glide加载https图片
Browse files Browse the repository at this point in the history
  • Loading branch information
KLOSWC committed Mar 1, 2024
1 parent aa94f24 commit a4addd3
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.bumptech.glide.load.model.ModelLoader
import com.bumptech.glide.load.model.ModelLoader.LoadData
import com.bumptech.glide.load.model.ModelLoaderFactory
import com.bumptech.glide.load.model.MultiModelLoaderFactory
import com.github.catvod.net.SSLCompat
import okhttp3.Call
import okhttp3.OkHttpClient
import java.io.InputStream
Expand Down Expand Up @@ -45,7 +46,11 @@ class OkHttpUrlLoader(
}

companion object {
private val internalClient: Call.Factory = OkHttpClient().newBuilder().followRedirects(false).followSslRedirects(false).build()//modify by muziling
private val internalClient: Call.Factory = OkHttpClient().newBuilder().apply {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
sslSocketFactory(SSLCompat(), SSLCompat.TM)
}
}.followRedirects(false).followSslRedirects(false).build()//modify by muziling
}
}

Expand Down

0 comments on commit a4addd3

Please sign in to comment.