I have a working application, but I would like to improve one point. The method ("private fun save"), which is responsible for saving the information I need, I would like to make asynchronous.
But the problem is that when I change it to - "private suspend fun save", I have to make suspend and override fun intercept method. But since it is override, I get an error:
Conflicting overloads: public open suspend fun intercept(chain: Interceptor.Chain): Response defined in com.pocketscout.network.PocketScoutInterceptor, public abstract fun intercept(chain: Interceptor.Chain) : Response defined in okhttp3.Interceptor.
Is this problem somehow solved?
class PocketScoutInterceptor(
private val appContainer: PocketScoutContainer,
) : okhttp3.Interceptor {
@Throws(IOException::class)
override fun intercept(chain: okhttp3.Interceptor.Chain): okhttp3.Response {
val packet = buildPacket(timestamp, duration, request, response, description)
save(packet)
return response ?: okhttp3.Response.Builder().build()
}