Skip to content

Commit 3a59d1f

Browse files
author
Sergey Korney
committed
1.6.4
1 parent 44e2ace commit 3a59d1f

32 files changed

+456
-154
lines changed

README.md

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
| Package | Version |
44
|--------------------------|:-------------------------------------------------------:|
5-
| `affise_attribution_lib` | [`1.6.3`](https://github.com/affise/sdk-react/releases) |
5+
| `affise_attribution_lib` | [`1.6.4`](https://github.com/affise/sdk-react/releases) |
66

77
- [Affise Attribution Flutter Library](#affise-attribution-flutter-library)
88
- [Description](#description)
@@ -54,6 +54,8 @@
5454
- [Referrer keys](#referrer-keys)
5555
- [StoreKit Ad Network](#storekit-ad-network)
5656
- [SDK to SDK integrations](#sdk-to-sdk-integrations)
57+
- [Debug](#debug)
58+
- [Validate credentials](#validate-credentials)
5759

5860
# Description
5961

@@ -107,9 +109,9 @@ dependencies {
107109

108110
Add modules to iOS project
109111

110-
| Module | Version |
111-
|-----------------------|:--------:|
112-
| `AffiseModule/Status` | `1.6.12` |
112+
| Module | Version |
113+
|-----------------------|:------------------------------------------------------------------------------------:|
114+
| `AffiseModule/Status` | [`1.6.13`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) |
113115

114116
Example [example/ios/Podfile](example/ios/Podfile)
115117

@@ -118,8 +120,9 @@ target 'Runner' do
118120
# ...
119121
120122
# Affise Module
121-
pod 'AffiseModule/Status', `~> 1.6.12`
123+
pod 'AffiseModule/Status', `1.6.13`
122124
end
125+
```
123126

124127
### Initialize
125128

@@ -306,7 +309,7 @@ class Presenter {
306309
307310
AddToCartEvent(userData: "groceries")
308311
.addPredefinedObject(PredefinedObject.CONTENT, items)
309-
.send();
312+
.send(); // Send event
310313
}
311314
}
312315
```
@@ -632,12 +635,7 @@ Register deeplink callback right after Affise.init(..)
632635
void init() {
633636
Affise.init(..);
634637
Affise.registerDeeplinkCallback((uri) {
635-
String? screen = uri.queryParameters["screen"];
636-
if(screen == "special_offer") {
637-
// open special offer
638-
} else {
639-
// open another
640-
}
638+
// Handle deeplink
641639
});
642640
}
643641
```
@@ -906,3 +904,33 @@ AffiseAdRevenue(AffiseAdSource.ADMOB)
906904
.setPlacement("ImpressionData_Placement")
907905
.send();
908906
```
907+
908+
# Debug
909+
910+
## Validate credentials
911+
912+
> **Warning**
913+
> Debug methods WON'T work on Production
914+
915+
Validate your credentials by receiving `ValidationStatus` values:
916+
917+
- `VALID` - your credentials are valid
918+
- `INVALID_APP_ID` - your app id is not valid
919+
- `INVALID_SECRET_KEY` - your SDK secretKey is not valid
920+
- `PACKAGE_NAME_NOT_FOUND` - your application package name not found
921+
- `NOT_WORKING_ON_PRODUCTION` - you using debug method on production
922+
- `NETWORK_ERROR` - network or server not available (for example `Airoplane mode` is active)
923+
924+
```dart
925+
AffiseInitProperties properties = AffiseInitProperties(
926+
affiseAppId: "Your appId", //Change to your app id
927+
secretKey: "Your SDK secretKey", //Change to your SDK secretKey
928+
isProduction: false, //To enable debug methods set Production to false
929+
);
930+
931+
Affise.init(properties);
932+
933+
Affise.debug.validate((status) {
934+
// Handle validation status
935+
});
936+
```

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.17"
51+
implementation "com.affise:internal:1.6.18"
5252
}

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.17'
73-
implementation 'com.affise:module-network:1.6.17'
74-
implementation 'com.affise:module-phone:1.6.17'
75-
implementation "com.affise:module-status:1.6.17"
72+
implementation 'com.affise:module-advertising:1.6.18'
73+
implementation 'com.affise:module-network:1.6.18'
74+
implementation 'com.affise:module-phone:1.6.18'
75+
implementation "com.affise:module-status:1.6.18"
7676
}

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ target 'Runner' do
3434
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3535

3636
# Affise modules
37-
pod 'AffiseModule', '~> 1.6.12'
37+
pod 'AffiseModule', '1.6.13'
3838
end
3939

4040
post_install do |installer|

example/lib/affise/affise_api_widget.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ class _AffiseApiWidgetState extends State<AffiseApiWidget> {
4646
),
4747
ElevatedButton(
4848
onPressed: () {
49+
// Debug: Validate credentials https://github.com/affise/flutter-sdk#validate-credentials
50+
Affise.debug.validate((status) {
51+
setOutput("Validate: $status");
52+
});
53+
},
54+
child: const Text("Debug: Validate credentials"),
55+
),
56+
ElevatedButton(
57+
onPressed: () {
58+
// Deeplinks https://github.com/affise/flutter-sdk#deeplinks
4959
Affise.registerDeeplinkCallback((uri) {
5060
setOutput("Deeplink: $uri");
5161
});
@@ -54,6 +64,7 @@ class _AffiseApiWidgetState extends State<AffiseApiWidget> {
5464
),
5565
ElevatedButton(
5666
onPressed: () {
67+
// Get module state https://github.com/affise/flutter-sdk#get-module-state
5768
Affise.getStatus(AffiseModules.STATUS, (value) {
5869
setOutput("Status: ${value.toString()}");
5970
});
@@ -62,6 +73,7 @@ class _AffiseApiWidgetState extends State<AffiseApiWidget> {
6273
),
6374
ElevatedButton(
6475
onPressed: () {
76+
// Get referrer https://github.com/affise/flutter-sdk#get-referrer
6577
Affise.android.getReferrer((value) {
6678
setOutput("Referrer: $value");
6779
});
@@ -70,6 +82,7 @@ class _AffiseApiWidgetState extends State<AffiseApiWidget> {
7082
),
7183
ElevatedButton(
7284
onPressed: () {
85+
// Get referrer value https://github.com/affise/flutter-sdk#get-referrer-value
7386
Affise.android.getReferrerValue(ReferrerKey.CLICK_ID, (value) {
7487
setOutput("ReferrerValue: $value");
7588
});
@@ -78,6 +91,7 @@ class _AffiseApiWidgetState extends State<AffiseApiWidget> {
7891
),
7992
ElevatedButton(
8093
onPressed: () {
94+
// StoreKit Ad Network https://github.com/affise/flutter-sdk#storekit-ad-network
8195
Affise.ios.registerAppForAdNetworkAttribution((error) {
8296
setOutput("SKAd register: $error");
8397
});
@@ -86,6 +100,7 @@ class _AffiseApiWidgetState extends State<AffiseApiWidget> {
86100
),
87101
ElevatedButton(
88102
onPressed: () {
103+
// StoreKit Ad Network https://github.com/affise/flutter-sdk#storekit-ad-network
89104
Affise.ios.updatePostbackConversionValue(1, SKAdNetwork.CoarseConversionValue.medium, (error) {
90105
setOutput("SKAd update: $error");
91106
});
@@ -94,6 +109,7 @@ class _AffiseApiWidgetState extends State<AffiseApiWidget> {
94109
),
95110
ElevatedButton(
96111
onPressed: () {
112+
// Get providers https://github.com/affise/flutter-sdk#get-providers
97113
Affise.getProviders().then((data) {
98114
var key = ProviderType.AFFISE_APP_TOKEN;
99115
setOutput("Get Providers: $key = ${data[key]}");

example/lib/affise/affise_widget.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class _AffiseWidgetState extends State<AffiseWidget> {
4848
itemBuilder: (context, index) {
4949
return ElevatedButton(
5050
onPressed: () {
51+
// Events tracking https://github.com/affise/flutter-sdk#events-tracking
5152
// Send event
5253
items[index].send();
5354
// or

example/lib/main.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:affise_attribution_lib/affise.dart';
2+
import 'package:flutter/foundation.dart';
23
import 'package:flutter/material.dart';
34

45
import 'affise/affise_api_widget.dart';
@@ -30,16 +31,29 @@ class _MyAppState extends State<MyApp> {
3031
}
3132

3233
void initAffise() async {
34+
// Initialize https://github.com/affise/flutter-sdk#initialize
3335
AffiseInitProperties properties = AffiseInitProperties(
3436
affiseAppId: "129", //Change to your app id
3537
secretKey: "93a40b54-6f12-443f-a250-ebf67c5ee4d2", //Change to your SDK key
38+
isProduction: false, //To enable debug methods set Production to false
3639
);
3740

3841
Affise.init(properties);
42+
43+
// Deeplinks https://github.com/affise/flutter-sdk#deeplinks
3944
Affise.registerDeeplinkCallback((uri) {
4045
setOutput("Deeplink: $uri");
4146
});
4247

48+
// Debug: network request/response
49+
Affise.debug.network((request, response) {
50+
if (kDebugMode) {
51+
print("Affise: $request");
52+
print("Affise: $response");
53+
}
54+
});
55+
56+
// SDK to SDK integrations https://github.com/affise/flutter-sdk#sdk-to-sdk-integrations
4357
// AffiseAdRevenue(AffiseAdSource.ADMOB)
4458
// .setRevenue(2.5, "USD")
4559
// .setNetwork("network")

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
path: ".."
88
relative: true
99
source: path
10-
version: "1.6.3"
10+
version: "1.6.4"
1111
async:
1212
dependency: transitive
1313
description:

ios/affise_attribution_lib.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ Affise Attribution Flutter plugin.
2121
s.swift_version = '5.0'
2222

2323
s.dependency 'Flutter'
24-
s.dependency 'AffiseInternal', '~> 1.6.12'
24+
s.dependency 'AffiseInternal', '1.6.13'
2525

2626
end

lib/ad/export.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export 'affise_ad_revenue.dart';
2+
export 'affise_ad_source.dart';

lib/affise.dart

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,10 @@
11
import 'package:flutter/scheduler.dart';
22

3-
import 'affise_init_properties.dart';
4-
import 'deeplink/on_deeplink_callback.dart';
5-
import 'events/auto_catching_type.dart';
6-
import 'events/event.dart';
7-
import 'module/affise_modules.dart';
8-
import 'module/on_key_value_callback.dart';
93
import 'native_api_interface.dart';
10-
import 'parameters/provider_type.dart';
11-
import 'referrer/referrer_callback.dart';
12-
import 'referrer/referrer_key.dart';
13-
import 'callback/error_callback.dart';
144
import 'native/affise_native.dart';
15-
import 'skad/coarse_value.dart';
16-
17-
export 'affise_init_properties.dart';
18-
export 'ad/affise_ad_revenue.dart';
19-
export 'ad/affise_ad_source.dart';
20-
export 'events/event.dart';
21-
export 'events/events.dart';
22-
export 'events/subscription_events.dart';
23-
export 'referrer/referrer_key.dart';
24-
export 'module/affise_modules.dart';
25-
export 'module/affise_key_value.dart';
26-
export 'skad/skad_network.dart';
27-
export 'parameters/provider_type.dart';
5+
import 'export.dart';
286

7+
export 'export.dart';
298

309
class Affise {
3110
static final AffiseNative _native = AffiseNative();
@@ -150,6 +129,7 @@ class Affise {
150129

151130
static AffiseAndroidApi android = _AffiseAndroid(_native);
152131
static AffiseIOSApi ios = _AffiseIOS(_native);
132+
static AffiseDebug debug = _AffiseDebug(_native);
153133
}
154134

155135
class _AffiseAndroid implements AffiseAndroidApi {
@@ -207,3 +187,25 @@ class _AffiseIOS implements AffiseIOSApi {
207187
});
208188
}
209189
}
190+
191+
class _AffiseDebug implements AffiseDebug {
192+
AffiseNative? native;
193+
194+
_AffiseDebug(this.native);
195+
196+
/// SKAd registerAppForAdNetworkAttribution
197+
@override
198+
void validate(DebugOnValidateCallback callback) {
199+
SchedulerBinding.instance.addPostFrameCallback((_) {
200+
native?.validate(callback);
201+
});
202+
}
203+
204+
/// SKAd updatePostbackConversionValue
205+
@override
206+
void network(DebugOnNetworkCallback callback) {
207+
SchedulerBinding.instance.addPostFrameCallback((_) {
208+
native?.network(callback);
209+
});
210+
}
211+
}

lib/debug/export.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export 'network/debug_on_network_callback.dart';
2+
3+
export 'validate/debug_on_validate_callback.dart';
4+
export 'validate/validation_status.dart';
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import '../../network/http_request.dart';
2+
import '../../network/http_response.dart';
3+
4+
typedef DebugOnNetworkCallback = void Function(HttpRequest request, HttpResponse response);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import 'validation_status.dart';
2+
3+
typedef DebugOnValidateCallback = void Function(ValidationStatus status);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
enum ValidationStatus {
2+
VALID,
3+
INVALID_APP_ID,
4+
INVALID_SECRET_KEY,
5+
PACKAGE_NAME_NOT_FOUND,
6+
NOT_WORKING_ON_PRODUCTION,
7+
NETWORK_ERROR,
8+
UNKNOWN_ERROR,
9+
}
10+
11+
extension ValidationStatusExt on ValidationStatus {
12+
String get status {
13+
switch (this) {
14+
case ValidationStatus.VALID:
15+
return "valid";
16+
case ValidationStatus.INVALID_APP_ID:
17+
return "invalid_app_id";
18+
case ValidationStatus.INVALID_SECRET_KEY:
19+
return "invalid_secret_key";
20+
case ValidationStatus.PACKAGE_NAME_NOT_FOUND:
21+
return "package_name_not_found";
22+
case ValidationStatus.NOT_WORKING_ON_PRODUCTION:
23+
return "not_working_on_production";
24+
case ValidationStatus.NETWORK_ERROR:
25+
return "network_error";
26+
case ValidationStatus.UNKNOWN_ERROR:
27+
return "unknown_error";
28+
}
29+
}
30+
}
31+
32+
ValidationStatus? validationStatusFrom(String? name) {
33+
if (name == null) return null;
34+
return ValidationStatus.values.firstWhere((e) => e.status == name);
35+
}

lib/events/event.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ abstract class Event {
7878
}
7979

8080
/// Add predefined [parameter] with [value] of List<PredefinedGroup> to event
81-
// TODO addPredefinedListGroup
81+
// addPredefinedListGroup
8282
// Event addPredefinedListGroup(List<PredefinedGroup> value) {
8383
// if (!_predefinedParameters.containsKey(PredefinedGroup.NAME)) {
8484
// _predefinedParameters[PredefinedGroup.NAME] = <Map<String, dynamic>>[];

0 commit comments

Comments
 (0)