Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@InstallIn(SingletonComponent::class)
@Module
object NetworkModule {
@Singleton
fun provideOkHttp(): OkHttpClient {
// verify not main thread
assert(Looper.getMainLooper() != Looper.myLooper())
return OkHttpClient.Builder().build()
}
@Singleton
fun provideGson(): Gson {
// verify not main thread
assert(Looper.getMainLooper() != Looper.myLooper())
return GsonBuilder().create()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment