jw
08/23/2020, 2:59 PMrusshwolf
08/23/2020, 3:03 PMrusshwolf
08/23/2020, 3:03 PMjw
08/24/2020, 8:36 PMjw
08/24/2020, 8:37 PMrusshwolf
08/24/2020, 8:42 PMrusshwolf
08/24/2020, 8:42 PMjw
08/24/2020, 8:46 PMrusshwolf
08/24/2020, 10:55 PMjw
08/24/2020, 10:55 PMdimsuz
08/26/2020, 5:12 PMokhttp3
package and group name. I'm curious why is that. Or 4.x in version name has other semantical meaning that 3 in package/group name?jw
08/26/2020, 5:12 PMjw
08/26/2020, 5:13 PMdimsuz
08/26/2020, 5:13 PMjw
08/27/2020, 12:43 PMSam
08/28/2020, 2:09 AMjava.io.InterruptedIOException: interrupted
2020-08-28 09:04:45.255 16975-19983/vn.gapo.app W/System.err: at okio.Timeout.throwIfReached(Timeout.kt:98)
2020-08-28 09:04:45.255 16975-19983/vn.gapo.app W/System.err: at okio.InputStreamSource.read(Okio.kt:90)
2020-08-28 09:04:45.255 16975-19983/vn.gapo.app W/System.err: at okio.RealBufferedSink.writeAll(RealBufferedSink.kt:180)
2020-08-28 09:04:45.256 16975-19983/vn.gapo.app W/System.err: at okhttp3.RequestBody$Companion$asRequestBody$1.writeTo(RequestBody.kt:167)
2020-08-28 09:04:45.256 16975-19983/vn.gapo.app W/System.err: at com.gg.gapo.remote.upload.CountingRequestBody.writeTo(CountingRequestBody.kt:26)
2020-08-28 09:04:45.256 16975-19983/vn.gapo.app W/System.err: at okhttp3.MultipartBody.writeOrCountBytes(MultipartBody.kt:157)
2020-08-28 09:04:45.256 16975-19983/vn.gapo.app W/System.err: at okhttp3.MultipartBody.writeTo(MultipartBody.kt:93)
2020-08-28 09:04:45.256 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:59)
2020-08-28 09:04:45.257 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-08-28 09:04:45.257 16975-19983/vn.gapo.app W/System.err: at com.gg.gapo.remote.network.RequestInterceptor.intercept(RequestInterceptor.kt:36)
2020-08-28 09:04:45.257 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-08-28 09:04:45.257 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
2020-08-28 09:04:45.257 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-08-28 09:04:45.257 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:82)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:74)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.kt:152)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:197)
2020-08-28 09:04:45.258 16975-19983/vn.gapo.app W/System.err: at okhttp3.internal.connection.RealCall.execute(RealCall.kt:148)
CountingRequestBody for get progressSam
08/28/2020, 2:09 AMimport okhttp3.MediaType
import okhttp3.RequestBody
import okio.*
import java.io.IOException
/**
* @author Leo Nikkilä
* with modifications made by Paulina Sadowska
*/
class CountingRequestBody(private val delegate: RequestBody, private val listener: Listener) : RequestBody() {
override fun contentType(): MediaType? {
return delegate.contentType()
}
override fun contentLength(): Long {
return delegate.contentLength()
}
override fun writeTo(sink: BufferedSink) {
try {
val countingSink = CountingSink(sink)
val bufferedSink = countingSink.buffer()
delegate.writeTo(bufferedSink)
bufferedSink.flush()
}catch (ex:Exception){
ex.printStackTrace()
}
}
internal inner class CountingSink(delegate: Sink) : ForwardingSink(delegate) {
private var bytesWritten: Long = 0
@Throws(IOException::class)
override fun write(source: Buffer, byteCount: Long) {
super.write(source, byteCount)
bytesWritten += byteCount
listener.onRequestProgress(bytesWritten, contentLength())
}
}
interface Listener {
fun onRequestProgress(bytesWritten: Long, contentLength: Long)
}
}
Retrofit config
inline fun provideLoggingInterceptor(): HttpLoggingInterceptor {
return if (BuildConfig.DEBUG) {
HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.NONE
}
} else {
HttpLoggingInterceptor()
}
}
inline fun provideRequestInterceptor(): RequestInterceptor {
return RequestInterceptor()
}
inline fun provideOkHttpClient(): OkHttpClient {
return OkHttpClient.Builder()
.connectTimeout(1, TimeUnit.MINUTES)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(15, TimeUnit.SECONDS)
.addNetworkInterceptor(provideRequestInterceptor())
.addInterceptor(provideLoggingInterceptor())
// .addNetworkInterceptor(StethoInterceptor())
.build()
}
inline fun provideRetrofit(baseUrl: String): Retrofit {
return Retrofit.Builder()
.client(provideOkHttpClient())
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create(GsonBuilder()
.setLenient()
.create()))
.addCallAdapterFactory(GapoCoroutineCallAdapterFactory())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
}
Jeff
08/30/2020, 5:38 AMsaket
08/30/2020, 5:46 AMNikky
08/30/2020, 9:38 AMveyndan
08/30/2020, 12:42 PMNikky
08/30/2020, 6:56 PMNikky
08/31/2020, 12:03 PMsaket
08/31/2020, 11:22 PMjameswald
08/31/2020, 11:25 PMglade
09/03/2020, 2:10 AMjw
09/03/2020, 2:11 AMglade
09/03/2020, 2:17 AMZac Sweers
09/03/2020, 2:46 AMSam Garfinkel
09/03/2020, 4:01 PMextends
and super
? I’m trying to generate a method that accepts a Function<? super T, ? extends U>