Loading app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -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" implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.fragment:fragment-ktx:1.5.6' Loading Loading @@ -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" Loading app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt +13 −0 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -60,8 +63,14 @@ 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 INITIAL_RESPONSE_CODE = 100 } private val _responseCode = MutableStateFlow(INITIAL_RESPONSE_CODE) override val responseCode: StateFlow<Int> get() = _responseCode.asStateFlow() @VisibleForTesting var okHttpClient = OkHttpClient().newBuilder() .retryOnConnectionFailure(false) Loading Loading @@ -161,6 +170,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) Loading Loading @@ -225,6 +236,8 @@ class GPlayHttpClient @Inject constructor( if (!isSuccessful) { errorString = response.message } _responseCode.value = response.code } } } Loading Loading
app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -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" implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.fragment:fragment-ktx:1.5.6' Loading Loading @@ -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" Loading
app/src/main/java/foundation/e/apps/data/playstore/utils/GPlayHttpClient.kt +13 −0 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -60,8 +63,14 @@ 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 INITIAL_RESPONSE_CODE = 100 } private val _responseCode = MutableStateFlow(INITIAL_RESPONSE_CODE) override val responseCode: StateFlow<Int> get() = _responseCode.asStateFlow() @VisibleForTesting var okHttpClient = OkHttpClient().newBuilder() .retryOnConnectionFailure(false) Loading Loading @@ -161,6 +170,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) Loading Loading @@ -225,6 +236,8 @@ class GPlayHttpClient @Inject constructor( if (!isSuccessful) { errorString = response.message } _responseCode.value = response.code } } } Loading