Skip to content

Commit

Permalink
Release 5.4.0
Browse files Browse the repository at this point in the history
Release 5.4.0
  • Loading branch information
SpertsyanKM authored May 7, 2024
2 parents 9a28b19 + acd74dc commit a676993
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-qonversion",
"version": "5.3.1",
"version": "5.4.0",
"description": "Qonversion Cordova Plugin",
"cordova": {
"id": "cordova-plugin-qonversion",
Expand Down
4 changes: 2 additions & 2 deletions plugin/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<param name="android-package" value="com.qonversion.android.sdk.QonversionPlugin"/>
</feature>
</config-file>
<framework src="io.qonversion.sandwich:sandwich:4.3.2" />
<framework src="io.qonversion.sandwich:sandwich:4.4.1" />
<source-file src="src/android/QonversionPlugin.java" target-dir="src/com/qonversion/android/sdk" />
<source-file src="src/android/EntitiesConverter.java" target-dir="src/com/qonversion/android/sdk" />
<source-file src="src/android/Utils.java" target-dir="src/com/qonversion/android/sdk" />
Expand All @@ -72,7 +72,7 @@
<source url="https://github.com/CocoaPods/Specs.git"/>
</config>
<pods use-frameworks="true">
<pod name="QonversionSandwich" spec="4.3.2" />
<pod name="QonversionSandwich" spec="4.4.1" />
</pods>
</podspec>
</platform>
Expand Down
3 changes: 1 addition & 2 deletions plugin/src/android/QonversionPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,7 @@ public void syncPurchases(CallbackContext callbackContext) {

@PluginAction(thread = ExecutionThread.WORKER, actionName = "identify")
public void identify(String userID, CallbackContext callbackContext) {
qonversionSandwich.identify(userID);
callbackContext.success();
qonversionSandwich.identify(userID, Utils.getResultListener(callbackContext));
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "logout")
Expand Down
5 changes: 4 additions & 1 deletion plugin/src/ios/CDVQonversionPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,11 @@ - (void)detachUserFromRemoteConfiguration:(CDVInvokedUrlCommand *)command {
}

- (void)identify:(CDVInvokedUrlCommand *)command {
__block __weak CDVQonversionPlugin *weakSelf = self;
NSString *identityId = [command argumentAtIndex:0];
[self.qonversionSandwich identify:identityId];
[self.qonversionSandwich identify:identityId :^(NSDictionary<NSString *,id> * _Nullable result, SandwichError * _Nullable error) {
[weakSelf returnCordovaResult:result error:error command:command];
}];
}

- (void)logout:(CDVInvokedUrlCommand *)command {
Expand Down
3 changes: 2 additions & 1 deletion plugin/src/plugin/QonversionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ export interface QonversionApi {
* Call this function to link a user to his unique ID in your system and share purchase data.
*
* @param userID unique user ID in your system
* @returns the promise with the information about the identified user.
*/
identify(userID: string): void;
identify(userID: string): Promise<User>;

/**
* Call this function to unlink a user from his unique ID in your system and his purchase data.
Expand Down
11 changes: 8 additions & 3 deletions plugin/src/plugin/QonversionInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {UserProperties} from './UserProperties';
import {PurchaseModel} from './PurchaseModel';
import {PurchaseUpdateModel} from './PurchaseUpdateModel';

const sdkVersion = "5.3.1";
const sdkVersion = "5.4.0";

export default class QonversionInternal implements QonversionApi {

Expand Down Expand Up @@ -181,8 +181,13 @@ export default class QonversionInternal implements QonversionApi {
callNative('syncPurchases').then(noop);
}

identify(userID: string) {
callNative('identify', [userID]).then(noop);
async identify(userID: string): Promise<User> {
const info = await callNative<QUser>('identify', [userID]);

// noinspection UnnecessaryLocalVariableJS
const mappedUserInfo: User = Mapper.convertUserInfo(info);

return mappedUserInfo;
}

logout() {
Expand Down
6 changes: 3 additions & 3 deletions sample/www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ const app = {
console.log('Qonversion syncHistoricalData');
},

identify() {
async identify() {
const userId = document.getElementById('user-id').value;
Qonversion.getSharedInstance().identify(userId);
console.log('Qonversion identify', userId);
const user = await Qonversion.getSharedInstance().identify(userId);
console.log('Qonversion identify', user);
},

logout() {
Expand Down

0 comments on commit a676993

Please sign in to comment.