Skip to content

Commit

Permalink
Merge pull request #3 from tenjin/release-1.0.1
Browse files Browse the repository at this point in the history
Release 1.0.1
  • Loading branch information
giraldogdiego committed Mar 7, 2023
2 parents e2521ab + e1cdf94 commit 27dc680
Show file tree
Hide file tree
Showing 12 changed files with 200 additions and 5,286 deletions.
2 changes: 1 addition & 1 deletion IonicCapacitorTenjin.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Pod::Spec.new do |s|
s.static_framework = true
s.ios.deployment_target = '13.0'
s.dependency 'Capacitor'
s.dependency 'TenjinSDK', '1.12.21'
s.dependency 'TenjinSDK', '1.12.23'
s.swift_version = '5.1'
end
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,39 @@ Tenjin supports retrieving of attributes, which are required for developers to g

:warning: **NOTE: Attribution Info is a paid feature, so please contact your Tenjin account manager if you are interested in.**

### Customer User ID
```javascript
Tenjin.setCustomerUserId(userId)
```
Parameters:
- `userId`: string

```javascript
Tenjin.getCustomerUserId()
```
Returns: `string`

### Update SKAN Postback Conversion Value (iOS only)
```javascript
Tenjin.updatePostbackConversionValue(conversionValue)
```
Parameters:
- `conversionValue`: number

```javascript
Tenjin.updatePostbackConversionValueCoarseValue(conversionValue, coarseValue)
```
Parameters:
- `conversionValue`: number
- `coarseValue`: string

```javascript
Tenjin.updatePostbackConversionValueCoarseValueLockWindow(conversionValue, coarseValue, lockWindow)
```
Parameters:
- `conversionValue`: number
- `coarseValue`: string
- `lockWindow`: boolean

## Support
If you have any issues with the plugin integration or usage, please contact us to support@tenjin.com
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':capacitor-android')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation 'com.tenjin:android-sdk:1.12.19'
implementation 'com.tenjin:android-sdk:1.12.20'
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,12 @@ public void eventAdImpressionIronSource(JSONObject json) {
public void eventAdImpressionTopOn(JSONObject json) {
instance.eventAdImpressionTopOn(json);
}

public void setCustomerUserId(String userId) {
instance.setCustomerUserId(userId);
}

public String getCustomerUserId() {
return instance.getCustomerUserId();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.tenjin.plugins.capacitor;

import android.util.Log;

import com.getcapacitor.JSObject;
import com.getcapacitor.Plugin;
import com.getcapacitor.PluginCall;
Expand All @@ -17,30 +19,36 @@ public class TenjinPlugin extends Plugin {
@PluginMethod
public void initialize(PluginCall call) {
implementation.initialize(getContext(), call.getString("sdkKey"));
call.resolve();
}

@PluginMethod
public void connect(PluginCall call) {
implementation.connect();
call.resolve();
}

@PluginMethod
public void optIn(PluginCall call) {
implementation.optIn();
call.resolve();
}

@PluginMethod
public void optOut(PluginCall call) {
implementation.optOut();
call.resolve();
}

@PluginMethod
public void optInParams(PluginCall call) {
try {
String[] params = (String[]) call.getArray("params").toList().toArray();
implementation.optIn(params);
call.resolve();
} catch (JSONException e) {
e.printStackTrace();
call.reject(e.getLocalizedMessage());
}
}

Expand All @@ -49,8 +57,10 @@ public void optOutParams(PluginCall call) {
try {
String[] params = (String[]) call.getArray("params").toList().toArray();
implementation.optOut(params);
call.resolve();
} catch (JSONException e) {
e.printStackTrace();
call.reject(e.getLocalizedMessage());
}
}

Expand All @@ -62,21 +72,25 @@ public void transaction(PluginCall call) {
call.getInt("quantity"),
call.getDouble("unitPrice")
);
call.resolve();
}

@PluginMethod
public void eventWithName(PluginCall call) {
implementation.eventWithName(call.getString("name"));
call.resolve();
}

@PluginMethod
public void eventWithNameAndValue(PluginCall call) {
implementation.eventWithNameAndValue(call.getString("name"), call.getString("value"));
call.resolve();
}

@PluginMethod
public void appendAppSubversion(PluginCall call) {
implementation.appendAppSubversion(call.getInt("version"));
call.resolve();
}

@PluginMethod
Expand All @@ -87,32 +101,69 @@ public void getAttributionInfo(PluginCall call) {
call.resolve(attributionInfo);
} catch (JSONException e) {
e.printStackTrace();
call.reject(e.getLocalizedMessage());
}
});
}

