Skip to content

Commit

Permalink
1.3.0 (#56)
Browse files Browse the repository at this point in the history
* bumped common version

* bumped cordova version to 10.0

* added new methods for network ids attribution to iOS

* added new methods for network ids attribution to typescript

* added new methods for network ids attribution to java

* fixed imports in java

* compiled typescript

* added non-subscription transactions to purchaser info

* renamed Transaction -> PurchasesTransaction

* added swift file to fix compile issues on objective-c codebases

* String -> string in typescript

* bumped common version to 1.4.3, added entry to changelog

* bumped version number in the rest of the files

* fixes from PR comments
  • Loading branch information
aboedo committed Sep 25, 2020
1 parent 4db7387 commit c803df6
Show file tree
Hide file tree
Showing 13 changed files with 9,735 additions and 6,984 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
### 1.3.0

- Attribution V2:
- Deprecated `addAttribution` in favor of `setAdjustId`, `setAppsflyerId`, `setFbAnonymousId`, `setMparticleId`.
- Added support for OneSignal via `setOnesignalId`
- Added `setMediaSource`, `setCampaign`, `setAdGroup`, `setAd`, `setKeyword`, `setCreative`, and `collectDeviceIdentifiers`
https://github.com/RevenueCat/purchases-android/pull/184
- Bumped `purchases-hybrid-common` to 1.4.3 [Changelog here](https://github.com/RevenueCat/purchases-hybrid-common/releases)
- Bumped `purchases-ios` to 3.7.2 [Changelog here](https://github.com/RevenueCat/purchases-ios/releases)
- Bumped `purchases-android` to 3.5.0 [Changelog here](https://github.com/RevenueCat/purchases-android/releases)
- Added `PurchasesPlugin.swift` to prevent compiling issues on objective-c projects
- removed `use-frameworks` setting in the sample app to fix linking issues

## 1.2.2

- Adds missing import.
Expand Down
16,104 changes: 9,139 additions & 6,965 deletions examples/cordova-sample/MyApp/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/cordova-sample/MyApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"author": "Apache Cordova Team",
"license": "Apache-2.0",
"dependencies": {
"cordova": "^10.0.0",
"cordova-android": "^8.1.0",
"cordova-annotated-plugin-android": "^1.0.4",
"cordova-ios": "^5.1.1",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-purchases",
"version": "1.2.2",
"version": "1.3.0",
"description": "Purchases Cordova Plugin",
"types": "./www/plugin.d.ts",
"cordova": {
Expand Down
7 changes: 4 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-purchases" version="1.2.2">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-purchases" version="1.3.0">

<dependency id="cordova-annotated-plugin-android" />

Expand All @@ -16,7 +16,7 @@
<param name="android-package" value="com.revenuecat.purchases.PurchasesPlugin" />
</feature>
</config-file>
<framework src="com.revenuecat.purchases:purchases-hybrid-common:1.2.0" />
<framework src="com.revenuecat.purchases:purchases-hybrid-common:1.4.3" />
<source-file src="src/android/PurchasesPlugin.java" target-dir="src/com/revenuecat/purchases"/>
</platform>
<platform name="ios">
Expand All @@ -27,12 +27,13 @@
</config-file>
<header-file src="src/ios/CDVPurchasesPlugin.h" />
<source-file src="src/ios/CDVPurchasesPlugin.m" />
<source-file src="src/ios/PurchasesPlugin.swift" />
<podspec>
<config>
<source url="https://github.com/CocoaPods/Specs.git"/>
</config>
<pods use-frameworks="true">
<pod name="PurchasesHybridCommon" spec="1.2.0" />
<pod name="PurchasesHybridCommon" spec="1.4.3"/>
</pods>
</podspec>
</platform>
Expand Down
92 changes: 83 additions & 9 deletions src/android/PurchasesPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import com.appfeel.cordova.annotated.android.plugin.PluginAction;
import com.revenuecat.purchases.common.CommonKt;
import com.revenuecat.purchases.common.ErrorContainer;
import com.revenuecat.purchases.common.MappersKt;
import com.revenuecat.purchases.common.OnResult;
import com.revenuecat.purchases.common.OnResultList;
import com.revenuecat.purchases.common.PlatformInfo;
import com.revenuecat.purchases.common.SubscriberAttributesKt;
import com.revenuecat.purchases.common.mappers.PurchaserInfoMapperKt;
import com.revenuecat.purchases.interfaces.UpdatedPurchaserInfoListener;

import org.apache.cordova.CallbackContext;
Expand All @@ -30,7 +32,7 @@
public class PurchasesPlugin extends AnnotatedCordovaPlugin {

public static final String PLATFORM_NAME = "cordova";
public static final String PLUGIN_VERSION = "1.2.2";
public static final String PLUGIN_VERSION = "1.3.0";

@PluginAction(thread = ExecutionThread.MAIN, actionName = "setupPurchases", isAutofinish = false)
private void setupPurchases(String apiKey, @Nullable String appUserID, boolean observerMode,
Expand All @@ -40,7 +42,7 @@ private void setupPurchases(String apiKey, @Nullable String appUserID, boolean o
Purchases.getSharedInstance().setUpdatedPurchaserInfoListener(new UpdatedPurchaserInfoListener() {
@Override
public void onReceived(@NonNull PurchaserInfo purchaserInfo) {
PluginResult result = new PluginResult(PluginResult.Status.OK, convertMapToJson(MappersKt.map(purchaserInfo)));
PluginResult result = new PluginResult(PluginResult.Status.OK, convertMapToJson(PurchaserInfoMapperKt.map(purchaserInfo)));
result.setKeepCallback(true);
callbackContext.sendPluginResult(result);
}
Expand All @@ -59,7 +61,7 @@ public void setAllowSharingStoreAccount(boolean allowSharingStoreAccount, Callba
@PluginAction(thread = ExecutionThread.MAIN, actionName = "addAttributionData")
public void addAttributionData(JSONObject data, Integer network, @Nullable String networkUserId,
CallbackContext callbackContext) {
CommonKt.addAttributionData(data, network, networkUserId);
SubscriberAttributesKt.addAttributionData(data, network, networkUserId);
callbackContext.success();
}

Expand Down Expand Up @@ -213,31 +215,103 @@ public void setProxyURLString(String proxyURLString, CallbackContext callbackCon

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setAttributes")
private void setAttributes(JSONObject attributes, CallbackContext callbackContext) throws JSONException {
CommonKt.setAttributes(convertJsonToMap(attributes));
SubscriberAttributesKt.setAttributes(convertJsonToMap(attributes));
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setEmail")
private void setEmail(String email, CallbackContext callbackContext) {
CommonKt.setEmail(email);
SubscriberAttributesKt.setEmail(email);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setPhoneNumber")
private void setPhoneNumber(String phoneNumber, CallbackContext callbackContext) {
CommonKt.setPhoneNumber(phoneNumber);
SubscriberAttributesKt.setPhoneNumber(phoneNumber);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setDisplayName")
private void setDisplayName(String displayName, CallbackContext callbackContext) {
CommonKt.setDisplayName(displayName);
SubscriberAttributesKt.setDisplayName(displayName);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setPushToken")
private void setPushToken(String pushToken, CallbackContext callbackContext) {
CommonKt.setPushToken(pushToken);
SubscriberAttributesKt.setPushToken(pushToken);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setAdjustID")
private void setAdjustID(String adjustID, CallbackContext callbackContext) {
SubscriberAttributesKt.setAdjustID(adjustID);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setAppsflyerID")
private void setAppsflyerID(String appsflyerID, CallbackContext callbackContext) {
SubscriberAttributesKt.setAppsflyerID(appsflyerID);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setFBAnonymousID")
private void setFBAnonymousID(String fBAnonymousID, CallbackContext callbackContext) {
SubscriberAttributesKt.setFBAnonymousID(fBAnonymousID);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setMparticleID")
private void setMparticleID(String mparticleID, CallbackContext callbackContext) {
SubscriberAttributesKt.setMparticleID(mparticleID);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setOnesignalID")
private void setOnesignalID(String onesignalID, CallbackContext callbackContext) {
SubscriberAttributesKt.setOnesignalID(onesignalID);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setMediaSource")
private void setMediaSource(String mediaSource, CallbackContext callbackContext) {
SubscriberAttributesKt.setMediaSource(mediaSource);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setCampaign")
private void setCampaign(String campaign, CallbackContext callbackContext) {
SubscriberAttributesKt.setCampaign(campaign);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setAdGroup")
private void setAdGroup(String adGroup, CallbackContext callbackContext) {
SubscriberAttributesKt.setAdGroup(adGroup);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setAd")
private void setAd(String ad, CallbackContext callbackContext) {
SubscriberAttributesKt.setAd(ad);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setKeyword")
private void setKeyword(String keyword, CallbackContext callbackContext) {
SubscriberAttributesKt.setKeyword(keyword);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setCreative")
private void setCreative(String creative, CallbackContext callbackContext) {
SubscriberAttributesKt.setCreative(creative);
callbackContext.success();
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "collectDeviceIdentifiers")
private void collectDeviceIdentifiers(CallbackContext callbackContext) {
SubscriberAttributesKt.collectDeviceIdentifiers();
callbackContext.success();
}

Expand Down
13 changes: 12 additions & 1 deletion src/ios/CDVPurchasesPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,16 @@
- (void)setDisplayName:(CDVInvokedUrlCommand *)command;
- (void)setPushToken:(CDVInvokedUrlCommand *)command;
- (void)setProxyURLString:(CDVInvokedUrlCommand *)command;

- (void)setAdjustID:(CDVInvokedUrlCommand *)command;
- (void)setAppsflyerID:(CDVInvokedUrlCommand *)command;
- (void)setFBAnonymousID:(CDVInvokedUrlCommand *)command;
- (void)setMparticleID:(CDVInvokedUrlCommand *)command;
- (void)setOnesignalID:(CDVInvokedUrlCommand *)command;
- (void)setMediaSource:(CDVInvokedUrlCommand *)command;
- (void)setCampaign:(CDVInvokedUrlCommand *)command;
- (void)setAdGroup:(CDVInvokedUrlCommand *)command;
- (void)setAd:(CDVInvokedUrlCommand *)command;
- (void)setKeyword:(CDVInvokedUrlCommand *)command;
- (void)setCreative:(CDVInvokedUrlCommand *)command;
- (void)collectDeviceIdentifiers:(CDVInvokedUrlCommand *)command;
@end
73 changes: 72 additions & 1 deletion src/ios/CDVPurchasesPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,77 @@ - (void)setPushToken:(CDVInvokedUrlCommand *)command {
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setAdjustID:(CDVInvokedUrlCommand *)command {
NSString *adjustID = [command argumentAtIndex:0];
[RCCommonFunctionality setAdjustID:adjustID];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setAppsflyerID:(CDVInvokedUrlCommand *)command {
NSString *appsflyerID = [command argumentAtIndex:0];
[RCCommonFunctionality setAppsflyerID:appsflyerID];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setFBAnonymousID:(CDVInvokedUrlCommand *)command {
NSString *fbAnonymousID = [command argumentAtIndex:0];
[RCCommonFunctionality setFBAnonymousID:fbAnonymousID];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setMparticleID:(CDVInvokedUrlCommand *)command {
NSString *mparticleID = [command argumentAtIndex:0];
[RCCommonFunctionality setMparticleID:mparticleID];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setOnesignalID:(CDVInvokedUrlCommand *)command {
NSString *onesignalID = [command argumentAtIndex:0];
[RCCommonFunctionality setOnesignalID:onesignalID];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setMediaSource:(CDVInvokedUrlCommand *)command {
NSString *mediaSource = [command argumentAtIndex:0];
[RCCommonFunctionality setMediaSource:mediaSource];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setCampaign:(CDVInvokedUrlCommand *)command {
NSString *campaign = [command argumentAtIndex:0];
[RCCommonFunctionality setCampaign:campaign];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setAdGroup:(CDVInvokedUrlCommand *)command {
NSString *adGroup = [command argumentAtIndex:0];
[RCCommonFunctionality setAdGroup:adGroup];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setAd:(CDVInvokedUrlCommand *)command {
NSString *ad = [command argumentAtIndex:0];
[RCCommonFunctionality setAd:ad];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setKeyword:(CDVInvokedUrlCommand *)command {
NSString *keyword = [command argumentAtIndex:0];
[RCCommonFunctionality setKeyword:keyword];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)setCreative:(CDVInvokedUrlCommand *)command {
NSString *creative = [command argumentAtIndex:0];
[RCCommonFunctionality setCreative:creative];
[self sendOKForCommand:command messageAsArray:nil];
}

- (void)collectDeviceIdentifiers:(CDVInvokedUrlCommand *)command {
[RCCommonFunctionality collectDeviceIdentifiers];
[self sendOKForCommand:command messageAsArray:nil];
}

#pragma mark Delegate Methods

- (void)purchases:(RCPurchases *)purchases didReceiveUpdatedPurchaserInfo:(RCPurchaserInfo *)purchaserInfo
Expand Down Expand Up @@ -270,7 +341,7 @@ - (NSString *)platformFlavor {
}

- (NSString *)platformFlavorVersion {
return @"1.2.2";
return @"1.3.0";
}

@end
10 changes: 10 additions & 0 deletions src/ios/PurchasesPlugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// PurchasesPlugin.swift
// HelloCordova
//
// Created by Andrés Boedo on 9/23/20.
//
// This file is left intentionally blank,
// the code for the plugin lives in CDVPurchasesPlugin

import Foundation

0 comments on commit c803df6

Please sign in to comment.