diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8a8d581d..540cad27 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -83,35 +83,37 @@ android { dependencies { - implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.activity:activity-compose:1.8.2") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0") - implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0") + implementation("androidx.compose.material3:material3:1.2.1") implementation("androidx.compose.ui:ui:1.6.4") + implementation("androidx.core:core-ktx:1.12.0") + implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0") + implementation("androidx.navigation:navigation-compose:2.7.7") + implementation("androidx.navigation:navigation-runtime-ktx:2.7.7") implementation("androidx.tv:tv-foundation:1.0.0-alpha10") - implementation("androidx.compose.material3:material3:1.2.1") implementation("androidx.work:work-runtime-ktx:2.9.0") - implementation("io.insert-koin:koin-android:3.4.2") - implementation("io.insert-koin:koin-androidx-compose:3.4.2") - implementation("com.squareup.retrofit2:retrofit:2.10.0") - implementation("com.squareup.retrofit2:converter-gson:2.10.0") - implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") - implementation("com.google.code.gson:gson:2.10.1") - implementation("io.coil-kt:coil-compose:2.4.0") - implementation("com.github.rumboalla.KryptoPrefs:kryptoprefs:0.4.3") implementation("com.github.rumboalla.KryptoPrefs:kryptoprefs-gson:0.4.3") - implementation("org.jsoup:jsoup:1.16.1") + implementation("com.github.rumboalla.KryptoPrefs:kryptoprefs:0.4.3") implementation("com.github.topjohnwu.libsu:core:5.2.1") - implementation("io.github.g00fy2:versioncompare:1.5.0") implementation("com.gitlab.AuroraOSS:gplayapi:3.2.10") + implementation("com.google.code.gson:gson:2.10.1") + implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") + implementation("com.squareup.retrofit2:converter-gson:2.11.0") + implementation("com.squareup.retrofit2:retrofit:2.11.0") + implementation("io.coil-kt:coil-compose:2.6.0") + implementation("io.github.g00fy2:versioncompare:1.5.0") + implementation("io.insert-koin:koin-android:3.5.3") + implementation("io.insert-koin:koin-androidx-compose:3.5.3") + implementation("org.jsoup:jsoup:1.16.1") testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.5") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.6.4") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + androidTestImplementation("androidx.test.ext:junit:1.1.5") - debugImplementation("androidx.compose.ui:ui-tooling:1.6.4") debugImplementation("androidx.compose.ui:ui-test-manifest:1.6.4") + debugImplementation("androidx.compose.ui:ui-tooling:1.6.4") } diff --git a/app/src/main/kotlin/com/apkupdater/di/MainModule.kt b/app/src/main/kotlin/com/apkupdater/di/MainModule.kt index 4f075f00..0fd89090 100644 --- a/app/src/main/kotlin/com/apkupdater/di/MainModule.kt +++ b/app/src/main/kotlin/com/apkupdater/di/MainModule.kt @@ -182,7 +182,7 @@ val mainModule = module { single { InstallLog() } - single { PlayHttpClient() } + single { PlayHttpClient(get()) } viewModel { MainViewModel(get(), get()) } diff --git a/app/src/main/kotlin/com/apkupdater/util/play/PlayHttpClient.kt b/app/src/main/kotlin/com/apkupdater/util/play/PlayHttpClient.kt index 515ec598..b21ee37a 100644 --- a/app/src/main/kotlin/com/apkupdater/util/play/PlayHttpClient.kt +++ b/app/src/main/kotlin/com/apkupdater/util/play/PlayHttpClient.kt @@ -5,6 +5,7 @@ import com.aurora.gplayapi.data.models.PlayResponse import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import okhttp3.Cache import okhttp3.Credentials import okhttp3.Headers.Companion.toHeaders import okhttp3.HttpUrl @@ -21,7 +22,9 @@ import java.net.Proxy import java.util.concurrent.TimeUnit -class PlayHttpClient : IProxyHttpClient { +class PlayHttpClient( + cache: Cache +) : IProxyHttpClient { companion object { private const val POST = "POST" @@ -30,7 +33,6 @@ class PlayHttpClient : IProxyHttpClient { private val _responseCode = MutableStateFlow(100) override val responseCode: StateFlow get() = _responseCode.asStateFlow() - private var okHttpClient = OkHttpClient() private val okHttpClientBuilder = OkHttpClient().newBuilder() .connectTimeout(25, TimeUnit.SECONDS) .readTimeout(25, TimeUnit.SECONDS) @@ -38,6 +40,8 @@ class PlayHttpClient : IProxyHttpClient { .retryOnConnectionFailure(true) .followRedirects(true) .followSslRedirects(true) + .cache(cache) + private var okHttpClient = okHttpClientBuilder.build() override fun setProxy(proxyInfo: ProxyInfo): PlayHttpClient { val proxy = Proxy( @@ -62,8 +66,7 @@ class PlayHttpClient : IProxyHttpClient { } } - okHttpClientBuilder.proxy(proxy) - okHttpClient = okHttpClientBuilder.build() + okHttpClient = okHttpClientBuilder.proxy(proxy).build() return this }