Skip to content

Commit

Permalink
Merge pull request #61 from qonversion/release/2.6.0
Browse files Browse the repository at this point in the history
Release/2.6.0
  • Loading branch information
suriksarkisyan authored Jun 4, 2021
2 parents e21697e + a3a0660 commit 5daf09e
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 29 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ repositories {
dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation "io.qonversion.android.sdk:sdk:2.7.6"
implementation "io.qonversion.android.sdk:sdk:2.8.1"
}

def configureReactNativePom(def pom) {
Expand Down
15 changes: 15 additions & 0 deletions android/src/main/java/com/reactlibrary/QonversionModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,19 @@ public void syncPurchases() {
public void setDebugMode() {
Qonversion.setDebugMode();
}

@ReactMethod
public void resetUser() {
Qonversion.resetUser();
}

@ReactMethod
public void identify(String userID) {
Qonversion.identify(userID);
}

@ReactMethod
public void logout() {
Qonversion.logout();
}
}
2 changes: 1 addition & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class QonversionSample extends React.PureComponent<{}, StateType> {
}).catch(error => {
this.setState({loading: false});
if (error.userCanceled) {
if (!error.userCanceled) {
Alert.alert(
'Error',
error.message,
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.2")
classpath('com.android.tools.build:gradle:4.1.2')

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
3 changes: 2 additions & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Fri May 28 00:00:38 MSK 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ PODS:
- glog (0.3.5)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.180)
- Qonversion (2.13.3)
- Qonversion (2.13.4)
- RCTRequired (0.63.4)
- RCTTypeSafety (0.63.4):
- FBLazyVector (= 0.63.4)
Expand Down Expand Up @@ -246,8 +246,8 @@ PODS:
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsinspector (0.63.4)
- react-native-qonversion (2.4.5):
- Qonversion (= 2.13.3)
- react-native-qonversion (2.5.0):
- Qonversion (= 2.13.4)
- React
- React-RCTActionSheet (0.63.4):
- React-Core/RCTActionSheetHeaders (= 0.63.4)
Expand Down Expand Up @@ -452,7 +452,7 @@ SPEC CHECKSUMS:
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
Qonversion: 3fe088c5f82913b47d0ad7725b14782597e70918
Qonversion: daafce021a90b6d5f8f340e3b68431f89f25ab8f
RCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e
RCTTypeSafety: 8c9c544ecbf20337d069e4ae7fd9a377aadf504b
React: b0a957a2c44da4113b0c4c9853d8387f8e64e615
Expand All @@ -463,7 +463,7 @@ SPEC CHECKSUMS:
React-jsi: a0418934cf48f25b485631deb27c64dc40fb4c31
React-jsiexecutor: 93bd528844ad21dc07aab1c67cb10abae6df6949
React-jsinspector: 58aef7155bc9a9683f5b60b35eccea8722a4f53a
react-native-qonversion: c7a384f1664825a7aecfff52466b22d980b362d9
react-native-qonversion: 7f6346aec5d3c1edaf2b508a10ff88b3435be5b3
React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336
React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b
React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0
Expand Down
33 changes: 16 additions & 17 deletions ios/EntitiesConverter.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ + (NSDictionary *)convertProducts:(NSArray<QNProduct *> *)products {

+ (NSDictionary *)convertProduct:(QNProduct *)product {
NSNumber *trialDuration = product.trialDuration ? @(product.trialDuration) : @(QNTrialDurationNotAvailable);
NSMutableDictionary *productsDict = [@{
@"id": product.qonversionID,
@"store_id": product.storeID,
@"type": @(product.type),
@"duration": @(product.duration),
@"prettyPrice": product.prettyPrice,
@"trialDuration": trialDuration
} mutableCopy];
NSMutableDictionary *productsDict = [NSMutableDictionary new];
productsDict[@"id"] = product.qonversionID;
productsDict[@"store_id"] = product.storeID;
productsDict[@"type"] = @(product.type);
productsDict[@"duration"] = @(product.duration);
productsDict[@"prettyPrice"] = product.prettyPrice;
productsDict[@"trialDuration"] = trialDuration;

if (product.skProduct) {
NSDictionary *skProductInfo = [EntitiesConverter convertSKProduct:product.skProduct];
Expand All @@ -64,15 +63,15 @@ + (NSDictionary *)convertPermissions:(NSArray<QNPermission *> *)permissions {
NSMutableDictionary *result = [NSMutableDictionary new];

for (QNPermission *permission in permissions) {
NSDictionary *permissionDict = @{
@"id": permission.permissionID,
@"associated_product": permission.productID,
@"renew_state": @(permission.renewState),
@"started_timestamp": @(permission.startedDate.timeIntervalSince1970 * 1000),
@"expiration_timestamp": @(permission.expirationDate.timeIntervalSince1970 * 1000),
@"active": @(permission.isActive),
};
result[permission.permissionID] = permissionDict;
NSMutableDictionary *permissionDict = [NSMutableDictionary new];
permissionDict[@"id"] = permission.permissionID;
permissionDict[@"associated_product"] = permission.productID;
permissionDict[@"renew_state"] = @(permission.renewState);
permissionDict[@"started_timestamp"] = @(permission.startedDate.timeIntervalSince1970 * 1000);
permissionDict[@"expiration_timestamp"] = @(permission.expirationDate.timeIntervalSince1970 * 1000);
permissionDict[@"active"] = @(permission.isActive);

result[permission.permissionID] = [permissionDict copy];
}

return result;
Expand Down
15 changes: 15 additions & 0 deletions ios/RNQonversion.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ @implementation RNQonversion
}];
}

RCT_EXPORT_METHOD(identify:(NSString *)userId)
{
[Qonversion identify:userId];
}

RCT_EXPORT_METHOD(logout)
{
[Qonversion logout];
}

RCT_EXPORT_METHOD(resetUser)
{
[Qonversion resetUser];
}

RCT_EXPORT_METHOD(setAdvertisingID) {
[Qonversion setAdvertisingID];
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-qonversion",
"title": "React Native Qonversion",
"version": "2.5.0",
"version": "2.6.0",
"description": "Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and content using our StoreKit wrapper and Google Play Billing wrapper.",
"main": "build/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion react-native-qonversion.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ Pod::Spec.new do |s|
s.requires_arc = true

s.dependency "React"
s.dependency "Qonversion", "2.13.3"
s.dependency "Qonversion", "2.14.0"
end
14 changes: 13 additions & 1 deletion src/classes/Qonversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { RNQonversion } = NativeModules;
const keyPrefix = "com.qonversion.keys";
const sourceKey = keyPrefix + ".source";
const versionKey = keyPrefix + ".sourceVersion";
const sdkVersion = "2.5.0";
const sdkVersion = "2.6.0";

export default class Qonversion {
static async launchWithKey(
Expand All @@ -27,6 +27,14 @@ export default class Qonversion {
return launchResult;
}

static identify(userID: string) {
RNQonversion.identify(userID);
}

static logout() {
RNQonversion.logout();
}

static setProperty(property: Property, value: string) {
RNQonversion.setProperty(property, value);
}
Expand Down Expand Up @@ -167,6 +175,10 @@ export default class Qonversion {
RNQonversion.setDebugMode();
}

static resetUser() {
RNQonversion.resetUser();
}

static setAdvertisingID() {
if (Platform.OS === "ios") {
RNQonversion.setAdvertisingID();
Expand Down

0 comments on commit 5daf09e

Please sign in to comment.