Skip to content

Commit

Permalink
Merge pull request #41 from qonversion/release/4.2.0
Browse files Browse the repository at this point in the history
Release 4.2.0
  • Loading branch information
suriksarkisyan authored Sep 25, 2023
2 parents fea377e + 1d68683 commit 0a49774
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 5 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": "4.1.0",
"version": "4.2.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 @@ -44,7 +44,7 @@
<param name="android-package" value="com.qonversion.android.sdk.QonversionPlugin"/>
</feature>
</config-file>
<framework src="io.qonversion.sandwich:sandwich:3.1.1" />
<framework src="io.qonversion.sandwich:sandwich:3.2.0" />
<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 @@ -62,7 +62,7 @@
<source url="https://github.com/CocoaPods/Specs.git"/>
</config>
<pods use-frameworks="true">
<pod name="QonversionSandwich" spec="3.1.1" />
<pod name="QonversionSandwich" spec="3.2.0" />
</pods>
</podspec>
</platform>
Expand Down
10 changes: 10 additions & 0 deletions plugin/src/android/QonversionPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ public void detachUserFromExperiment(String experimentId, CallbackContext callba
qonversionSandwich.detachUserFromExperiment(experimentId, Utils.getEmptyResultListener(callbackContext));
}

@PluginAction(thread = ExecutionThread.UI, actionName = "attachUserToRemoteConfiguration", isAutofinish = false)
public void attachUserToRemoteConfiguration(String remoteConfigurationId, CallbackContext callbackContext) {
qonversionSandwich.attachUserToRemoteConfiguration(remoteConfigurationId, Utils.getEmptyResultListener(callbackContext));
}

@PluginAction(thread = ExecutionThread.UI, actionName = "detachUserFromRemoteConfiguration", isAutofinish = false)
public void detachUserFromRemoteConfiguration(String remoteConfigurationId, CallbackContext callbackContext) {
qonversionSandwich.detachUserFromRemoteConfiguration(remoteConfigurationId, Utils.getEmptyResultListener(callbackContext));
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "syncPurchases", isAutofinish = false)
public void syncPurchases(CallbackContext callbackContext) {
qonversionSandwich.syncPurchases();
Expand Down
2 changes: 2 additions & 0 deletions plugin/src/ios/CDVQonversionPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)remoteConfig:(CDVInvokedUrlCommand *)command;
- (void)attachUserToExperiment:(CDVInvokedUrlCommand *)command;
- (void)detachUserFromExperiment:(CDVInvokedUrlCommand *)command;
- (void)attachUserToRemoteConfiguration:(CDVInvokedUrlCommand *)command;
- (void)detachUserFromRemoteConfiguration:(CDVInvokedUrlCommand *)command;

@end

Expand Down
24 changes: 24 additions & 0 deletions plugin/src/ios/CDVQonversionPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,30 @@ - (void)detachUserFromExperiment:(CDVInvokedUrlCommand *)command {
}];
}

- (void)attachUserToRemoteConfiguration:(CDVInvokedUrlCommand *)command {
__block __weak CDVQonversionPlugin *weakSelf = self;
NSString *remoteConfigurationId = [command argumentAtIndex:0];
[self.qonversionSandwich attachUserToRemoteConfigurationWith:remoteConfigurationId completion:^(NSDictionary<NSString *,id> * _Nullable result, SandwichError * _Nullable error) {
if (error) {
[weakSelf returnCordovaResult:nil error:error command:command];
} else {
[weakSelf returnCordovaResult:@{} error:nil command:command];
}
}];
}

- (void)detachUserFromRemoteConfiguration:(CDVInvokedUrlCommand *)command {
__block __weak CDVQonversionPlugin *weakSelf = self;
NSString *remoteConfigurationId = [command argumentAtIndex:0];
[self.qonversionSandwich detachUserFromRemoteConfigurationWith:remoteConfigurationId completion:^(NSDictionary<NSString *,id> * _Nullable result, SandwichError * _Nullable error) {
if (error) {
[weakSelf returnCordovaResult:nil error:error command:command];
} else {
[weakSelf returnCordovaResult:@{} error:nil command:command];
}
}];
}

- (void)identify:(CDVInvokedUrlCommand *)command {
NSString *identityId = [command argumentAtIndex:0];
[self.qonversionSandwich identify:identityId];
Expand Down
16 changes: 16 additions & 0 deletions plugin/src/plugin/QonversionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ export interface QonversionApi {
*/
detachUserFromExperiment(experimentId: string): Promise<void>

/**
* This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release.
* Use this function to attach the user to the remote configuration.
* @param remoteConfigurationId identifier of the remote configuration
* @returns the promise for success result or throws an error otherwise.
*/
attachUserToRemoteConfiguration(remoteConfigurationId: string): Promise<void>

/**
* This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release.
* Use this function to detach the user from the remote configuration.
* @param remoteConfigurationId identifier of the remote configuration
* @returns the promise for success result or throws an error otherwise.
*/
detachUserFromRemoteConfiguration(remoteConfigurationId: string): Promise<void>

/**
* Sends your attribution {@link data} to the {@link provider}.
*
Expand Down
12 changes: 11 additions & 1 deletion plugin/src/plugin/QonversionInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {EntitlementsUpdateListener} from './EntitlementsUpdateListener';
import {RemoteConfig} from "./RemoteConfig";
import {UserProperties} from './UserProperties';

const sdkVersion = "4.1.0";
const sdkVersion = "4.2.0";

export default class QonversionInternal implements QonversionApi {

Expand Down Expand Up @@ -266,6 +266,16 @@ export default class QonversionInternal implements QonversionApi {
return;
}

async attachUserToRemoteConfiguration(remoteConfigurationId: string): Promise<void> {
await callNative('attachUserToRemoteConfiguration', [remoteConfigurationId]);
return;
}

async detachUserFromRemoteConfiguration(remoteConfigurationId: string): Promise<void> {
await callNative('detachUserFromRemoteConfiguration', [remoteConfigurationId]);
return;
}

attribution(data: Object, provider: AttributionProvider) {
callNative('attribution', [data, provider]).then(noop);
}
Expand Down
2 changes: 1 addition & 1 deletion sample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ cordova-plugin-device@^2.1.0:
integrity sha512-FU0Lw1jZpuKOgG4v80LrfMAOIMCGfAVPumn7AwaX9S1iU/X3OPZUyoKUgP09q4bxL35IeNPkqNWVKYduAXZ1sg==

"cordova-plugin-qonversion@file:../plugin":
version "4.0.0"
version "4.1.0"
resolved "file:../plugin"

cross-spawn@^7.0.1, cross-spawn@^7.0.3:
Expand Down

0 comments on commit 0a49774

Please sign in to comment.