forked from github/szkolny
[App] Disable SSLProvider in Google Play builds.
This commit is contained in:
parent
5b5dc5cade
commit
1bf0679e92
@ -183,7 +183,8 @@ dependencies {
|
|||||||
implementation "eu.szkolny:mhttp:af4b62e6e9"
|
implementation "eu.szkolny:mhttp:af4b62e6e9"
|
||||||
implementation "eu.szkolny:nachos:0e5dfcaceb"
|
implementation "eu.szkolny:nachos:0e5dfcaceb"
|
||||||
implementation "eu.szkolny.selective-dao:annotation:27f8f3f194"
|
implementation "eu.szkolny.selective-dao:annotation:27f8f3f194"
|
||||||
implementation "eu.szkolny:ssl-provider:1.0.0"
|
officialImplementation "eu.szkolny:ssl-provider:1.0.0"
|
||||||
|
unofficialImplementation "eu.szkolny:ssl-provider:1.0.0"
|
||||||
implementation "pl.szczodrzynski:navlib:0.8.0"
|
implementation "pl.szczodrzynski:navlib:0.8.0"
|
||||||
implementation "pl.szczodrzynski:numberslidingpicker:2921225f76"
|
implementation "pl.szczodrzynski:numberslidingpicker:2921225f76"
|
||||||
implementation "pl.szczodrzynski:recyclertablayout:700f980584"
|
implementation "pl.szczodrzynski:recyclertablayout:700f980584"
|
||||||
|
@ -26,8 +26,6 @@ import com.google.firebase.messaging.FirebaseMessaging
|
|||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.hypertrack.hyperlog.HyperLog
|
import com.hypertrack.hyperlog.HyperLog
|
||||||
import com.mikepenz.iconics.Iconics
|
import com.mikepenz.iconics.Iconics
|
||||||
import eu.szkolny.sslprovider.SSLProvider
|
|
||||||
import eu.szkolny.sslprovider.enableSupportedTls
|
|
||||||
import im.wangchao.mhttp.MHttp
|
import im.wangchao.mhttp.MHttp
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import me.leolin.shortcutbadger.ShortcutBadger
|
import me.leolin.shortcutbadger.ShortcutBadger
|
||||||
@ -42,6 +40,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Profile
|
|||||||
import pl.szczodrzynski.edziennik.ext.DAY
|
import pl.szczodrzynski.edziennik.ext.DAY
|
||||||
import pl.szczodrzynski.edziennik.ext.MS
|
import pl.szczodrzynski.edziennik.ext.MS
|
||||||
import pl.szczodrzynski.edziennik.ext.setLanguage
|
import pl.szczodrzynski.edziennik.ext.setLanguage
|
||||||
|
import pl.szczodrzynski.edziennik.network.SSLProviderInstaller
|
||||||
import pl.szczodrzynski.edziennik.network.cookie.DumbCookieJar
|
import pl.szczodrzynski.edziennik.network.cookie.DumbCookieJar
|
||||||
import pl.szczodrzynski.edziennik.sync.SyncWorker
|
import pl.szczodrzynski.edziennik.sync.SyncWorker
|
||||||
import pl.szczodrzynski.edziennik.sync.UpdateWorker
|
import pl.szczodrzynski.edziennik.sync.UpdateWorker
|
||||||
@ -49,7 +48,6 @@ import pl.szczodrzynski.edziennik.ui.base.CrashActivity
|
|||||||
import pl.szczodrzynski.edziennik.utils.*
|
import pl.szczodrzynski.edziennik.utils.*
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import pl.szczodrzynski.edziennik.utils.managers.*
|
import pl.szczodrzynski.edziennik.utils.managers.*
|
||||||
import timber.log.Timber
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
@ -119,7 +117,8 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
.connectTimeout(15, TimeUnit.SECONDS)
|
.connectTimeout(15, TimeUnit.SECONDS)
|
||||||
.writeTimeout(10, TimeUnit.SECONDS)
|
.writeTimeout(10, TimeUnit.SECONDS)
|
||||||
.readTimeout(30, TimeUnit.SECONDS)
|
.readTimeout(30, TimeUnit.SECONDS)
|
||||||
.enableSupportedTls(enableCleartext = true)
|
|
||||||
|
SSLProviderInstaller.enableSupportedTls(builder, enableCleartext = true)
|
||||||
|
|
||||||
if (devMode) {
|
if (devMode) {
|
||||||
HyperLog.initialize(this)
|
HyperLog.initialize(this)
|
||||||
@ -203,18 +202,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.Default) {
|
||||||
config.migrate(this@App)
|
config.migrate(this@App)
|
||||||
|
|
||||||
SSLProvider.install(
|
SSLProviderInstaller.install(applicationContext, this@App::buildHttp)
|
||||||
applicationContext,
|
|
||||||
downloadIfNeeded = true,
|
|
||||||
supportTls13 = false,
|
|
||||||
onFinish = {
|
|
||||||
buildHttp()
|
|
||||||
},
|
|
||||||
onError = {
|
|
||||||
Timber.e("Failed to install SSLProvider: $it")
|
|
||||||
it.printStackTrace()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (config.devModePassword != null)
|
if (config.devModePassword != null)
|
||||||
checkDevModePassword()
|
checkDevModePassword()
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Kuba Szczodrzyński 2022-2-21.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pl.szczodrzynski.edziennik.network
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import eu.szkolny.sslprovider.SSLProvider
|
||||||
|
import eu.szkolny.sslprovider.enableSupportedTls
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
|
object SSLProviderInstaller {
|
||||||
|
|
||||||
|
fun install(applicationContext: Context, rebuildCallback: () -> Unit) {
|
||||||
|
SSLProvider.install(
|
||||||
|
applicationContext,
|
||||||
|
downloadIfNeeded = true,
|
||||||
|
supportTls13 = false,
|
||||||
|
onFinish = {
|
||||||
|
rebuildCallback()
|
||||||
|
},
|
||||||
|
onError = {
|
||||||
|
Timber.e("Failed to install SSLProvider: $it")
|
||||||
|
it.printStackTrace()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun enableSupportedTls(builder: OkHttpClient.Builder, enableCleartext: Boolean = true) {
|
||||||
|
builder.enableSupportedTls(enableCleartext)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Kuba Szczodrzyński 2022-2-21.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pl.szczodrzynski.edziennik.network
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
|
object SSLProviderInstaller {
|
||||||
|
|
||||||
|
fun install(applicationContext: Context, rebuildCallback: () -> Unit) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun enableSupportedTls(builder: OkHttpClient.Builder, enableCleartext: Boolean = true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user