Convert method to lambda

pull/1419/head
Alex Baker 3 years ago
parent fdb977031d
commit b678cb1086

@ -23,7 +23,6 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import net.fortuna.ical4j.model.property.ProdId import net.fortuna.ical4j.model.property.ProdId
import okhttp3.Headers import okhttp3.Headers
import okhttp3.HttpUrl import okhttp3.HttpUrl
import okhttp3.Interceptor
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.RequestBody import okhttp3.RequestBody
import org.tasks.BuildConfig import org.tasks.BuildConfig
@ -130,13 +129,11 @@ class CaldavSynchronizer @Inject constructor(
private suspend fun synchronize(account: CaldavAccount) { private suspend fun synchronize(account: CaldavAccount) {
val caldavClient = provider.forAccount(account) val caldavClient = provider.forAccount(account)
var serverType = SERVER_UNKNOWN var serverType = SERVER_UNKNOWN
val resources = caldavClient.calendars(object : Interceptor { val resources = caldavClient.calendars { chain ->
override fun intercept(chain: Interceptor.Chain): okhttp3.Response {
val response = chain.proceed(chain.request()) val response = chain.proceed(chain.request())
serverType = getServerType(account, response.headers) serverType = getServerType(account, response.headers)
return response response
} }
})
if (serverType != account.serverType) { if (serverType != account.serverType) {
account.serverType = serverType account.serverType = serverType
caldavDao.update(account) caldavDao.update(account)

Loading…
Cancel
Save