Skip to content

Commit bb6d822

Browse files
authored
Merge pull request #105 from AppsFlyerSDK/dev/addedDisableSkadAPI
Added disable SKAD network API
2 parents 3d4c5cf + cac3348 commit bb6d822

File tree

6 files changed

+36
-4
lines changed

6 files changed

+36
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Versions
22

3+
## 6.2.4+2-nullsafety
4+
- Added disable SKAD API
5+
6+
## 6.2.4+1-nullsafety
7+
- Fix for SKAD
8+
39
## 6.2.4
410
- Update to iOS SDK v6.2.4
511

doc/API.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
- [setPushNotification](#setPushNotification)
3535
- [User Invite](#userInvite)
3636
- [enableFacebookDeferredApplinks](#enableFacebookDeferredApplinks)
37+
- [disableSKAdNetwork](#disableSKAdNetwork)
3738
- [stream](#streams)
3839
---
3940

@@ -452,6 +453,15 @@ _Example:_
452453
appsFlyerSdk.enableFacebookDeferredApplinks(true);
453454
```
454455
---
456+
**<a id="disableSKAdNetwork"> `void disableSKAdNetwork(bool isEnabled)`**
457+
458+
Use this API in order to disable the SK Ad network (request will be sent but the rules won't be returned).
459+
460+
_Example:_
461+
```dart
462+
appsFlyerSdk.disableSKAdNetwork(true);
463+
```
464+
---
455465
### **Conversion Data and on app open attribution for older versions**
456466
For plugin version `6.0.5+2` and below the user can access `conversionDataStream`, `appOpenAttributionStream` and `onDeepLinkingStream` to listen for events (see example app)
457467

example/lib/main_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class MainPageState extends State<MainPage> {
4444
_deepLinkData = res;
4545
});
4646
});
47-
47+
4848
}
4949

5050
@override

ios/Classes/AppsflyerSdkPlugin.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ @implementation AppsflyerSdkPlugin {
1414
static BOOL _udpCallback = false;
1515
static BOOL _isPushNotificationEnabled = false;
1616
static BOOL _isSandboxEnabled = false;
17+
static BOOL _isSKADEnabled = false;
1718

1819
+ (FlutterMethodChannel*)callbackChannel{
1920
return _callbackChannel;
@@ -118,12 +119,22 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
118119
[self useReceiptValidationSandbox:call result:result];
119120
}else if([@"enableFacebookDeferredApplinks" isEqualToString:call.method]){
120121
[self enableFacebookDeferredApplinks:call result:result];
122+
}else if([@"disableSKAdNetwork" isEqualToString:call.method]){
123+
[self disableSKAdNetwork:call result:result];
121124
}
122125
else{
123126
result(FlutterMethodNotImplemented);
124127
}
125128
}
126129

130+
- (void)disableSKAdNetwork:(FlutterMethodCall*)call result:(FlutterResult)result{
131+
bool isSKADEnabled = call.arguments;
132+
_isSKADEnabled = isSKADEnabled;
133+
[AppsFlyerLib shared].disableSKAdNetwork = _isSKADEnabled;
134+
135+
result(nil);
136+
}
137+
127138
- (void)useReceiptValidationSandbox:(FlutterMethodCall*)call result:(FlutterResult)result{
128139
bool isSandboxEnabled = call.arguments;
129140
_isSandboxEnabled = isSandboxEnabled;
@@ -445,6 +456,7 @@ - (void)initSdkWithCall:(FlutterMethodCall*)call result:(FlutterResult)result{
445456
[AppsFlyerLib shared].appleAppID = appId;
446457
[AppsFlyerLib shared].appsFlyerDevKey = devKey;
447458
[AppsFlyerLib shared].isDebug = isDebug;
459+
448460
// Load SKAD rules
449461
SEL SKSel = NSSelectorFromString(@"__willResolveSKRules:");
450462
id AppsFlyer = [AppsFlyerLib shared];

lib/src/appsflyer_sdk.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class AppsflyerSdk {
245245
} else if (afOptions != null) {
246246
validatedOptions = _validateAFOptions(afOptions!);
247247
}
248-
248+
249249
return _methodChannel.invokeMethod("initSdk", validatedOptions);
250250
});
251251
}
@@ -554,6 +554,10 @@ class AppsflyerSdk {
554554
_methodChannel.invokeMethod("enableFacebookDeferredApplinks", { 'isFacebookDeferredApplinksEnabled': isEnabled });
555555
}
556556

557+
void disableSKAdNetwork(bool isEnabled) {
558+
_methodChannel.invokeMethod("disableSKAdNetwork", isEnabled);
559+
}
560+
557561
void onInstallConversionData(Function callback) async {
558562
startListening(callback as void Function(dynamic), "onInstallConversionData");
559563
}

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: appsflyer_sdk
22
description: A Flutter plugin for AppsFlyer SDK. Supports iOS and Android.
3-
version: 6.2.4+1-nullsafety
3+
version: 6.2.4+2-nullsafety
44

55
homepage: https://github.com/AppsFlyerSDK/flutter_appsflyer_sdk
66

77
environment:
88
sdk: '>=2.12.0 <3.0.0'
9-
flutter: ">=1.10.0 <2.0.0"
9+
flutter: ">=1.10.0"
1010

1111
dependencies:
1212
flutter:

0 commit comments

Comments
 (0)