Skip to content

Commit 57c92fa

Browse files
[SDK-2252] Expose the setDMAParamsForEEA method (#138)
* Added setDMAParamsForEEA() and bumped native SDKs * Update BranchService.swift * Update Plugin.swift * Updated android implementation * Updated changelog and package version * updated web.ts * Updated iOS SDK to 3.2.0 * Added checks
1 parent f7b9ca7 commit 57c92fa

File tree

10 files changed

+59
-6
lines changed

10 files changed

+59
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Branch Capacitor SDK change log
22

3+
- 7.1.0
4+
5+
- Added new method, setDMAParamsForEEA(), for setting DMA compliance parameters.
6+
- Branch Android SDK bumped to 5.9.0
7+
- Branch iOS SDK bumped to 3.2.0
8+
39
- 7.0.0
410

511
- Branch Android SDK bumped to 5.7.5

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ dependencies {
6666
implementation project(':capacitor-android')
6767
implementation 'androidx.annotation:annotation:1.4.0'
6868
implementation 'androidx.appcompat:appcompat:1.5.0'
69-
api 'io.branch.sdk.android:library:5.7.5'
69+
api 'io.branch.sdk.android:library:5.9.0'
7070
testImplementation "junit:junit:$junitVersion"
7171
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
7272
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"

android/src/main/java/co/boundstate/BranchDeepLinks.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,4 +532,21 @@ public void getFirstReferringParams(PluginCall call) {
532532
ret.put("referringParams", Branch.getInstance().getFirstReferringParams());
533533
call.resolve(ret);
534534
}
535+
536+
@PluginMethod
537+
public void setDMAParamsForEEA(PluginCall call) {
538+
Boolean eeaRegion = call.getBoolean("eeaRegion");
539+
Boolean adPersonalizationConsent = call.getBoolean("adPersonalizationConsent");
540+
Boolean adUserDataUsageConsent = call.getBoolean("adUserDataUsageConsent");
541+
542+
if (eeaRegion == null || adPersonalizationConsent == null || adUserDataUsageConsent == null) {
543+
call.reject("Must provide valid eeaRegion, adPersonalizationConsent, and adUserDataUsageConsent");
544+
return;
545+
}
546+
547+
Branch branch = Branch.getInstance();
548+
branch.setDMAParamsForEEA(eeaRegion, adPersonalizationConsent, adUserDataUsageConsent);
549+
550+
call.resolve();
551+
}
535552
}

ios/Plugin/BranchService.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,8 @@ class BranchService {
5757
let params = Branch.getInstance().getFirstReferringParams() ?? [:]
5858
completion(params)
5959
}
60+
61+
func setDMAParamsForEEA(eeaRegion: Bool, adPersonalizationConsent: Bool, adUserDataUsageConsent: Bool) -> Void {
62+
Branch.setDMAParamsForEEA(eeaRegion, adPersonalizationConsent: adPersonalizationConsent, adUserDataUsageConsent: adUserDataUsageConsent)
63+
}
6064
}

ios/Plugin/Plugin.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
CAP_PLUGIN_METHOD(getBranchQRCode, CAPPluginReturnPromise);
1616
CAP_PLUGIN_METHOD(getLatestReferringParams, CAPPluginReturnPromise);
1717
CAP_PLUGIN_METHOD(getFirstReferringParams, CAPPluginReturnPromise);
18+
CAP_PLUGIN_METHOD(setDMAParamsForEEA, CAPPluginReturnPromise);
1819
)

ios/Plugin/Plugin.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ public class BranchDeepLinks: CAPPlugin {
8787

8888
let buo = BranchUniversalObject.init()
8989
DispatchQueue.main.async {
90-
buo.showShareSheet(with: linkProperties, andShareText: shareText, from: self.bridge?.viewController, completion: nil)
90+
buo.showShareSheet(with: linkProperties, andShareText: shareText, from: self.bridge?.viewController)
9191
}
9292

93-
call.success()
93+
call.resolve()
9494
}
9595

9696
@objc func getStandardEvents(_ call: CAPPluginCall) {
@@ -165,7 +165,7 @@ public class BranchDeepLinks: CAPPlugin {
165165
}
166166

167167
event.logEvent()
168-
call.success()
168+
call.resolve()
169169
}
170170

171171
@objc func disableTracking(_ call: CAPPluginCall) {
@@ -329,4 +329,15 @@ public class BranchDeepLinks: CAPPlugin {
329329
])
330330
}
331331
}
332+
333+
@objc func setDMAParamsForEEA(_ call: CAPPluginCall) {
334+
335+
guard let eeaRegion = call.getBool("eeaRegion"), let adPersonalizationConsent = call.getBool("adPersonalizationConsent"), let adUserDataUsageConsent = call.getBool("adUserDataUsageConsent") else {
336+
call.reject("One or more DMA parameters are missing")
337+
return
338+
}
339+
340+
branchService.setDMAParamsForEEA(eeaRegion: eeaRegion, adPersonalizationConsent: adPersonalizationConsent, adUserDataUsageConsent: adUserDataUsageConsent)
341+
call.resolve()
342+
}
332343
}

ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def capacitor_pods
44
use_frameworks!
55
pod 'Capacitor', :path => '../node_modules/@capacitor/ios'
66
pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios'
7-
pod 'BranchSDK', '~> 3.0.1'
7+
pod 'BranchSDK', '~> 3.2.0'
88
end
99

1010
target 'Plugin' do

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "capacitor-branch-deep-links",
3-
"version": "7.0.0",
3+
"version": "7.1.0",
44
"description": "Capacitor plugin for Branch.io deep links",
55
"main": "dist/plugin.cjs.js",
66
"module": "dist/esm/index.js",

src/definitions.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ export interface BranchQRCodeResponse {
7575
qrCode: String;
7676
}
7777

78+
export interface BranchDMAParams {
79+
eeaRegion: boolean;
80+
adPersonalizationConsent: boolean;
81+
adUserDataUsageConsent: boolean;
82+
}
83+
7884
export interface BranchInitEvent extends BranchReferringParamsResponse {}
7985

8086
export type BranchATTAuthorizationStatus = 0 | 1 | 2 | 3;
@@ -111,4 +117,5 @@ export interface BranchDeepLinksPlugin {
111117
getBranchQRCode(options: BranchQRCodeParams): Promise<BranchQRCodeResponse>;
112118
getLatestReferringParams(): Promise<BranchReferringParamsResponse>;
113119
getFirstReferringParams(): Promise<BranchReferringParamsResponse>;
120+
setDMAParamsForEEA: (options: BranchDMAParams) => void;
114121
}

src/web.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
BranchTrackingResponse,
1212
BranchQRCodeParams,
1313
BranchQRCodeResponse,
14+
BranchDMAParams,
1415
} from './definitions';
1516

1617
export class BranchDeepLinksWeb
@@ -100,4 +101,10 @@ export class BranchDeepLinksWeb
100101
new Error('BranchDeepLinks does not have web implementation'),
101102
);
102103
}
104+
105+
setDMAParamsForEEA(_: BranchDMAParams): Promise<void> {
106+
return Promise.reject(
107+
new Error('BranchDeepLinks does not have web implementation'),
108+
);
109+
}
103110
}

0 commit comments

Comments
 (0)