Skip to content
Merged
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
build/
.idea

lib/*.jar
lib/*.jar

# Local configuration files
local.properties
**/local.properties
4 changes: 1 addition & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ buildscript {
repositories {
google()
mavenCentral()
jcenter()
}

dependencies {
Expand All @@ -19,7 +18,6 @@ rootProject.allprojects {
repositories {
google()
mavenCentral()
jcenter()
mavenLocal()
}
}
Expand Down Expand Up @@ -53,6 +51,6 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "io.qonversion:sandwich:6.0.11"
implementation "io.qonversion:sandwich:7.1.0"
implementation 'com.google.code.gson:gson:2.9.0'
}
12 changes: 10 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.qonversion.sample"
applicationId "io.qonversion.sampleapp"
minSdkVersion 21
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
Expand Down Expand Up @@ -74,7 +74,7 @@ android {
lint {
disable 'InvalidPackage'
}
namespace 'com.qonversion.sample'
namespace 'io.qonversion.sampleapp'
}

flutter {
Expand All @@ -86,4 +86,12 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'androidx.multidex:multidex:2.0.1'
// implementation project(':qonversion_flutter')
}

// Задача wrapper для совместимости с Android Studio
tasks.register("wrapper") {
doLast {
println "Wrapper task is only available in root project. Use './gradlew wrapper' from root."
}
}
27 changes: 8 additions & 19 deletions example/android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
{
"project_info": {
"project_number": "11599271839",
"firebase_url": "https://qonversion-sample-app.firebaseio.com",
"project_id": "qonversion-sample-app",
"storage_bucket": "qonversion-sample-app.appspot.com"
"project_number": "176235602178",
"project_id": "qonversion-sample-applic-eb8a7",
"storage_bucket": "qonversion-sample-applic-eb8a7.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:11599271839:android:134918dd6bba6f6970cfaa",
"mobilesdk_app_id": "1:176235602178:android:b090da6fa0510c7192621b",
"android_client_info": {
"package_name": "com.qonversion.sample"
"package_name": "io.qonversion.sampleapp"
}
},
"oauth_client": [
{
"client_id": "11599271839-jg1njos9hp2d07jg7d3oqi523io0pdr6.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyClJuW1Z3_lUnvnsCtjDl-P2vgTLMK39OA"
"current_key": "AIzaSyA0fYxEeTDdoXZopKU54FtsN75FAcmZE9U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "11599271839-jg1njos9hp2d07jg7d3oqi523io0pdr6.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.qonversion.sample">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.qonversion.sampleapp">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
Expand All @@ -9,7 +9,7 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="com.android.vending.BILLING"/>
<application
android:label="com.qonversion.sample"
android:label="io.qonversion.sampleapp"
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
"type": 2
},
{
"id": "subs_plus_trial",
"id": "semi-premium",
"duration": 1,
"store_id": "gp5_test_subscription_4",
"store_id": "semi_premium",
"type": 0
},
{
Expand Down Expand Up @@ -138,8 +138,9 @@
"plus"
],
"consumable": [],
"subs_plus_trial": [
"standart"
"semi-premium": [
"premium",
"semi_premium"
],
"annual": [
"standart",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.qonversion.sample
package io.qonversion.sampleapp

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
Expand Down
3 changes: 2 additions & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -16,3 +16,4 @@ subprojects {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4096M -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
5 changes: 3 additions & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Fri Dec 04 11:26:13 MSK 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
2 changes: 0 additions & 2 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,12 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/NoCodes/NoCodes.framework",
"${BUILT_PRODUCTS_DIR}/Qonversion/Qonversion.framework",
"${BUILT_PRODUCTS_DIR}/QonversionSandwich/QonversionSandwich.framework",
"${BUILT_PRODUCTS_DIR}/qonversion_flutter/qonversion_flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NoCodes.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Qonversion.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QonversionSandwich.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/qonversion_flutter.framework",
Expand Down
3 changes: 1 addition & 2 deletions example/lib/params_view.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:qonversion_flutter/qonversion_flutter.dart';

Expand Down Expand Up @@ -62,7 +61,7 @@ class ParamsView extends StatelessWidget {
),
for (final v in QUserPropertyKey.values)
TextButton(
child: Text('Set ${describeEnum(v)}'),
child: Text('Set ${v.name}'),
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Colors.purple),
foregroundColor: WidgetStateProperty.all(Colors.white),
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ publish_to: 'none'
version: 1.0.0

environment:
sdk: ">=2.14.0 <3.0.0"
flutter: ">=1.12.13+hotfix.6"
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.0.0"

dependencies:
flutter:
Expand Down
3 changes: 2 additions & 1 deletion ios/Classes/NoCodesPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public class NoCodesPlugin: NSObject {
noCodesSandwich = NoCodesSandwich(noCodesEventListener: self)
}

noCodesSandwich?.initialize(projectKey: projectKey)
let proxyUrl = args["proxyUrl"] as? String
noCodesSandwich?.initialize(projectKey: projectKey, proxyUrl: proxyUrl)
result(nil)
}

Expand Down
2 changes: 1 addition & 1 deletion ios/qonversion_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '13.0'
s.dependency "QonversionSandwich", "6.0.11"
s.dependency "QonversionSandwich", "7.1.0"

# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
Expand Down
2 changes: 1 addition & 1 deletion lib/qonversion_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export 'src/dto/purchase_options_builder.dart';
export 'src/dto/purchase_update_model.dart';
export 'src/dto/purchase_update_policy.dart';
export 'src/dto/purchase_exception.dart';
export 'src/dto/qonversion_exception.dart';
export 'src/dto/subscription_period.dart';
export 'src/dto/qonversion_error.dart';
export 'src/dto/qonversion_error_code.dart';
Expand All @@ -37,7 +38,6 @@ export 'src/dto/sk_product/sk_product.dart';
export 'src/dto/sk_product/sk_product_discount.dart';
export 'src/dto/sk_product/subscription_period.dart';
export 'src/dto/sk_product/subscription_period_unit.dart';
export 'src/dto/sku_details/sku_details.dart';
export 'src/dto/store_product/product_inapp_details.dart';
export 'src/dto/store_product/product_installment_plan_details.dart';
export 'src/dto/store_product/product_offer_details.dart';
Expand Down
62 changes: 16 additions & 46 deletions lib/src/dto/product.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'product_type.dart';
import 'purchase_model.dart';
import 'purchase_update_model.dart';
import 'sk_product/sk_product.dart';
import 'sku_details/sku_details.dart';
import 'sk_product/sk_product_discount.dart';
import '../internal/mapper.dart';
import 'subscription_period.dart';
Expand All @@ -34,14 +33,6 @@ class QProduct {
@JsonKey(name: 'basePlanId')
final String? basePlanId;

/// Google Play Store details of this product.
/// Android only. Null for iOS, or if the product was not found.
/// Doesn't take into account [basePlanId].
/// @deprecated Consider using [storeDetails] instead.
@JsonKey(name: 'skuDetails', fromJson: QMapper.skuDetailsFromJson)
// ignore: deprecated_member_use_from_same_package
final SkuDetailsWrapper? skuDetails;

/// Google Play Store details of this product.
/// Android only. Null for iOS, or if the product was not found.
@JsonKey(name: 'storeDetails', fromJson: QMapper.storeProductDetailsFromJson)
Expand All @@ -57,8 +48,7 @@ class QProduct {
@JsonKey(name: 'offeringId')
final String? offeringId;

/// For Android - the subscription base plan duration. If the [basePlanId] is not specified,
/// the duration is calculated using the deprecated [skuDetails].
/// For Android - the subscription base plan duration from [storeDetails].
/// For iOS - the duration of the [skProduct].
/// Null, if it's not a subscription product or the product was not found in the store.
@JsonKey(name: 'subscriptionPeriod', fromJson: QMapper.subscriptionPeriodFromJson)
Expand All @@ -72,8 +62,7 @@ class QProduct {
final QSubscriptionPeriod? trialPeriod;

/// The calculated type of this product based on the store information.
/// On Android uses deprecated [skuDetails] for the old subscription products
/// where [basePlanId] is not specified, and [storeDetails] for all the other products.
/// On Android uses [storeDetails] for product information.
/// On iOS uses [skProduct] information.
@JsonKey(name: 'type', unknownEnumValue: QProductType.unknown)
final QProductType type;
Expand Down Expand Up @@ -106,7 +95,6 @@ class QProduct {
this.qonversionId,
this.storeId,
this.basePlanId,
this.skuDetails,
this.storeDetails,
this.skProduct,
this.offeringId,
Expand All @@ -115,7 +103,6 @@ class QProduct {
this.type,
this.prettyPrice,
) {
final skuDetails = this.skuDetails;
final storeDetails = this.storeDetails;
final skProduct = this.skProduct;

Expand All @@ -130,38 +117,21 @@ class QProduct {
if (introPrice != null && currencySymbol != null) {
prettyIntroductoryPrice = currencySymbol + introPrice.price;
}
} else {
var priceMicros;
if (skuDetails != null) {
storeTitle = skuDetails.title;
storeDescription = skuDetails.description;

priceMicros = skuDetails.priceAmountMicros;
currencyCode = skuDetails.priceCurrencyCode;

final String? introPrice = skuDetails.introductoryPrice;
if (introPrice != null && introPrice.isEmpty) {
prettyIntroductoryPrice = null;
} else {
prettyIntroductoryPrice = introPrice;
}
}
} else if (storeDetails != null) {
storeTitle = storeDetails.title;
storeDescription = storeDetails.description;

if (storeDetails != null) {
storeTitle = storeDetails.title;
storeDescription = storeDetails.description;

final QProductOfferDetails? defaultOffer = storeDetails.defaultSubscriptionOfferDetails;
final QProductInAppDetails? inAppOffer = storeDetails.inAppOfferDetails;
if (defaultOffer != null) {
priceMicros = defaultOffer.basePlan?.price.priceAmountMicros;
currencyCode = defaultOffer.basePlan?.price.priceCurrencyCode;
prettyIntroductoryPrice = defaultOffer.introPhase?.price.formattedPrice;
} else if (inAppOffer != null) {
priceMicros = inAppOffer.price.priceAmountMicros;
currencyCode = inAppOffer.price.priceCurrencyCode;
prettyIntroductoryPrice = null;
}
final QProductOfferDetails? defaultOffer = storeDetails.defaultSubscriptionOfferDetails;
final QProductInAppDetails? inAppOffer = storeDetails.inAppOfferDetails;
var priceMicros;
if (defaultOffer != null) {
priceMicros = defaultOffer.basePlan?.price.priceAmountMicros;
currencyCode = defaultOffer.basePlan?.price.priceCurrencyCode;
prettyIntroductoryPrice = defaultOffer.introPhase?.price.formattedPrice;
} else if (inAppOffer != null) {
priceMicros = inAppOffer.price.priceAmountMicros;
currencyCode = inAppOffer.price.priceCurrencyCode;
prettyIntroductoryPrice = null;
}

price = priceMicros == null
Expand Down
2 changes: 0 additions & 2 deletions lib/src/dto/product.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/dto/qonversion_error.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading