Skip to content

Commit 4e45b51

Browse files
author
Sergey Korney
committed
1.6.1
1 parent d66554c commit 4e45b51

File tree

21 files changed

+345
-202
lines changed

21 files changed

+345
-202
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ migrate_working_dir/
2828
.dart_tool/
2929
.packages
3030
build/
31+
Podfile.lock

README.md

Lines changed: 78 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# Affise Attribution Flutter Library
22

3+
| Package | Version |
4+
|--------------------------|:-------:|
5+
| `affise_attribution_lib` | [`1.6.1`](https://github.com/affise/sdk-react/releases) |
6+
37
- [Affise Attribution Flutter Library](#affise-attribution-flutter-library)
48
- [Description](#description)
59
- [Quick start](#quick-start)
610
- [Integration](#integration)
711
- [Integrate as dependency](#integrate-as-dependency)
812
- [Add platform modules](#add-platform-modules)
913
- [Android](#android)
14+
- [iOS](#ios)
1015
- [Initialize](#initialize)
1116
- [Requirements](#requirements)
1217
- [Android](#android-1)
@@ -30,15 +35,15 @@
3035
- [APK preinstall tracking](#apk-preinstall-tracking)
3136
- [Deeplinks](#deeplinks)
3237
- [Android](#android-2)
33-
- [iOS](#ios)
38+
- [iOS](#ios-1)
3439
- [Offline mode](#offline-mode)
3540
- [Disable tracking](#disable-tracking)
3641
- [Disable background tracking](#disable-background-tracking)
37-
- [GDPR right to be forgotten](#gdpr-right-to-be-forgotten)
3842
- [Get random user Id](#get-random-user-id)
3943
- [Get random device Id](#get-random-device-id)
4044
- [Get module state](#get-module-state)
4145
- [Platform specific](#platform-specific)
46+
- [GDPR right to be forgotten](#gdpr-right-to-be-forgotten)
4247
- [Get referrer](#get-referrer)
4348
- [Get referrer value](#get-referrer-value)
4449
- [Referrer keys](#referrer-keys)
@@ -73,23 +78,48 @@ dependencies:
7378
7479
Add modules to android project
7580
81+
| Module | Version |
82+
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
83+
| `module-advertising` | [![module-advertising](https://img.shields.io/maven-central/v/com.affise/module-advertising?label=latest)](https://mvnrepository.com/artifact/com.affise/module-advertising) |
84+
| `module-network` | [![module-network](https://img.shields.io/maven-central/v/com.affise/module-network?label=latest)](https://mvnrepository.com/artifact/com.affise/module-network) |
85+
| `module-phone` | [![module-phone](https://img.shields.io/maven-central/v/com.affise/module-phone?label=latest)](https://mvnrepository.com/artifact/com.affise/module-phone) |
86+
| `module-status` | [![module-status](https://img.shields.io/maven-central/v/com.affise/module-status?label=latest)](https://mvnrepository.com/artifact/com.affise/module-status)
87+
7688
Example [`example/android/app/build.gradle`](example/android/app/build.gradle)
7789

7890
```gradle
7991
dependencies {
8092
// Affise modules
81-
implementation 'com.affise:module-advertising:1.6.7'
82-
implementation 'com.affise:module-network:1.6.7'
83-
implementation 'com.affise:module-phone:1.6.7'
84-
implementation 'com.affise:module-status:1.6.7'
93+
implementation 'com.affise:module-advertising:1.6.+'
94+
implementation 'com.affise:module-network:1.6.+'
95+
implementation 'com.affise:module-phone:1.6.+'
96+
implementation 'com.affise:module-status:1.6.+'
8597
}
8698
```
8799

100+
#### iOS
101+
102+
Add modules to iOS project
103+
104+
| Module | Version |
105+
|-----------------------|:-------:|
106+
| `AffiseModule/Status` | `1.6.9` |
107+
108+
Example [example/ios/Podfile](example/ios/Podfile)
109+
110+
```ruby
111+
target 'Runner' do
112+
# ...
113+
114+
# Affise Module
115+
pod 'AffiseModule/Status', `~> 1.6.9`
116+
end
117+
88118
### Initialize
89119

90120
After dependency is added, sync project with `flutter pub get` and initialize.
91121

92-
> Demo app [main.dart](example/lib/main.dart)
122+
> Demo app [`main.dart`](example/lib/main.dart)
93123

94124
```dart
95125
import 'package:flutter/foundation.dart';
@@ -110,6 +140,12 @@ class _MyAppState extends State<MyApp> {
110140
}
111141
```
112142

143+
Check if library is initialized
144+
145+
```dart
146+
Affise.isInitialized();
147+
```
148+
113149
### Requirements
114150

115151
#### Android
@@ -350,8 +386,9 @@ class Presenter {
350386
timeStampMillis: DateTime.now().millisecondsSinceEpoch,
351387
);
352388
353-
event.addPredefinedString(PredefinedString.DESCRIPTION, "best before 2029");
354-
event.addPredefinedObject(PredefinedObject.CONTENT, items);
389+
event
390+
.addPredefinedString(PredefinedString.DESCRIPTION, "best before 2029")
391+
.addPredefinedObject(PredefinedObject.CONTENT, items);
355392
356393
Affise.sendEvent(event);
357394
}
@@ -375,12 +412,16 @@ In examples above `PredefinedParameters.DESCRIPTION` and `PredefinedObject.CONTE
375412
- `ADREV_AD_TYPE`
376413
- `BRAND`
377414
- `BRICK`
415+
- `CAMPAIGN_ID`
378416
- `CATALOGUE_ID`
379417
- `CHANNEL_TYPE`
380418
- `CITY`
381419
- `CLASS`
420+
- `CLICK_ID`
382421
- `CONTENT_ID`
422+
- `CONTENT_NAME`
383423
- `CONTENT_TYPE`
424+
- `CONVERSION_ID`
384425
- `COUNTRY`
385426
- `COUPON_CODE`
386427
- `CURRENCY`
@@ -392,6 +433,7 @@ In examples above `PredefinedParameters.DESCRIPTION` and `PredefinedObject.CONTE
392433
- `DESTINATION_A`
393434
- `DESTINATION_B`
394435
- `DESTINATION_LIST`
436+
- `EVENT_NAME`
395437
- `NEW_VERSION`
396438
- `OLD_VERSION`
397439
- `ORDER_ID`
@@ -406,7 +448,10 @@ In examples above `PredefinedParameters.DESCRIPTION` and `PredefinedObject.CONTE
406448
- `PARAM_09`
407449
- `PARAM_10`
408450
- `PAYMENT_INFO_AVAILABLE`
451+
- `PID`
409452
- `PREFERRED_NEIGHBORHOODS`
453+
- `PRODUCT_ID`
454+
- `PRODUCT_NAME`
410455
- `PURCHASE_CURRENCY`
411456
- `RECEIPT_ID`
412457
- `REGION`
@@ -587,7 +632,7 @@ To integrate deeplink support in iOS you need:
587632

588633
Add key `CFBundleURLTypes` to `Info.plist`
589634

590-
Example: `example/ios/Runner/Info.plist`
635+
Example: [`example/ios/Runner/Info.plist`](example/ios/Runner/Info.plist)
591636

592637
```xml
593638
<key>CFBundleURLTypes</key>
@@ -663,53 +708,49 @@ To check current status of background tracking call:
663708
Affise.isBackgroundTrackingEnabled(); // returns true or false describing current background tracking state
664709
```
665710

666-
## GDPR right to be forgotten
667-
668-
Under the EU's General Data Protection Regulation (GDPR): An individual has the right to have their personal data erased.
669-
To provide this functionality to user, as the app developer, you can call
711+
## Get random user Id
670712

671713
```dart
672-
Affise.init(..);
673-
Affise.forget(); // to forget users data
714+
Affise.getRandomUserId();
674715
```
675716

676-
After processing such request our backend servers will delete all users data.
677-
To prevent library from generating new events, disable tracking just before calling Affise.forget:
717+
## Get random device Id
678718

679719
```dart
680-
Affise.init(..);
681-
Affise.setTrackingEnabled(false);
682-
Affise.forget(); // to forget users data
720+
Affise.getRandomDeviceId();
683721
```
684722

685-
## Get random user Id
686-
687-
Use the next public method of SDK
723+
## Get module state
688724

689725
```dart
690-
Affise.GetRandomUserId();
726+
Affise.getStatus(AffiseModules.STATUS, (response) {
727+
// handle status response
728+
});
691729
```
692730

693-
## Get random device Id
731+
## Platform specific
694732

695-
Use the next public method of SDK
733+
### GDPR right to be forgotten
734+
735+
> `Android Only`
736+
737+
Under the EU's General Data Protection Regulation (GDPR): An individual has the right to have their personal data erased.
738+
To provide this functionality to user, as the app developer, you can call
696739

697740
```dart
698-
Affise.GetRandomDeviceId();
741+
Affise.init(..);
742+
Affise.android.forget(); // to forget users data
699743
```
700744

701-
## Get module state
702-
703-
> Implemented for `Android`
745+
After processing such request our backend servers will delete all users data.
746+
To prevent library from generating new events, disable tracking just before calling Affise.forget:
704747

705748
```dart
706-
Affise.GetStatus(AffiseModules.STATUS, (response) {
707-
// handle response
708-
});
749+
Affise.init(..);
750+
Affise.setTrackingEnabled(false);
751+
Affise.android.forget(); // to forget users data
709752
```
710753

711-
## Platform specific
712-
713754
### Get referrer
714755

715756
> `Android Only`
@@ -795,7 +836,7 @@ Configure your app to send postback copies to Affise:
795836
Add key `NSAdvertisingAttributionReportEndpoint` to `Info.plist`
796837
Set key value to `https://affise-skadnetwork.com/`
797838

798-
Example: `example/ios/Runner/Info.plist`
839+
Example: [`example/ios/Runner/Info.plist`](example/ios/Runner/Info.plist)
799840

800841
```xml
801842
<key>CFBundleURLTypes</key>

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ android {
4848

4949
dependencies {
5050
implementation "com.android.installreferrer:installreferrer:2.2"
51-
implementation "com.affise:internal:1.6.7"
51+
implementation "com.affise:internal:1.6.13"
5252
}

android/src/main/kotlin/com/affise/attribution/affise_attribution_lib/AffiseAttributionLibPlugin.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import android.os.Handler
77
import android.os.Looper
88
import com.affise.attribution.internal.AffiseApiMethod
99
import com.affise.attribution.internal.AffiseApiWrapper
10-
import com.affise.attribution.internal.utils.JSONObjectExtKt
1110
import io.flutter.embedding.engine.plugins.FlutterPlugin
1211
import io.flutter.embedding.engine.plugins.activity.ActivityAware
1312
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
@@ -16,7 +15,6 @@ import io.flutter.plugin.common.MethodChannel
1615
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
1716
import io.flutter.plugin.common.MethodChannel.Result
1817
import io.flutter.plugin.common.PluginRegistry
19-
import org.json.JSONObject
2018

2119

2220
/** AffiseAttributionPlugin */
@@ -40,8 +38,7 @@ class AffiseAttributionLibPlugin :
4038

4139
apiWrapper = AffiseApiWrapper(flutterPluginBinding.applicationContext as? Application)
4240
apiWrapper?.flutter()
43-
apiWrapper?.setCallback { name, data ->
44-
val map = JSONObjectExtKt.toMap(JSONObject(data ?: "{}"))
41+
apiWrapper?.setCallback { name, map ->
4542
handler.post {
4643
channel?.invokeMethod(name, map)
4744
}

example/android/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ dependencies {
6969
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
7070

7171
// Affise modules
72-
implementation 'com.affise:module-advertising:1.6.7'
73-
implementation 'com.affise:module-network:1.6.7'
74-
implementation 'com.affise:module-phone:1.6.7'
75-
// implementation "com.affise:module-status:1.6.7"
72+
implementation 'com.affise:module-advertising:1.6.13'
73+
implementation 'com.affise:module-network:1.6.13'
74+
implementation 'com.affise:module-phone:1.6.13'
75+
implementation "com.affise:module-status:1.6.13"
7676
}

example/ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ target 'Runner' do
3232
use_modular_headers!
3333

3434
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
36+
# Affise modules
37+
pod 'AffiseModule', '~> 1.6.9'
3538
end
3639

3740
post_install do |installer|

example/ios/Podfile.lock

Lines changed: 0 additions & 33 deletions
This file was deleted.

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
files = (
205205
);
206206
inputPaths = (
207+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
207208
);
208209
name = "Thin Binary";
209210
outputPaths = (

0 commit comments

Comments
 (0)