Skip to content

Commit

Permalink
Merge pull request #229 from qonversion/release/3.1.3
Browse files Browse the repository at this point in the history
Release 3.1.3
  • Loading branch information
Maria-Bordunova authored Oct 13, 2021
2 parents 262195f + 1744f5a commit 9b6f898
Show file tree
Hide file tree
Showing 12 changed files with 505 additions and 43 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/prerelease_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pre-release Github

on:
push:
branches:
- "main"

jobs:
pre-release:
runs-on: macos-latest

steps:
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
LICENSE.txt
*.jar
51 changes: 51 additions & 0 deletions .github/workflows/release_pull_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release pull requests
on:
push:
tags:
- prerelease/*

jobs:
prerelease:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
name: Checkout all
with:
fetch-depth: 0

- uses: olegtarasov/[email protected]
id: tagName
with:
tagRegex: 'prerelease\/(\d*\.\d*\.\d*)'

- name: Bump version
run: |
fastlane bump version:${{ steps.tagName.outputs.tag }}
- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
title: Release ${{ steps.tagName.outputs.tag }}
body: Release PR
labels: autocreated
branch: release/${{ steps.tagName.outputs.tag }}
base: develop

- uses: actions/checkout@v2
with:
ref: main

- name: Reset main branch
run: |
git fetch origin release/${{ steps.tagName.outputs.tag }}:release/${{ steps.tagName.outputs.tag }}
git reset --hard release/${{ steps.tagName.outputs.tag }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: Release ${{ steps.tagName.outputs.tag }}
body: Release PR
labels: autocreated
branch: release/${{ steps.tagName.outputs.tag }}
base: main
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
buildscript {
ext {
release = [
versionName: "3.1.2",
versionName: "3.1.3",
versionCode: 1
]
}
Expand Down
18 changes: 13 additions & 5 deletions config/detekt/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
<ID>FinalNewline:com.qonversion.android.sdk.storage.TokenExtractorTest.kt:1</ID>
<ID>FinalNewline:com.qonversion.android.sdk.storage.TokenStorageTest.kt:1</ID>
<ID>FinalNewline:com.qonversion.android.sdk.storage.util.kt:1</ID>
<ID>FinalNewline:com.qonversion.android.sdk.utils.kt:1</ID>
<ID>FinalNewline:com.qonversion.android.sdk.validator.util.kt:1</ID>
<ID>ForbiddenComment:AttributionRequestTest.kt$AttributionRequestTest$// TODO: Update test for new AttributionRequest format</ID>
<ID>ForbiddenComment:EnvironmentRequestTest.kt$EnvironmentRequestTest$// TODO: Update test for new Environment format</ID>
<ID>ForbiddenComment:GooglePurchaseConverterTest.kt$GooglePurchaseConverterTest$// TODO: Update test for new Purchase fields</ID>
<ID>ForbiddenComment:InAppRequestTest.kt$InAppRequestTest$// TODO: Update test for new InApp format</ID>
<ID>ForbiddenComment:InitRequestTest.kt$InitRequestTest$// TODO: Update test for new InitRequest format</ID>
<ID>ForbiddenComment:PropertiesRequestTest.kt$PropertiesRequestTest$// TODO: Update test for new PropertiesRequest format</ID>
Expand Down Expand Up @@ -159,7 +159,6 @@
<ID>MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.QueryPurchasesHistory$assertThat(billingError!!.billingResponseCode).isEqualTo(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE)</ID>
<ID>MaxLineLength:QonversionBillingServiceTest.kt$QonversionBillingServiceTest.QueryPurchasesHistory$billingClientStateListener.onBillingSetupFinished(buildResult(BillingClient.BillingResponseCode.BILLING_UNAVAILABLE))</ID>
<ID>MaxLineLength:QonversionError.kt$QonversionErrorCode$*</ID>
<ID>MaxLineLength:QonversionError.kt$QonversionErrorCode$NetworkConnectionFailed : QonversionErrorCode</ID>
<ID>MaxLineLength:ScreenPresenterTest.kt$ScreenPresenterTest$fun</ID>
<ID>MaxLineLength:SharedPreferencesCacheTest.kt$SharedPreferencesCacheTest.Object${ Assert.assertEquals("Wrong available offerings size value", 1, realValue?.offerings?.availableOfferings?.size) }</ID>
<ID>MaxLineLength:SharedPreferencesCacheTest.kt$SharedPreferencesCacheTest.Object${ Assert.assertEquals("Wrong experimentInfo value", expectedValue.offerings?.main?.experimentInfo, realValue?.offerings?.main?.experimentInfo) }</ID>
Expand All @@ -175,7 +174,6 @@
<ID>MaximumLineLength:com.qonversion.android.sdk.QProductCenterManagerTest.kt:152</ID>
<ID>MaximumLineLength:com.qonversion.android.sdk.QProductCenterManagerTest.kt:154</ID>
<ID>MaximumLineLength:com.qonversion.android.sdk.QUserPropertiesManagerTest.kt:169</ID>
<ID>MaximumLineLength:com.qonversion.android.sdk.QonversionError.kt:31</ID>
<ID>MaximumLineLength:com.qonversion.android.sdk.api.ApiErrorMapper.kt:117</ID>
<ID>MaximumLineLength:com.qonversion.android.sdk.api.ApiErrorMapper.kt:118</ID>
<ID>MaximumLineLength:com.qonversion.android.sdk.automations.AutomationsEventMapperTest.kt:105</ID>
Expand Down Expand Up @@ -266,6 +264,7 @@
<ID>NewLineAtEndOfFile:util.kt$com.qonversion.android.sdk.storage.util.kt</ID>
<ID>NewLineAtEndOfFile:util.kt$com.qonversion.android.sdk.validator.util.kt</ID>
<ID>NewLineAtEndOfFile:utils.kt$com.qonversion.android.app.utils.kt</ID>
<ID>NewLineAtEndOfFile:utils.kt$com.qonversion.android.sdk.utils.kt</ID>
<ID>NoBlankLineBeforeRbrace:com.qonversion.android.sdk.automations.QAutomationsManagerTest.kt:281</ID>
<ID>NoBlankLineBeforeRbrace:com.qonversion.android.sdk.converter.util.kt:55</ID>
<ID>NoBlankLineBeforeRbrace:com.qonversion.android.sdk.validator.RequestValidatorTest.kt:18</ID>
Expand Down Expand Up @@ -322,6 +321,8 @@
<ID>NoWildcardImports:com.qonversion.android.sdk.billing.QonversionBillingServiceTest.kt:5</ID>
<ID>NoWildcardImports:com.qonversion.android.sdk.billing.QonversionBillingServiceTest.kt:8</ID>
<ID>NoWildcardImports:com.qonversion.android.sdk.billing.utils.kt:8</ID>
<ID>NoWildcardImports:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:4</ID>
<ID>NoWildcardImports:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:7</ID>
<ID>NoWildcardImports:com.qonversion.android.sdk.di.component.AppComponent.kt:9</ID>
<ID>NoWildcardImports:com.qonversion.android.sdk.di.module.ManagersModule.kt:18</ID>
<ID>NoWildcardImports:com.qonversion.android.sdk.di.module.NetworkModule.kt:9</ID>
Expand All @@ -341,16 +342,25 @@
<ID>ReturnCount:ScreenPresenter.kt$ScreenPresenter$override fun shouldOverrideUrlLoading(url: String?): Boolean</ID>
<ID>ReturnCount:SkuDetailsTokenExtractor.kt$SkuDetailsTokenExtractor$override fun extract(response: String?): String</ID>
<ID>SpacingAroundColon:com.qonversion.android.sdk.requests.ProviderDataRequestTest.kt:43</ID>
<ID>SpacingAroundComma:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:146</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.ConsumerTest.kt:106</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.ConsumerTest.kt:122</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.ConsumerTest.kt:137</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.automations.QAutomationsManagerTest.kt:274</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:139</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:145</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:297</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:303</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.requests.PropertiesRequestTest.kt:13</ID>
<ID>SpacingAroundCurly:com.qonversion.android.sdk.requests.PropertiesRequestTest.kt:19</ID>
<ID>SpacingAroundParens:com.qonversion.android.sdk.QUserPropertiesManagerTest.kt:470</ID>
<ID>SpacingAroundParens:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:207</ID>
<ID>SpacingAroundParens:com.qonversion.android.sdk.converter.GooglePurchaseConverterTest.kt:308</ID>
<ID>SpacingAroundParens:com.qonversion.android.sdk.storage.SharedPreferencesCacheTest.kt:212</ID>
<ID>SpacingAroundParens:com.qonversion.android.sdk.storage.SharedPreferencesCacheTest.kt:243</ID>
<ID>SpacingAroundParens:com.qonversion.android.sdk.storage.SharedPreferencesCacheTest.kt:262</ID>
<ID>SpacingAroundParens:com.qonversion.android.sdk.utils.kt:64</ID>
<ID>StringTemplate:com.qonversion.android.sdk.utils.kt:49</ID>
<ID>SwallowedException:ApiErrorMapper.kt$ApiErrorMapper$catch (e: JSONException) { errorMessage = "$ERROR=failed to parse the backend response" }</ID>
<ID>SwallowedException:AutomationsEventMapper.kt$AutomationsEventMapper$catch (e: JSONException) { logger.release("getEventFromRemoteMessage() -&gt; Failed to retrieve event that triggered push notification") }</ID>
<ID>SwallowedException:EnvironmentProvider.kt$EnvironmentProvider$catch (throwable: Throwable) { UNKNOWN }</ID>
Expand All @@ -376,8 +386,6 @@
<ID>TooManyFunctions:ScreenActivity.kt$ScreenActivity : AppCompatActivityView</ID>
<ID>TooManyFunctions:utils.kt$com.qonversion.android.sdk.billing.utils.kt</ID>
<ID>UnnecessaryAbstractClass:RequestData.kt$RequestData</ID>
<ID>UnusedPrivateMember:GooglePurchaseConverterTest.kt$GooglePurchaseConverterTest$val converted = GooglePurchaseConverter(SkuDetailsTokenExtractor()) .convertPurchase( Pair( SkuDetails(CORRECT_SKU_DETAILS_INAPP_JSON), Purchase(CORRECT_PURCHASE_INAPP_JSON, "SKU") ) )</ID>
<ID>UnusedPrivateMember:GooglePurchaseConverterTest.kt$GooglePurchaseConverterTest$val converted = GooglePurchaseConverter(SkuDetailsTokenExtractor()) .convertPurchase( Pair( SkuDetails(CORRECT_SKU_DETAILS_SUB_JSON), Purchase(CORRECT_PURCHASE_SUB_JSON, "SKU") ) )</ID>
<ID>UnusedPrivateMember:PurchaseRequestTest.kt$PurchaseRequestTest$val purchase = converter.convertPurchase( Pair( SkuDetails(Util.CORRECT_SKU_DETAILS_INAPP_JSON), Purchase(Util.CORRECT_PURCHASE_INAPP_JSON, "SKU") ) )</ID>
<ID>UnusedPrivateMember:PurchaseRequestTest.kt$PurchaseRequestTest$val purchase = converter.convertPurchase( Pair( SkuDetails(Util.CORRECT_SKU_DETAILS_SUB_JSON), Purchase(Util.CORRECT_PURCHASE_SUB_JSON, "SKU") ) )</ID>
<ID>UnusedPrivateMember:QProductCenterManagerTest.kt$QProductCenterManagerTest$private val skuTypeSubs = BillingClient.SkuType.SUBS</ID>
Expand Down
9 changes: 7 additions & 2 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
or alternatively using `brew cask install fastlane`
or alternatively using `brew install fastlane`

# Available Actions
## Android
Expand All @@ -21,9 +21,14 @@ or alternatively using `brew cask install fastlane`
fastlane android test
```
Runs all the tests
### android bump
```
fastlane android bump
```


----

This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run.
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
7 changes: 1 addition & 6 deletions fastlane/report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@



<testcase classname="fastlane.lanes" name="0: default_platform" time="0.006291">

</testcase>


<testcase classname="fastlane.lanes" name="1: test" time="9.949658">
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.07686">

</testcase>

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/qonversion/android/sdk/Consumer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Consumer internal constructor(
purchases.forEach { purchase ->
val skuDetail = skuDetails[purchase.sku]
skuDetail?.let { sku ->
if (purchase.purchaseState != Purchase.PurchaseState.PENDING) {
if (purchase.purchaseState == Purchase.PurchaseState.PURCHASED) {
consume(sku.type, purchase.purchaseToken, purchase.isAcknowledged)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,14 @@ class QProductCenterManager internal constructor(
return@queryPurchases
}

val completedPurchases =
purchases.filter { it.purchaseState == Purchase.PurchaseState.PURCHASED }
billingService.getSkuDetailsFromPurchases(
purchases,
completedPurchases,
onCompleted = { skuDetails ->
val formattedSkuDetails: Map<String, SkuDetails> =
configureSkuDetails(skuDetails)
val purchasesInfo = converter.convertPurchases(formattedSkuDetails, purchases)
val purchasesInfo = converter.convertPurchases(formattedSkuDetails, completedPurchases)
val initRequestData = InitRequestData(installDate, advertisingID, purchasesInfo, callback)
processInit(initRequestData)
},
Expand Down Expand Up @@ -810,9 +812,15 @@ class QProductCenterManager internal constructor(
val purchaseCallback = purchasingCallbacks[purchase.sku]
purchasingCallbacks.remove(purchase.sku)

if (purchase.purchaseState == Purchase.PurchaseState.PENDING) {
purchaseCallback?.onError(QonversionError(QonversionErrorCode.PurchasePending))
return@forEach
when (purchase.purchaseState) {
Purchase.PurchaseState.PENDING -> {
purchaseCallback?.onError(QonversionError(QonversionErrorCode.PurchasePending))
return@forEach
}
Purchase.PurchaseState.UNSPECIFIED_STATE -> {
purchaseCallback?.onError(QonversionError(QonversionErrorCode.PurchaseUnspecified))
return@forEach
}
}

val skuDetail = skuDetails[purchase.sku] ?: return@forEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ enum class QonversionErrorCode(val specification: String) {
PlayStoreError("There was an issue with the Play Store service"),
BillingUnavailable("The Billing service is unavailable on the device"),
PurchasePending("Purchase is pending"),
PurchaseUnspecified("Unspecified state of the purchase"),
PurchaseInvalid("Failure of purchase"),
CanceledPurchase("User pressed back or canceled a dialog for purchase"),
ProductNotOwned("Failure to consume purchase since item is not owned"),
ProductAlreadyOwned("Failure to purchase since item is already owned"),
FeatureNotSupported("The requested feature is not supported"),
ProductUnavailable("Requested product is not available for purchase or its SKU was not found"),
NetworkConnectionFailed("There was a network issue. Please make sure that the Internet connection is available on the device"),
NetworkConnectionFailed("There was a network issue. " +
"Please make sure that the Internet connection is available on the device"),
ParseResponseFailed("A problem occurred when serializing or deserializing data"),
BackendError("There was a backend error"),
ProductNotFound("Failure to purchase since the Qonversion product was not found"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ class AppModule(
}

companion object {
private const val SDK_VERSION = "3.1.2"
private const val SDK_VERSION = "3.1.3"
}
}
Loading

0 comments on commit 9b6f898

Please sign in to comment.