@PluginMethod
public void eventAdImpressionAdMob(PluginCall call) {
implementation.eventAdImpressionAdMob(call.getObject("json"));
call.resolve();
}

@PluginMethod
public void eventAdImpressionAppLovin(PluginCall call) {
implementation.eventAdImpressionAppLovin(call.getObject("json"));
call.resolve();
}

@PluginMethod
public void eventAdImpressionHyperBid(PluginCall call) {
implementation.eventAdImpressionHyperBid(call.getObject("json"));
call.resolve();
}

@PluginMethod
public void eventAdImpressionIronSource(PluginCall call) {
implementation.eventAdImpressionIronSource(call.getObject("json"));
call.resolve();
}

@PluginMethod
public void eventAdImpressionTopOn(PluginCall call) {
implementation.eventAdImpressionTopOn(call.getObject("json"));
call.resolve();
}

@PluginMethod
public void setCustomerUserId(PluginCall call) {
implementation.setCustomerUserId(call.getString("userId"));
call.resolve();
}

@PluginMethod
public void getCustomerUserId(PluginCall call) {
JSObject data = new JSObject();
data.put("userId", implementation.getCustomerUserId());
call.resolve(data);
}

@PluginMethod
public void updatePostbackConversionValue(PluginCall call) {
Log.d("TENJIN","Method not available on Android");
call.resolve();
}

@PluginMethod
public void updatePostbackConversionValueCoarseValue(PluginCall call) {
Log.d("TENJIN","Method not available on Android");
call.resolve();
}

@PluginMethod
public void updatePostbackConversionValueCoarseValueLockWindow(PluginCall call) {
Log.d("TENJIN","Method not available on Android");
call.resolve();
}
}
8 changes: 8 additions & 0 deletions ios/Plugin/TenjinImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
- (void)hyperBidImpressionFromJSON:(NSString *)jsonString;
- (void)adMobImpressionFromJSON:(NSString *)jsonString;
- (void)ironSourceImpressionFromJSON:(NSString *)jsonString;
- (void)updatePostbackConversionValue:(int)conversionValue;
- (void)updatePostbackConversionValue:(int)conversionValue
coarseValue:(NSString*)coarseValue;
- (void)updatePostbackConversionValue:(int)conversionValue
coarseValue:(NSString*)coarseValue
lockWindow:(BOOL)lockWindow;
- (void)setCustomerUserId:(NSString *)userId;
- (NSString *)getCustomerUserId;

@end

25 changes: 25 additions & 0 deletions ios/Plugin/TenjinImplementation.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,30 @@ - (void)topOnImpressionFromJSON:(NSString *)jsonString
[TenjinSDK topOnImpressionFromJSON:jsonString];
}

- (void)updatePostbackConversionValue:(int)conversionValue
{
[TenjinSDK updatePostbackConversionValue:conversionValue];
}

- (void)updatePostbackConversionValue:(int)conversionValue coarseValue:(NSString *)coarseValue
{
[TenjinSDK updatePostbackConversionValue:conversionValue coarseValue:coarseValue];
}

- (void)updatePostbackConversionValue:(int)conversionValue coarseValue:(NSString *)coarseValue lockWindow:(BOOL)lockWindow
{
[TenjinSDK updatePostbackConversionValue:conversionValue coarseValue:coarseValue lockWindow:lockWindow];
}

- (void)setCustomerUserId:(NSString *)userId
{
[TenjinSDK setCustomerUserId:userId];
}

- (NSString *)getCustomerUserId
{
return [TenjinSDK getCustomerUserId];
}

@end

5 changes: 5 additions & 0 deletions ios/Plugin/TenjinPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@
CAP_PLUGIN_METHOD(eventAdImpressionHyperBid, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(eventAdImpressionIronSource, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(eventAdImpressionTopOn, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(updatePostbackConversionValue, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(updatePostbackConversionValueCoarseValue, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(updatePostbackConversionValueCoarseValueLockWindow, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(setCustomerUserId, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(getCustomerUserId, CAPPluginReturnPromise);
)
Loading

0 comments on commit 27dc680

Please sign in to comment.