Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nocodes/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {

android {
namespace 'io.qonversion.nocodes'
compileSdk 34
compileSdk 35

defaultConfig {
minSdk 23
targetSdk 34
targetSdk 35

group = 'io.qonversion.nocodes'
version = nocodes.versionName
Expand Down
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ plugins {

android {
namespace 'io.qonversion.sample'
compileSdk 34
compileSdk 35

defaultConfig {
applicationId "io.qonversion.sampleapp"
minSdk 23
targetSdk 34
targetSdk 35
versionCode 1
versionName '1.0.0'
multiDexEnabled true
Expand Down
6 changes: 3 additions & 3 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
compileSdk 34
compileSdk 35

defaultConfig {
minSdkVersion 23
targetSdkVersion 34
targetSdkVersion 35

consumerProguardFiles 'consumer-rules.pro'
group = 'io.qonversion.android.sdk'
Expand Down Expand Up @@ -65,7 +65,7 @@ ext {
moshiVersion = '1.15.2'
retrofit_version = '2.9.0'
okhttp_version = '3.12.13'
billing = '8.1.0'
billing = '9.1.0'
lifecycle_version = '2.1.0'
assertj_version = '3.16.1'
junit_version = '5.6.2'
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/qonversion/android/sdk/Qonversion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ interface Qonversion {

/**
* Return Qonversion Products in association with Google Play Store Products
* If you get an empty SkuDetails be sure your products are correctly set up in Google Play Store.
* If you get empty ProductDetails be sure your products are correctly set up in Google Play Store.
* @param callback - callback that will be called when response is received
* @see [Product Center](https://qonversion.io/docs/product-center)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal class EnvironmentProvider(
context.packageManager.getPackageInfo(context.packageName, 0)
}

packageInfo.versionName
packageInfo.versionName ?: UNKNOWN
} catch (throwable: Throwable) {
UNKNOWN
}
Expand Down
104 changes: 0 additions & 104 deletions sdk/src/test/java/com/qonversion/android/sdk/utils.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package com.qonversion.android.sdk

import com.android.billingclient.api.Purchase
import com.android.billingclient.api.*
import com.qonversion.android.sdk.Constants.DEFAULT_SUBS_PERIOD
import com.qonversion.android.sdk.Constants.DEFAULT_SUBS_SKU
import com.qonversion.android.sdk.Constants.INAPP_PURCHASE
import com.qonversion.android.sdk.Constants.INAPP_SKU_DETAILS
import com.qonversion.android.sdk.Constants.SUBS_PURCHASE_INCOMPLETE
import com.qonversion.android.sdk.Constants.PURCHASE_SIGNATURE
import com.qonversion.android.sdk.Constants.SUBS_SKU_DETAILS_INCOMPLETE
import java.lang.reflect.Modifier

fun Any.mockPrivateField(fieldName: String, field: Any?) {
Expand All @@ -25,98 +16,3 @@ fun <T> Any.getPrivateField(name: String): T {
@Suppress("UNCHECKED_CAST")
return field.get(this) as T
}

@Suppress("DEPRECATION")
fun mockSubsSkuDetails(
sku: String = DEFAULT_SUBS_SKU,
subsPeriod: String = DEFAULT_SUBS_PERIOD,
freeTrialPeriod: String? = null
): SkuDetails {
val skuDetailsJson = mockSubsSkuDetailsJson(sku, subsPeriod, freeTrialPeriod)
return SkuDetails(skuDetailsJson)
}

fun mockSubsSkuDetailsJson(
sku: String = DEFAULT_SUBS_SKU,
subsPeriod: String = DEFAULT_SUBS_PERIOD,
freeTrialPeriod: String? = null
): String {
val sb = StringBuilder()
sb.append("$SUBS_SKU_DETAILS_INCOMPLETE, \"productId\":\"$sku\", \"subscriptionPeriod\":$subsPeriod")
freeTrialPeriod?.let {
sb.append(",\"freeTrialPeriod\":\"$it\"")
}

return "{${sb}}"
}

fun mockSubsPurchase(sku: String = DEFAULT_SUBS_SKU): Purchase {
return Purchase("{$SUBS_PURCHASE_INCOMPLETE, \"productId\":\"$sku\"}", PURCHASE_SIGNATURE)
}

fun mockIncorrectSubsPurchase(): Purchase {
return Purchase("{$SUBS_PURCHASE_INCOMPLETE}", PURCHASE_SIGNATURE)
}

@Suppress("DEPRECATION")
fun mockInAppSkuDetails(): SkuDetails {
return SkuDetails(mockInAppSkuDetailsJson())
}

fun mockInAppSkuDetailsJson(
): String {
return "{$INAPP_SKU_DETAILS}"
}

fun mockInAppPurchase(): Purchase {
return Purchase("{$INAPP_PURCHASE}", PURCHASE_SIGNATURE)
}

object Constants {
// Subscription purchase without productId
const val SUBS_PURCHASE_INCOMPLETE = "\"orderId\":\"GPA.0000-0000-0000-0000\"," +
"\"packageName\":\"io.qonversion.sample\"," +
"\"purchaseTime\":1631867965714," +
"\"purchaseState\":1," +
"\"purchaseToken\":\"XXXXXXX\"," +
"\"quantity\":1," +
"\"autoRenewing\":true," +
"\"acknowledged\":true"

// Subscription SkuDetails without productId, subscriptionPeriod, freeTrialPeriod
const val SUBS_SKU_DETAILS_INCOMPLETE = "\"type\":\"subs\"," +
"\"title\":\"Qonversion Subs\"," +
"\"name\":\"Qonversion Subscription Weekly\"," +
"\"price\":\"RUB 439.00\"," +
"\"price_amount_micros\":439000000," +
"\"price_currency_code\":\"RUB\"," +
"\"description\":\"Weekly\"," +
"\"introductoryPriceAmountMicros\":85000000," +
"\"introductoryPricePeriod\":\"P3D\"," +
"\"introductoryPrice\":\"RUB 85.00\"," +
"\"introductoryPriceCycles\":1," +
"\"skuDetailsToken\":\"XXXXXXX\""

const val INAPP_SKU_DETAILS = "\"productId\":\"qonversion_inapp_consumable\"," +
"\"type\":\"inapp\"," +
"\"title\":\"Qonversion In-app\"," +
"\"name\":\"Qonversion In-app Consumable\"," +
"\"price\":\"RUB 75.00\"," +
"\"price_amount_micros\":75000000," +
"\"price_currency_code\":\"RUB\"," +
"\"description\":\"Consumable\"," +
"\"skuDetailsToken\":\"XXXXXXX\"}"

const val INAPP_PURCHASE = "\"orderId\":\"GPA.0000-0000-0000-0000\"," +
"\"packageName\":\"io.qonversion.sample\"," +
"\"productId\":\"qonversion_inapp_consumable\"," +
"\"purchaseTime\":1632238801527," +
"\"purchaseState\":1," +
"\"purchaseToken\":\"XXXXXXX\"," +
"\"quantity\":1," +
"\"acknowledged\":true"

const val PURCHASE_SIGNATURE = "mockSignature"
const val DEFAULT_SUBS_PERIOD = "P1W"
const val DEFAULT_SUBS_SKU = "subs_weekly"
}
Loading