Skip to content

Commit

Permalink
Adding custom User-Agent to WebDav requests.
Browse files Browse the repository at this point in the history
Upping versionCode to 92
  • Loading branch information
Dima-Android committed Aug 28, 2024
1 parent c33e586 commit c437c82
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dagger.Provides
import dagger.hilt.migration.DisableInstallInCheck
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor.Level
import org.zotero.android.api.ClientInfoNetworkInterceptor
import org.zotero.android.api.HttpLoggingInterceptor
import org.zotero.android.api.NetworkConfiguration
import org.zotero.android.api.annotations.ForWebSocket
Expand All @@ -20,12 +21,14 @@ object ApiWebSocketModule {
@Singleton
@ForWebSocket
fun provideSocketOkHttpClient(
configuration: NetworkConfiguration
configuration: NetworkConfiguration,
clientInfoNetworkInterceptor: ClientInfoNetworkInterceptor,
): OkHttpClient {
return OkHttpClient.Builder()
.addInterceptor(HttpLoggingInterceptor.createInterceptor(Level.BODY))
.setNetworkTimeout(configuration.networkTimeout)
.pingInterval(5, TimeUnit.SECONDS)
.addInterceptor(clientInfoNetworkInterceptor)
.build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import okhttp3.ConnectionPool
import okhttp3.Dispatcher
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor.Level
import org.zotero.android.api.ClientInfoNetworkInterceptor
import org.zotero.android.api.HttpLoggingInterceptor
import org.zotero.android.api.WebDavAuthNetworkInterceptor
import org.zotero.android.api.annotations.ForWebDav
Expand All @@ -25,6 +26,7 @@ object WebDavModule {
@ForWebDav
fun provideWebDavOkHttpClient(
webDavAuthNetworkInterceptor: WebDavAuthNetworkInterceptor,
clientInfoNetworkInterceptor: ClientInfoNetworkInterceptor,
): OkHttpClient {
val connectionPool = ConnectionPool(
maxIdleConnections = 10,
Expand All @@ -41,6 +43,7 @@ object WebDavModule {
.setNetworkTimeout(15L)
.addInterceptor(webDavAuthNetworkInterceptor)
.addInterceptor(HttpLoggingInterceptor.createInterceptor(Level.BODY))
.addInterceptor(clientInfoNetworkInterceptor)
.build()
}

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/BuildConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object BuildConfig {
const val compileSdkVersion = 34
const val targetSdk = 34

val versionCode = 91 // Must be updated on every build
val versionCode = 92 // Must be updated on every build
val version = Version(
major = 1,
minor = 0,
Expand Down

0 comments on commit c437c82

Please sign in to comment.