Skip to content

Commit

Permalink
Merge pull request #16 from tenjin/dg/update-release-1.2.0
Browse files Browse the repository at this point in the history
Release 1.2.0
  • Loading branch information
giraldogdiego authored Jun 5, 2024
2 parents 49b2b51 + fea02be commit b59a07f
Show file tree
Hide file tree
Showing 14 changed files with 204 additions and 103 deletions.
7 changes: 6 additions & 1 deletion .idea/workspace.xml

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

22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ TenjinSDK.instance.optOutParams(optOutParams);
TenjinSDK.instance.connect();
```

### SetGoogleDMAParameters
If you already have a CMP integrated, Google DMA parameters will be automatically collected by the Tenjin SDK. There’s nothing to implement in the Tenjin SDK if you have a CMP integrated.
If you want to override your CMP, or simply want to build your own consent mechanisms, you can use the following:

```dart
TenjinSDK.instance.setGoogleDMAParameters(adPersonalization, adUserData);
```

To explicitly manage the collection of Google DMA parameters, you have the flexibility to opt in or opt out at any time. While the default setting is to opt in, you can easily adjust your preferences using the OptInGoogleDMA or OptOutGoogleDMA methods, ensuring full control over your data privacy settings:

```dart
TenjinSDK.instance.optOutGoogleDMA();
TenjinSDK.instance.optInGoogleDMA();
```

#### Device-Related Parameters

| Param | Description | Reference |
Expand Down Expand Up @@ -263,6 +278,13 @@ TenjinSDK.setCustomerUserId(userId)
TenjinSDK.getCustomerUserId()
```

### GetAnalyticsInstallationId
You can get the analytics id which is generated randomly and saved in the local storage of the device.

```dart
String? analyticsId = await TenjinSDK.instance.getAnalyticsInstallationId();
```

