From e2cf86b444fd70c3b1165dc4ac22bd0541cec0e7 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Mon, 12 Feb 2024 20:14:51 +0530 Subject: [PATCH 1/4] changes for gplay lib update --- app/build.gradle | 4 ++-- .../e/apps/data/playstore/utils/GPlayHttpClient.kt | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 72dada80f..0f14d1859 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -153,7 +153,7 @@ dependencies { api files('libs/splitinstall-lib.jar') implementation 'foundation.e.lib:telemetry:0.0.11-alpha' - implementation 'foundation.e:gplayapi:3.0.1-2' + implementation "foundation.e:gplayapi:3.2.10-1-test" implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.fragment:fragment-ktx:1.5.6' @@ -186,7 +186,7 @@ dependencies { //Protobuf and Gson implementation 'com.google.code.gson:gson:2.9.0' - implementation "com.google.protobuf:protobuf-java:3.17.2" + implementation "com.google.protobuf:protobuf-javalite:3.25.2" // ViewPager2 and RecyclerView implementation "androidx.viewpager2:viewpager2:1.0.0" diff --git a/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt b/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt index a7e1f3dbb..afb5a0052 100644 --- a/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt +++ b/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt @@ -43,6 +43,9 @@ import java.io.IOException import java.net.SocketTimeoutException import java.util.concurrent.TimeUnit import javax.inject.Inject +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow class GPlayHttpClient @Inject constructor( private val cache: Cache, @@ -62,6 +65,10 @@ class GPlayHttpClient @Inject constructor( const val STATUS_CODE_TIMEOUT = 408 } + private val _responseCode = MutableStateFlow(100) + override val responseCode: StateFlow + get() = _responseCode.asStateFlow() + @VisibleForTesting var okHttpClient = OkHttpClient().newBuilder() .retryOnConnectionFailure(false) @@ -161,6 +168,8 @@ class GPlayHttpClient @Inject constructor( } private fun processRequest(request: Request): PlayResponse { + // Reset response code as flow doesn't sends the same value twice + _responseCode.value = 0 var response: Response? = null return try { val call = okHttpClient.newCall(request) @@ -225,6 +234,8 @@ class GPlayHttpClient @Inject constructor( if (!isSuccessful) { errorString = response.message } + + _responseCode.value = response.code } } } -- GitLab From 044aaf338dbe177a807dddac61d9a05eb2c0a3cb Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Wed, 28 Feb 2024 15:56:22 +0530 Subject: [PATCH 2/4] drop test for gplaylib --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 0f14d1859..836e600a5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -153,7 +153,7 @@ dependencies { api files('libs/splitinstall-lib.jar') implementation 'foundation.e.lib:telemetry:0.0.11-alpha' - implementation "foundation.e:gplayapi:3.2.10-1-test" + implementation "foundation.e:gplayapi:3.2.10-1" implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.fragment:fragment-ktx:1.5.6' -- GitLab From 93ed184092516d5cb355569a7ea60f8fde0a75ab Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Thu, 29 Feb 2024 16:48:51 +0530 Subject: [PATCH 3/4] initialResponseCode --- .../foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt b/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt index afb5a0052..f9533db92 100644 --- a/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt +++ b/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt @@ -63,9 +63,11 @@ class GPlayHttpClient @Inject constructor( const val STATUS_CODE_TOO_MANY_REQUESTS = 429 private const val URL_SUBSTRING_PURCHASE = "purchase" const val STATUS_CODE_TIMEOUT = 408 + private const val initialResponseCode = 100 } - private val _responseCode = MutableStateFlow(100) + + private val _responseCode = MutableStateFlow(initialResponseCode) override val responseCode: StateFlow get() = _responseCode.asStateFlow() -- GitLab From 3aa34850572c566fdd70679ab34f6e58e54f5866 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Thu, 29 Feb 2024 18:35:53 +0530 Subject: [PATCH 4/4] INITIAL_RESPONSE_CODE --- .../foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt b/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt index f9533db92..f9e55e610 100644 --- a/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt +++ b/app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt @@ -63,11 +63,11 @@ class GPlayHttpClient @Inject constructor( const val STATUS_CODE_TOO_MANY_REQUESTS = 429 private const val URL_SUBSTRING_PURCHASE = "purchase" const val STATUS_CODE_TIMEOUT = 408 - private const val initialResponseCode = 100 + private const val INITIAL_RESPONSE_CODE = 100 } - private val _responseCode = MutableStateFlow(initialResponseCode) + private val _responseCode = MutableStateFlow(INITIAL_RESPONSE_CODE) override val responseCode: StateFlow get() = _responseCode.asStateFlow() -- GitLab