fixed crashes on android 4.0
This commit is contained in:
parent
01b87a8da9
commit
5828cd9063
|
@ -19,6 +19,9 @@
|
|||
|
||||
package org.mariotaku.twidere.util.net;
|
||||
|
||||
import android.os.Build;
|
||||
import android.support.annotation.RequiresApi;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
|
@ -32,6 +35,7 @@ import javax.net.ssl.SSLSocketFactory;
|
|||
/**
|
||||
* @author fkrauthan
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
public class TLSSocketFactory extends SSLSocketFactory {
|
||||
|
||||
private SSLSocketFactory internalSSLSocketFactory;
|
||||
|
|
|
@ -42,7 +42,7 @@ object HttpClientFactory {
|
|||
fun initOkHttpClient(conf: HttpClientConfiguration, builder: OkHttpClient.Builder, dns: Dns,
|
||||
connectionPool: ConnectionPool, cache: Cache) {
|
||||
updateHttpClientConfiguration(builder, conf, dns, connectionPool, cache)
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (Build.VERSION.SDK_INT in Build.VERSION_CODES.JELLY_BEAN until Build.VERSION_CODES.LOLLIPOP) {
|
||||
val tlsSocketFactory = TLSSocketFactory()
|
||||
val trustManager = Platform.get().trustManager(tlsSocketFactory) ?:
|
||||
systemDefaultTrustManager()
|
||||
|
|
Loading…
Reference in New Issue