### Send AdMob impression (ILRD)
```
TenjinSDK.eventAdImpressionAdMob(json)
Expand Down
11 changes: 5 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
group 'com.tenjin_sdk'
version '1.1.0'
version '1.2.0'

buildscript {
ext.kotlin_version = '1.7.0'
ext.kotlin_version = '1.7.20'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 29
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -41,7 +41,6 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.android.installreferrer:installreferrer:1.1.2'
implementation 'com.android.installreferrer:installreferrer:2.2'
implementation 'com.tenjin:android-sdk:1.13.0'
implementation 'com.tenjin:android-sdk:1.16.4'
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
129 changes: 62 additions & 67 deletions android/src/main/kotlin/com/tenjin_sdk/TenjinSdkPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,74 +27,37 @@ class TenjinSdkPlugin: FlutterPlugin, MethodCallHandler {
}

override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
when (call.method) {
"init" -> {
init(call, result)
when (call.method) {
"init" -> init(call, result)
"optIn" -> optIn(call, result)
"optOut" -> optOut(call, result)
"optInParams" -> optInParams(call, result)
"optOutParams" -> optOutParams(call, result)
"optInOutUsingCMP" -> optInOutUsingCMP(call, result)
"optOutGoogleDMA" -> optOutGoogleDMA(call, result)
"optInGoogleDMA" -> optInGoogleDMA(call, result)
"connect" -> connect(call, result)
"transaction" -> transaction(call, result)
"transactionWithReceipt" -> transactionWithReceipt(call, result)
"eventWithName" -> eventWithName(call, result)
"eventWithNameAndValue" -> eventWithNameAndValue(call, result)
"appendAppSubversion" -> appendAppSubversion(call, result)
"requestTrackingAuthorization" -> result.success(true)
"registerAppForAdNetworkAttribution" -> result.success(null)
"getAttributionInfo" -> getAttributionInfo(call, result)
"setCustomerUserId" -> setCustomerUserId(call, result)
"getCustomerUserId" -> getCustomerUserId(call, result)
"setCacheEventSetting" -> setCacheEventSetting(call, result)
"getAnalyticsInstallationId" -> getAnalyticsInstallationId(call, result)
"setGoogleDMAParameters" -> setGoogleDMAParameters(call, result)
"eventAdImpressionAdMob" -> eventAdImpressionAdMob(call.arguments as HashMap<String, Any>)
"eventAdImpressionAppLovin" -> eventAdImpressionAppLovin(call.arguments as HashMap<String, Any>)
"eventAdImpressionHyperBid" -> eventAdImpressionHyperBid(call.arguments as HashMap<String, Any>)
"eventAdImpressionIronSource" -> eventAdImpressionIronSource(call.arguments as HashMap<String, Any>)
"eventAdImpressionTopOn" -> eventAdImpressionTopOn(call.arguments as HashMap<String, Any>)
"eventAdImpressionTradPlus" -> eventAdImpressionTradPlus(call.arguments as HashMap<String, Any>)
else -> result.notImplemented()
}
"optIn" -> {
optIn(call, result)
}
"optOut" -> {
optOut(call, result)
}
"optInParams" -> {
optInParams(call, result)
}
"optOutParams" -> {
optOutParams(call, result)
}
"connect" -> {
connect(call, result)
}
"transaction" -> {
transaction(call, result)
}
"transactionWithReceipt" -> {
transactionWithReceipt(call, result)
}
"eventWithName" -> {
eventWithName(call, result)
}
"eventWithNameAndValue" -> {
eventWithNameAndValue(call, result)
}
"appendAppSubversion" -> {
appendAppSubversion(call, result)
}
"requestTrackingAuthorization" -> {
result.success(true)
}
"registerAppForAdNetworkAttribution" -> {
result.success(null)
}
"getAttributionInfo" -> {
getAttributionInfo(call, result)
}
"setCustomerUserId" -> {
setCustomerUserId(call, result)
}
"getCustomerUserId" -> {
getCustomerUserId(call, result)
}
"eventAdImpressionAdMob" -> {
eventAdImpressionAdMob(call.arguments as HashMap<String, Any>)
}
"eventAdImpressionAppLovin" -> {
eventAdImpressionAppLovin(call.arguments as HashMap<String, Any>)
}
"eventAdImpressionHyperBid" -> {
eventAdImpressionHyperBid(call.arguments as HashMap<String, Any>)
}
"eventAdImpressionIronSource" -> {
eventAdImpressionIronSource(call.arguments as HashMap<String, Any>)
}
"eventAdImpressionTopOn" -> {
eventAdImpressionTopOn(call.arguments as HashMap<String, Any>)
}
else -> {
result.notImplemented()
}
}
}

override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
Expand Down Expand Up @@ -145,6 +108,29 @@ class TenjinSdkPlugin: FlutterPlugin, MethodCallHandler {
result.success(null)
}

fun optInOutUsingCMP(call: MethodCall, result: Result){
instance.optInOutUsingCMP()
result.success(null)
}

fun optOutGoogleDMA(call: MethodCall, result: Result){
instance.optOutGoogleDMA()
result.success(null)
}

fun optInGoogleDMA(call: MethodCall, result: Result){
instance.optInGoogleDMA()
result.success(null)
}

fun setGoogleDMAParameters(call: MethodCall, result: Result){
val args = call.arguments as Map<*, *>
val adPersonalization = args["adPersonalization"] as Boolean
val adUserData = args["adUserData"] as Boolean
instance.setGoogleDMAParameters(adPersonalization, adUserData)
result.success(null)
}

fun transaction(call: MethodCall, result: Result) {
val args = call.arguments as Map<*, *>
val productName = args["productName"] as String
Expand Down Expand Up @@ -224,6 +210,15 @@ class TenjinSdkPlugin: FlutterPlugin, MethodCallHandler {
}
}

private fun getAnalyticsInstallationId(call: MethodCall, result: Result) {
val installationId = instance.getAnalyticsInstallationId()
if (installationId != null) {
result.success(installationId)
} else {
result.error("Error", "Failed to get 'analyticsInstallationId'", null)
}
}

private fun eventAdImpressionAdMob(json: HashMap<String, Any>) {
try {
instance.eventAdImpressionAdMob((json as Map<*, *>?)?.let { JSONObject(it) })
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
14 changes: 7 additions & 7 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- Flutter (1.0.0)
- tenjin_plugin (1.0.0):
- tenjin_plugin (1.2.0):
- Flutter
- TenjinSDK (= 1.12.24)
- TenjinSDK (1.12.24)
- TenjinSDK (= 1.14.3)
- TenjinSDK (1.14.3)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -20,10 +20,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/tenjin_plugin/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
tenjin_plugin: 0083bdea1b01a67d2c2c57a7654ee30194d6a3d1
TenjinSDK: 8e00cb351cb4246be6dd9184ed5e7771405404a8
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
tenjin_plugin: fc917ad84a280b03ae923b334c5040b7a1f545d5
TenjinSDK: ece2612ebe7c02f3ca39712f0977c942f6f604ab

PODFILE CHECKSUM: a4cf1e90a0bed550dc9c304e9edb299c19ca8c24
PODFILE CHECKSUM: 474aef2fd64d1c4593bb373482aca73939061f74

COCOAPODS: 1.11.3
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Demonstrates how to use the tenjin_sdk plugin.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.12.0 <=3.0.3"
sdk: ">=2.12.0 <=3.4.1"

dependencies:
flutter:
Expand Down
24 changes: 21 additions & 3 deletions ios/Classes/TenjinSDK.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Created by Tenjin on 2016-05-20.
// Version 1.12.28
// Version 1.14.3

// Copyright (c) 2016 Tenjin. All rights reserved.
//
Expand Down Expand Up @@ -91,9 +91,13 @@ andDeferredDeeplink:(NSURL *)url
//use sendEventWithName for custom event names
+ (void)sendEventWithName:(NSString *)eventName;

//This method checks to make sure integers are passed as values.
//This method is deprecated in favor of [sendEventWithName: andValue:], so you can pass an integer directly
+ (void)sendEventWithName:(NSString *)eventName
andEventValue:(NSString *)eventValue;
andEventValue:(NSString *)eventValue __deprecated_msg("use `sendEventWithName: andValue:` instead");

//Use this method to send custom events with values
+ (void)sendEventWithName:(NSString *)eventName
andValue:(NSInteger)eventValue;

//This method is deprecated in favor of [transaction: andReceipt:], so Tenjin can verify your transactions
+ (void)transaction:(SKPaymentTransaction *)transaction __attribute__((deprecated));
Expand Down Expand Up @@ -142,6 +146,15 @@ andDeferredDeeplink:(NSURL *)url
// GDPR opt-in with list of params
+ (void)optInParams:(NSArray *)params;

// GDPR opt-in/opt-out through CMP consents
+ (bool)optInOutUsingCMP;

// Opt out from Google DMA parameters (opted in by default)
+ (void)optOutGoogleDMA;

// Opt out from Google DMA parameters
+ (void)optInGoogleDMA;

// Appends app subversion to app version
+ (void)appendAppSubversion:(NSNumber *)subversion;

Expand Down Expand Up @@ -172,6 +185,9 @@ andDeferredDeeplink:(NSURL *)url
// Set the setting to enable/disable cache events and retrying, it's false by default
+ (void)setCacheEventSetting:(BOOL)isCacheEventsEnabled;

// Get cached analytics_installation_id
+ (NSString*)getAnalyticsInstallationId;

#pragma mark Util

+ (void)verboseLogs;
Expand All @@ -194,6 +210,8 @@ andDeferredDeeplink:(NSURL *)url

- (void)getAttributionInfo:(void (^)(NSDictionary *attributionInfo, NSError *error))completionHandler;

- (void)setGoogleDMAParametersWithAdPersonalization:(BOOL)adPersonalization adUserData:(BOOL)adUserData;

@end

//
Expand Down
Loading

0 comments on commit b59a07f

Please sign in to comment.