|
|
|
|
@ -10,7 +10,11 @@ import io.ktor.client.plugins.HttpTimeout
|
|
|
|
|
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
|
|
|
|
import io.ktor.client.plugins.cookies.HttpCookies
|
|
|
|
|
import io.ktor.client.plugins.defaultRequest
|
|
|
|
|
import io.ktor.client.plugins.logging.LogLevel
|
|
|
|
|
import io.ktor.client.plugins.logging.Logger
|
|
|
|
|
import io.ktor.client.plugins.logging.Logging
|
|
|
|
|
import io.ktor.client.request.header
|
|
|
|
|
import io.ktor.http.HttpHeaders
|
|
|
|
|
import io.ktor.serialization.kotlinx.json.json
|
|
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
|
|
import kotlinx.coroutines.withContext
|
|
|
|
|
@ -18,6 +22,7 @@ import kotlinx.serialization.json.Json
|
|
|
|
|
import net.openid.appauth.AuthState
|
|
|
|
|
import okhttp3.OkHttpClient
|
|
|
|
|
import okhttp3.internal.tls.OkHostnameVerifier
|
|
|
|
|
import org.tasks.BuildConfig
|
|
|
|
|
import org.tasks.DebugNetworkInterceptor
|
|
|
|
|
import org.tasks.caldav.TasksCookieJar
|
|
|
|
|
import org.tasks.data.entity.CaldavAccount
|
|
|
|
|
@ -26,6 +31,7 @@ import org.tasks.preferences.Preferences
|
|
|
|
|
import org.tasks.security.KeyStoreEncryption
|
|
|
|
|
import org.tasks.sync.microsoft.MicrosoftService
|
|
|
|
|
import org.tasks.sync.microsoft.requestTokenRefresh
|
|
|
|
|
import timber.log.Timber
|
|
|
|
|
import javax.inject.Inject
|
|
|
|
|
import javax.net.ssl.SSLContext
|
|
|
|
|
|
|
|
|
|
@ -122,6 +128,16 @@ class HttpClientFactory @Inject constructor(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
install(HttpErrorHandler)
|
|
|
|
|
|
|
|
|
|
install(Logging) {
|
|
|
|
|
logger = object : Logger {
|
|
|
|
|
override fun log(message: String) {
|
|
|
|
|
Timber.d(message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
level = if (BuildConfig.DEBUG) LogLevel.ALL else LogLevel.HEADERS
|
|
|
|
|
sanitizeHeader { header -> header == HttpHeaders.Authorization }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return MicrosoftService(
|
|
|
|
|
client = client
|
|
|
|
|
|