diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml index 37add149..86c8c4cb 100644 --- a/config/detekt/baseline.xml +++ b/config/detekt/baseline.xml @@ -13,10 +13,7 @@ EmptyFunctionBlock:QIdentityManagerTest.kt$QIdentityManagerTest.Identify.<no name provided>${} EmptyFunctionBlock:QProductCenterManager.kt$QProductCenterManager.<no name provided>${} EmptyFunctionBlock:QonversionInternal.kt$QonversionInternal.<no name provided>${} - Filename:com.qonversion.android.sdk.internal.converter.util.kt:1 - Filename:com.qonversion.android.sdk.internal.requests.queue.util.kt:1 Filename:com.qonversion.android.sdk.internal.storage.util.kt:1 - Filename:com.qonversion.android.sdk.internal.validator.util.kt:1 FinalNewline:com.qonversion.android.sdk.automations.internal.AutomationsEventMapperTest.kt:1 FinalNewline:com.qonversion.android.sdk.automations.internal.QAutomationsManagerTest.kt:1 FinalNewline:com.qonversion.android.sdk.automations.mvp.ScreenPresenterTest.kt:1 @@ -26,34 +23,20 @@ FinalNewline:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.QUserPropertiesManagerTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.api.ApiHelperTest.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.billing.mockUtils.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.converter.SkuDetailsTokenExtractorTest.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.converter.util.kt:1 FinalNewline:com.qonversion.android.sdk.internal.requests.AppRequestTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.requests.AttributionRequestTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.requests.EnvironmentRequestTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.requests.InitRequestTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.requests.OsRequestTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.requests.ProviderDataRequestTest.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.requests.queue.RequestQueueTest.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.requests.queue.util.kt:1 FinalNewline:com.qonversion.android.sdk.internal.services.QUserInfoServiceTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.storage.TokenExtractorTest.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.storage.TokenStorageTest.kt:1 FinalNewline:com.qonversion.android.sdk.internal.storage.util.kt:1 - FinalNewline:com.qonversion.android.sdk.internal.validator.util.kt:1 FinalNewline:com.qonversion.android.sdk.utils.kt:1 ForbiddenComment:AttributionRequestTest.kt$AttributionRequestTest$// TODO: Update test for new AttributionRequest format ForbiddenComment:EnvironmentRequestTest.kt$EnvironmentRequestTest$// TODO: Update test for new Environment format ForbiddenComment:InitRequestTest.kt$InitRequestTest$// TODO: Update test for new InitRequest format - ForbiddenComment:RequestQueueTest.kt$RequestQueueTest$// TODO: Update test for new AttributionRequest format - ForbiddenComment:RequestValidatorTest.kt$RequestValidatorTest$// TODO: Update test for new AttributionRequest format - ForbiddenComment:util.kt$Util.Companion$// TODO: Update test for new AttributionRequest format LargeClass:QProductCenterManager.kt$QProductCenterManager : PurchasesListenerUserStateProvider - LongMethod:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.Purchase$@Test fun `purchase with oldSkuDetails billing flow params is correct`() LongParameterList:ManagersModule.kt$ManagersModule$( appContext: Application, repository: QRepository, propertiesStorage: UserPropertiesStorage, incrementalDelayCalculator: IncrementalDelayCalculator, appStateProvider: AppStateProvider, logger: Logger ) LongParameterList:ManagersModule.kt$ManagersModule$( repository: QRepository, preferences: SharedPreferences, eventMapper: AutomationsEventMapper, appContext: Application, activityProvider: ActivityProvider, appStateProvider: AppStateProvider ) LongParameterList:QonversionBillingService.kt$QonversionBillingService$( private val mainHandler: Handler, private val purchasesListener: PurchasesListener, private val logger: Logger, private val isAnalyticsMode: Boolean, private val billingClientHolder: BillingClientHolder, private val legacyBillingClientWrapper: LegacyBillingClientWrapper, private val actualBillingClientWrapper: ActualBillingClientWrapper ) @@ -138,7 +121,7 @@ MaxLineLength:OutagerIntegrationTest.kt$OutagerIntegrationTest$purchaseToken = "lgeigljfpmeoddkcebkcepjc.AO-J1Oy305qZj99jXTPEVBN8UZGoYAtjDLj4uTjRQvUFaG0vie-nr6VBlN0qnNDMU8eJR-sI7o3CwQyMOEHKl8eJsoQ86KSFzxKBR07PSpHLI_o7agXhNKY" MaxLineLength:OutagerIntegrationTest.kt$OutagerIntegrationTest$val token = "dt70kovLQdKymNnhIY6I94:APA91bGfg6m108VFio2ZdgLR6U0B2PtqAn0hIPVU7M4jKklkMxqDUrjoThpX_K60M7CfH8IVZqtku31ei2hmjdJZDfm-bdAl7uxLDWFU8yVcA6-3wBMn3nsYmUrhYWom-qgGC7yIUYzR" MaxLineLength:OutagerIntegrationTest.kt$OutagerIntegrationTest.<no name provided>$assertEquals(error.additionalMessage, """HTTP status code=503, data={"message":"Service Unavailable","code":0,"status":503}. """) - MaxLineLength:PurchasesCacheTest.kt$PurchasesCacheTest$"\"purchaseToken\":\"gfegjilekkmecbonpfjiaakm.AO-J1OxQCaAn0NPlHTh5CoOiXK0p19X7qEymW9SHtssrggp7S9YafjA1oPBPlWO4Ur3W5rtyNJBzIrVoLOb5In0Jxofv4xV_7t1HaUYYd_f8xOBk7nRIY7g\"," + MaxLineLength:PurchasesCacheTest.kt$PurchasesCacheTest$"\"purchaseToken\":\"gfegjilekkmecbonpfjiaakm.AO-J1OxQCaAn0NPlHTh5CoOiXK0p19X7qEymW9SHtssrggp7S9YafjA1oPBPlWO4Ur3W5rtyNJBzIrVoLOb5In0Jxofv4xV_7t1HaUYYd_f8xOBk7nRIY7g\"}" MaxLineLength:PurchasesCacheTest.kt$PurchasesCacheTest$private val fourPurchasesStr = "[${generatePurchaseJson()},${generatePurchaseJson("2")},${generatePurchaseJson("3")},${generatePurchaseJson("4")}]" MaxLineLength:PurchasesCacheTest.kt$PurchasesCacheTest$purchaseToken = "gfegjilekkmecbonpfjiaakm.AO-J1OxQCaAn0NPlHTh5CoOiXK0p19X7qEymW9SHtssrggp7S9YafjA1oPBPlWO4Ur3W5rtyNJBzIrVoLOb5In0Jxofv4xV_7t1HaUYYd_f8xOBk7nRIY7g" MaxLineLength:PurchasesCacheTest.kt$PurchasesCacheTest.SavePurchase$"[${generatePurchaseJson("2")},${generatePurchaseJson("3")},${generatePurchaseJson("4")},${generatePurchaseJson("5")}]" @@ -149,17 +132,9 @@ MaxLineLength:QProductCenterManagerTest.kt$QProductCenterManagerTest${ Assert.assertEquals("Wrong purchaseToken value", purchaseToken, entityPurchaseSlot.captured.purchaseToken) } MaxLineLength:QUserPropertiesManagerTest.kt$QUserPropertiesManagerTest$fun MaxLineLength:Qonversion.kt$Qonversion$* - MaxLineLength:QonversionBillingService.kt$QonversionBillingService$"replaceOldPurchase() -> Purchase was found successfully for store product: ${purchaseHistoryRecord.productId}" - MaxLineLength:QonversionBillingService.kt$QonversionBillingService$actualBillingClientWrapper + MaxLineLength:QonversionBillingService.kt$QonversionBillingService$"updatePurchase() -> Purchase was found successfully for store product: ${purchaseHistoryRecord.productId}" MaxLineLength:QonversionBillingService.kt$QonversionBillingService$logger.debug("queryPurchaseHistoryAsync() -> purchase history for $productType is retrieved ${record.getDescription()}") - MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.GetSkuDetailsFromPurchases$assertThat(billingError!!.billingResponseCode).isEqualTo(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE) - MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.GetSkuDetailsFromPurchases$billingClientStateListener.onBillingSetupFinished(buildResult(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE)) - MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.LoadProducts$assertThat(billingError!!.billingResponseCode).isEqualTo(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE) - MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.LoadProducts$billingClientStateListener.onBillingSetupFinished(buildResult(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE)) - MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.QueryPurchases$assertThat(billingError!!.billingResponseCode).isEqualTo(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE) - MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.QueryPurchases$billingClientStateListener.onBillingSetupFinished(buildResult(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE)) - MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.QueryPurchasesHistory$assertThat(billingError!!.billingResponseCode).isEqualTo(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE) - MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.QueryPurchasesHistory$billingClientStateListener.onBillingSetupFinished(buildResult(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE)) + MaxLineLength:QonversionBillingService.kt$QonversionBillingService${ error -> logger.release("Failed to fetch product type for purchase $productId - " + error.message) } MaxLineLength:QonversionConfig.kt$QonversionConfig.Builder$* MaxLineLength:QonversionError.kt$QonversionErrorCode$* MaxLineLength:QonversionRepositoryIntegrationTest.kt$QonversionRepositoryIntegrationTest$"""HTTP status code=400, data={"message":"Invalid access token received","code":10003,"status":400,"extra":[]}. """ @@ -173,10 +148,9 @@ MaxLineLength:SharedPreferencesCacheTest.kt$SharedPreferencesCacheTest.Object${ Assert.assertEquals("Wrong offering products value", expectedValue.offerings?.main?.products, realValue?.offerings?.main?.products) } MaxLineLength:SharedPreferencesCacheTest.kt$SharedPreferencesCacheTest.Object${ Assert.assertEquals("Wrong offeringID value", expectedValue.offerings?.main?.offeringID, realValue?.offerings?.main?.offeringID) } MaxLineLength:SharedPreferencesCacheTest.kt$SharedPreferencesCacheTest.Object${ Assert.assertEquals("Wrong userProducts value", expectedValue.userProducts, realValue?.userProducts) } - MaxLineLength:TokenExtractorTest.kt$TokenExtractorTest$private lateinit var tokenExtractor: Extractor<Response<BaseResponse<com.qonversion.android.sdk.internal.dto.Response>>> MaxLineLength:errors.kt$"Please make sure that you are using the google account where purchases are allowed and the application was correctly signed and properly set up for billing." - MaxLineLength:util.kt$Util.Companion$"\"offerings\":[{\"id\":\"main\",\"tag\":1,\"products\":[{\"id\":\"in_app\",\"store_id\":\"qonversion_inapp_consumable\",\"type\":2},{\"id\":\"main\",\"store_id\":\"qonversion_subs_weekly\",\"type\":0,\"duration\":0}],\"experiment\":{\"uid\":\"secondary\",\"attached\":false}" - MaxLineLength:util.kt$Util.Companion$"\"permissions\":[{\"id\":\"standart\",\"associated_product\":\"in_app\",\"renew_state\":-1,\"started_timestamp\":1612880300,\"source\":\"playstore\",\"active\":1},{\"id\":\"Test Permission\",\"associated_product\":\"in_app\",\"renew_state\":-1,\"started_timestamp\":1612880300,\"source\":\"appstore\",\"active\":1}],\"user_products\":[{\"id\":\"in_app\",\"store_id\":\"qonversion_inapp_consumable\",\"type\":2}],\"experiments\":[]," + MaxLineLength:util.kt$Util.Companion$"\"offerings\":[{\"id\":\"main\",\"tag\":1,\"products\":[{\"id\":\"in_app\",\"store_id\":\"qonversion_inapp_consumable\",\"type\":2},{\"id\":\"main\",\"store_id\":\"qonversion_subs_weekly\",\"type\":0,\"duration\":0}]" + MaxLineLength:util.kt$Util.Companion$"\"permissions\":[{\"id\":\"standart\",\"associated_product\":\"in_app\",\"renew_state\":-1,\"started_timestamp\":1612880300,\"source\":\"playstore\",\"active\":1},{\"id\":\"Test Permission\",\"associated_product\":\"in_app\",\"renew_state\":-1,\"started_timestamp\":1612880300,\"source\":\"appstore\",\"active\":1}],\"user_products\":[{\"id\":\"in_app\",\"store_id\":\"qonversion_inapp_consumable\",\"type\":2}]," MaxLineLength:utils.kt$"ProductId: ${this.productId}; PurchaseTime: ${this.purchaseTime.convertLongToTime()}; PurchaseToken: ${this.purchaseToken}" MaximumLineLength:com.qonversion.android.sdk.automations.internal.AutomationsEventMapperTest.kt:105 MaximumLineLength:com.qonversion.android.sdk.automations.internal.AutomationsEventMapperTest.kt:106 @@ -196,8 +170,8 @@ MaximumLineLength:com.qonversion.android.sdk.internal.OutagerIntegrationTest.kt:382 MaximumLineLength:com.qonversion.android.sdk.internal.OutagerIntegrationTest.kt:441 MaximumLineLength:com.qonversion.android.sdk.internal.OutagerIntegrationTest.kt:89 - MaximumLineLength:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:160 - MaximumLineLength:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:162 + MaximumLineLength:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:147 + MaximumLineLength:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:148 MaximumLineLength:com.qonversion.android.sdk.internal.QUserPropertiesManagerTest.kt:175 MaximumLineLength:com.qonversion.android.sdk.internal.QonversionRepositoryIntegrationTest.kt:116 MaximumLineLength:com.qonversion.android.sdk.internal.QonversionRepositoryIntegrationTest.kt:324 @@ -208,28 +182,19 @@ MaximumLineLength:com.qonversion.android.sdk.internal.api.ApiErrorMapper.kt:117 MaximumLineLength:com.qonversion.android.sdk.internal.api.ApiErrorMapper.kt:118 MaximumLineLength:com.qonversion.android.sdk.internal.billing.BillingClientWrapperBase.kt:59 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingService.kt:245 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingService.kt:325 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingService.kt:362 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:178 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:181 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:319 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:322 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:543 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:546 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:715 - MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:718 + MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingService.kt:137 + MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingService.kt:246 + MaximumLineLength:com.qonversion.android.sdk.internal.billing.QonversionBillingService.kt:361 MaximumLineLength:com.qonversion.android.sdk.internal.billing.utils.kt:22 MaximumLineLength:com.qonversion.android.sdk.internal.errors.kt:33 - MaximumLineLength:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:199 + MaximumLineLength:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:165 + MaximumLineLength:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:187 MaximumLineLength:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:21 - MaximumLineLength:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:245 - MaximumLineLength:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:82 + MaximumLineLength:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:72 + MaximumLineLength:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:219 + MaximumLineLength:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:220 + MaximumLineLength:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:221 MaximumLineLength:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:222 - MaximumLineLength:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:223 - MaximumLineLength:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:224 - MaximumLineLength:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:225 - MaximumLineLength:com.qonversion.android.sdk.internal.storage.TokenExtractorTest.kt:19 MaximumLineLength:com.qonversion.android.sdk.internal.storage.util.kt:142 MaximumLineLength:com.qonversion.android.sdk.internal.storage.util.kt:143 NestedBlockDepth:ApiErrorMapper.kt$ApiErrorMapper$fun <T> getErrorFromResponse(value: Response<T>): QonversionError @@ -238,7 +203,6 @@ NewLineAtEndOfFile:AttributionRequestTest.kt$com.qonversion.android.sdk.internal.requests.AttributionRequestTest.kt NewLineAtEndOfFile:AutomationsEventMapperTest.kt$com.qonversion.android.sdk.automations.internal.AutomationsEventMapperTest.kt NewLineAtEndOfFile:EnvironmentRequestTest.kt$com.qonversion.android.sdk.internal.requests.EnvironmentRequestTest.kt - NewLineAtEndOfFile:GooglePurchaseConverterTest.kt$com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt NewLineAtEndOfFile:IncrementalDelayCalculatorTest.kt$com.qonversion.android.sdk.internal.IncrementalDelayCalculatorTest.kt NewLineAtEndOfFile:InitRequestTest.kt$com.qonversion.android.sdk.internal.requests.InitRequestTest.kt NewLineAtEndOfFile:InternalConfigTest.kt$com.qonversion.android.sdk.internal.InternalConfigTest.kt @@ -250,29 +214,16 @@ NewLineAtEndOfFile:QProductCenterManagerTest.kt$com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt NewLineAtEndOfFile:QUserInfoServiceTest.kt$com.qonversion.android.sdk.internal.services.QUserInfoServiceTest.kt NewLineAtEndOfFile:QUserPropertiesManagerTest.kt$com.qonversion.android.sdk.internal.QUserPropertiesManagerTest.kt - NewLineAtEndOfFile:QonversionBillingServiceTest.kt$com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt - NewLineAtEndOfFile:RequestQueueTest.kt$com.qonversion.android.sdk.internal.requests.queue.RequestQueueTest.kt NewLineAtEndOfFile:ScreenPresenterTest.kt$com.qonversion.android.sdk.automations.mvp.ScreenPresenterTest.kt - NewLineAtEndOfFile:SkuDetailsTokenExtractorTest.kt$com.qonversion.android.sdk.internal.converter.SkuDetailsTokenExtractorTest.kt - NewLineAtEndOfFile:TokenExtractorTest.kt$com.qonversion.android.sdk.internal.storage.TokenExtractorTest.kt - NewLineAtEndOfFile:TokenStorageTest.kt$com.qonversion.android.sdk.internal.storage.TokenStorageTest.kt - NewLineAtEndOfFile:mockUtils.kt$com.qonversion.android.sdk.internal.billing.mockUtils.kt - NewLineAtEndOfFile:util.kt$com.qonversion.android.sdk.internal.converter.util.kt - NewLineAtEndOfFile:util.kt$com.qonversion.android.sdk.internal.requests.queue.util.kt NewLineAtEndOfFile:util.kt$com.qonversion.android.sdk.internal.storage.util.kt - NewLineAtEndOfFile:util.kt$com.qonversion.android.sdk.internal.validator.util.kt NewLineAtEndOfFile:utils.kt$com.qonversion.android.sdk.utils.kt NoBlankLineBeforeRbrace:com.qonversion.android.sdk.automations.internal.QAutomationsManagerTest.kt:270 - NoBlankLineBeforeRbrace:com.qonversion.android.sdk.internal.converter.util.kt:55 - NoBlankLineBeforeRbrace:com.qonversion.android.sdk.internal.validator.RequestValidatorTest.kt:17 NoBlankLineBeforeRbrace:com.qonversion.android.sdk.internal.validator.TokenValidatorTest.kt:20 NoConsecutiveBlankLines:com.qonversion.android.sdk.QonversionConfigTest.kt:118 NoConsecutiveBlankLines:com.qonversion.android.sdk.automations.internal.QAutomationsManagerTest.kt:396 NoConsecutiveBlankLines:com.qonversion.android.sdk.internal.QAttributionManagerTest.kt:141 NoConsecutiveBlankLines:com.qonversion.android.sdk.internal.requests.ProviderDataRequestTest.kt:18 - NoConsecutiveBlankLines:com.qonversion.android.sdk.internal.storage.TokenStorageTest.kt:124 - NoConsecutiveBlankLines:com.qonversion.android.sdk.internal.storage.TokenStorageTest.kt:63 - NoConsecutiveBlankLines:com.qonversion.android.sdk.internal.validator.RequestValidatorTest.kt:3 + NoUnusedImports:com.qonversion.android.sdk.internal.storage.PurchasesCacheTest.kt:5 NoWildcardImports:com.qonversion.android.sdk.automations.internal.AutomationsEventMapperTest.kt:12 NoWildcardImports:com.qonversion.android.sdk.automations.internal.AutomationsEventMapperTest.kt:6 NoWildcardImports:com.qonversion.android.sdk.automations.internal.QAutomationsManagerTest.kt:23 @@ -288,18 +239,13 @@ NoWildcardImports:com.qonversion.android.sdk.internal.QHandledPurchasesCacheTest.kt:4 NoWildcardImports:com.qonversion.android.sdk.internal.QIdentityManagerTest.kt:7 NoWildcardImports:com.qonversion.android.sdk.internal.QIdentityManagerTest.kt:9 - NoWildcardImports:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:22 - NoWildcardImports:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:30 + NoWildcardImports:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:21 + NoWildcardImports:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:29 NoWildcardImports:com.qonversion.android.sdk.internal.QProductCenterManagerTest.kt:9 NoWildcardImports:com.qonversion.android.sdk.internal.QUserPropertiesManagerTest.kt:18 NoWildcardImports:com.qonversion.android.sdk.internal.QUserPropertiesManagerTest.kt:19 NoWildcardImports:com.qonversion.android.sdk.internal.billing.LegacyBillingClientWrapper.kt:4 NoWildcardImports:com.qonversion.android.sdk.internal.billing.QonversionBillingService.kt:5 - NoWildcardImports:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:5 - NoWildcardImports:com.qonversion.android.sdk.internal.billing.QonversionBillingServiceTest.kt:8 - NoWildcardImports:com.qonversion.android.sdk.internal.billing.mockUtils.kt:4 - NoWildcardImports:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:4 - NoWildcardImports:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:7 NoWildcardImports:com.qonversion.android.sdk.internal.services.QUserInfoServiceTest.kt:11 NoWildcardImports:com.qonversion.android.sdk.internal.services.QUserInfoServiceTest.kt:5 NoWildcardImports:com.qonversion.android.sdk.internal.storage.LaunchResultCacheWrapperTest.kt:7 @@ -313,22 +259,14 @@ ReturnCount:QExceptionManager.kt$QExceptionManager$private fun getContentOfCrashReport(filename: String): CrashRequest.ExceptionInfo? ReturnCount:QProductCenterManager.kt$QProductCenterManager$@Synchronized private fun executeProductsBlocks(loadStoreProductsError: QonversionError? = null) ReturnCount:ScreenPresenter.kt$ScreenPresenter$override fun shouldOverrideUrlLoading(url: String?): Boolean - ReturnCount:SkuDetailsTokenExtractor.kt$SkuDetailsTokenExtractor$override fun extract(response: String?): String SpacingAroundColon:com.qonversion.android.sdk.internal.requests.ProviderDataRequestTest.kt:45 - SpacingAroundComma:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:146 SpacingAroundCurly:com.qonversion.android.sdk.automations.internal.QAutomationsManagerTest.kt:263 SpacingAroundCurly:com.qonversion.android.sdk.internal.QAttributionManagerTest.kt:39 SpacingAroundCurly:com.qonversion.android.sdk.internal.QAttributionManagerTest.kt:54 - SpacingAroundCurly:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:139 - SpacingAroundCurly:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:145 - SpacingAroundCurly:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:297 - SpacingAroundCurly:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:303 SpacingAroundParens:com.qonversion.android.sdk.internal.QUserPropertiesManagerTest.kt:497 - SpacingAroundParens:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:207 - SpacingAroundParens:com.qonversion.android.sdk.internal.converter.GooglePurchaseConverterTest.kt:308 - SpacingAroundParens:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:212 - SpacingAroundParens:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:241 - SpacingAroundParens:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:260 + SpacingAroundParens:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:209 + SpacingAroundParens:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:238 + SpacingAroundParens:com.qonversion.android.sdk.internal.storage.SharedPreferencesCacheTest.kt:257 SpacingAroundParens:com.qonversion.android.sdk.utils.kt:66 StringTemplate:com.qonversion.android.sdk.utils.kt:50 SwallowedException:ApiErrorMapper.kt$ApiErrorMapper$catch (e: JSONException) { errorMessage = "$ERROR=failed to parse the backend response" } diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/ActualBillingClientWrapper.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/ActualBillingClientWrapper.kt index f8ee9610..621f6a65 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/ActualBillingClientWrapper.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/ActualBillingClientWrapper.kt @@ -14,23 +14,23 @@ import com.android.billingclient.api.QueryPurchasesParams import com.qonversion.android.sdk.dto.products.QProduct import com.qonversion.android.sdk.dto.products.QProductOfferDetails import com.qonversion.android.sdk.internal.dto.QStoreProductType -import com.qonversion.android.sdk.internal.dto.SubscriptionStoreId +import com.qonversion.android.sdk.internal.dto.ProductStoreId import com.qonversion.android.sdk.internal.logger.Logger internal class ActualBillingClientWrapper( billingClientHolder: BillingClientHolder, logger: Logger ) : BillingClientWrapperBase(billingClientHolder, logger), - BillingClientWrapper { + BillingClientWrapper { private var productDetails = mapOf() override fun withStoreDataLoaded( - storeIds: List, + storeIds: List, onFailed: (error: BillingError) -> Unit, onReady: () -> Unit ) { - val productIds = storeIds.map { it.subscriptionId } + val productIds = storeIds.map { it.productId } val idsToLoad = productIds.filterNot { productDetails.containsKey(it) } if (idsToLoad.isEmpty()) { @@ -46,8 +46,8 @@ internal class ActualBillingClientWrapper( } } - override fun getStoreData(storeId: SubscriptionStoreId): ProductDetails? { - return productDetails[storeId.subscriptionId] + override fun getStoreData(storeId: ProductStoreId): ProductDetails? { + return productDetails[storeId.productId] } override fun makePurchase( @@ -57,7 +57,15 @@ internal class ActualBillingClientWrapper( updatePurchaseInfo: UpdatePurchaseInfo?, onFailed: (error: BillingError) -> Unit ) { - val storeDetails = product.storeDetails ?: return + val storeDetails = product.storeDetails ?: run { + onFailed( + BillingError( + BillingResponseCode.ITEM_UNAVAILABLE, + "Store details not found for purchase" + ) + ) + return + } logger.debug("makePurchase() -> Purchasing the product: ${storeDetails.productId}") @@ -176,13 +184,13 @@ internal class ActualBillingClientWrapper( onSuccess: (type: QStoreProductType) -> Unit ) { productDetails[storeId]?.let { - onSuccess(QStoreProductType.fromSkuType(it.productType)) + onSuccess(QStoreProductType.fromProductType(it.productType)) return } loadProducts(listOf(storeId), onFailed) { details -> details.firstOrNull()?.takeIf { it.productId == storeId }?.let { - onSuccess(QStoreProductType.fromSkuType(it.productType)) + onSuccess(QStoreProductType.fromProductType(it.productType)) } ?: onFailed( BillingError( BillingResponseCode.ITEM_UNAVAILABLE, diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/QonversionBillingService.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/QonversionBillingService.kt index 3072f188..c9c9574d 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/QonversionBillingService.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/QonversionBillingService.kt @@ -6,7 +6,7 @@ import com.android.billingclient.api.* import com.qonversion.android.sdk.dto.QPurchaseUpdatePolicy import com.qonversion.android.sdk.dto.products.QProduct import com.qonversion.android.sdk.internal.dto.QStoreProductType -import com.qonversion.android.sdk.internal.dto.SubscriptionStoreId +import com.qonversion.android.sdk.internal.dto.ProductStoreId import com.qonversion.android.sdk.internal.purchase.PurchaseHistory import com.qonversion.android.sdk.internal.logger.Logger import java.util.concurrent.ConcurrentLinkedQueue @@ -48,7 +48,7 @@ internal class QonversionBillingService internal constructor( fun fetchProductDetails() { // Fetching ProductDetails val actualStoreIds = products.filter { it.storeID != null } - .map { SubscriptionStoreId( + .map { ProductStoreId( it.storeID!!, it.basePlanID ) } @@ -85,11 +85,11 @@ internal class QonversionBillingService internal constructor( @Suppress("DEPRECATION") product.skuDetail = legacyBillingClientWrapper.getStoreData(storeId) - val subscriptionStoreId = SubscriptionStoreId( + val productStoreId = ProductStoreId( storeId, product.basePlanID ) - actualBillingClientWrapper.getStoreData(subscriptionStoreId)?.let { storeData -> + actualBillingClientWrapper.getStoreData(productStoreId)?.let { storeData -> product.setStoreProductDetails(storeData) } } @@ -144,7 +144,8 @@ internal class QonversionBillingService internal constructor( if (!purchase.isAcknowledged) { acknowledge(purchase.purchaseToken) } - }} + } + } } } } diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/dto/SubscriptionStoreId.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/dto/ProductStoreId.kt similarity index 65% rename from sdk/src/main/java/com/qonversion/android/sdk/internal/dto/SubscriptionStoreId.kt rename to sdk/src/main/java/com/qonversion/android/sdk/internal/dto/ProductStoreId.kt index 07517200..69a8fe01 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/dto/SubscriptionStoreId.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/dto/ProductStoreId.kt @@ -1,7 +1,7 @@ package com.qonversion.android.sdk.internal.dto -internal data class SubscriptionStoreId( - val subscriptionId: String, +internal data class ProductStoreId( + val productId: String, val basePlanId: String?, // absent for inapp products val offerId: String? = null )