Use directly java.net.proxy class
This commit is contained in:
parent
3d33018ffa
commit
7ae52d676d
|
@ -23,7 +23,6 @@ import androidx.work.WorkManager
|
|||
import com.zhuinden.monarchy.Monarchy
|
||||
import im.vector.matrix.android.BuildConfig
|
||||
import im.vector.matrix.android.api.auth.AuthenticationService
|
||||
import im.vector.matrix.android.api.config.ProxyConfiguration
|
||||
import im.vector.matrix.android.api.crypto.MXCryptoConfig
|
||||
import im.vector.matrix.android.internal.SessionManager
|
||||
import im.vector.matrix.android.internal.crypto.attachments.ElementToDecrypt
|
||||
|
@ -33,14 +32,19 @@ import im.vector.matrix.android.internal.network.UserAgentHolder
|
|||
import im.vector.matrix.android.internal.util.BackgroundDetectionObserver
|
||||
import org.matrix.olm.OlmManager
|
||||
import java.io.InputStream
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.net.Proxy
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import javax.inject.Inject
|
||||
|
||||
data class MatrixConfiguration(
|
||||
val applicationFlavor: String = "Default-application-flavor",
|
||||
val cryptoConfig: MXCryptoConfig = MXCryptoConfig(),
|
||||
val proxyConfig: ProxyConfiguration? = null
|
||||
/**
|
||||
* Optional proxy to connect to the matrix servers
|
||||
* You can create one using for instance Proxy(proxyType, InetSocketAddress(hostname, port)
|
||||
*/
|
||||
val proxy: Proxy? = null
|
||||
) {
|
||||
|
||||
interface Provider {
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.matrix.android.api.config
|
||||
|
||||
import java.net.Proxy
|
||||
|
||||
/**
|
||||
* This is the configuration to use a proxy to connect to the matrix servers
|
||||
*/
|
||||
data class ProxyConfiguration(val hostname: String, val port: Int, val proxyType: Proxy.Type)
|
|
@ -29,8 +29,6 @@ import im.vector.matrix.android.internal.network.interceptors.FormattedJsonHttpL
|
|||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import okreplay.OkReplayInterceptor
|
||||
import java.net.InetSocketAddress
|
||||
import java.net.Proxy
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@Module
|
||||
|
@ -86,8 +84,8 @@ internal object NetworkModule {
|
|||
if (BuildConfig.LOG_PRIVATE_DATA) {
|
||||
addInterceptor(curlLoggingInterceptor)
|
||||
}
|
||||
matrixConfiguration.proxyConfig?.let {
|
||||
proxy(Proxy(it.proxyType, InetSocketAddress(it.hostname, it.port)))
|
||||
matrixConfiguration.proxy?.let {
|
||||
proxy(it)
|
||||
}
|
||||
}
|
||||
.addInterceptor(okReplayInterceptor)
|
||||
|
|
Loading…
Reference in New Issue