Skip to content

Commit 977bce7

Browse files
authored
Merge pull request #158 from adjust/v510
Version 5.1.0
2 parents 085b89f + 3da6a8b commit 977bce7

File tree

12 files changed

+88
-32
lines changed

12 files changed

+88
-32
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
### Version 5.1.0 (25th February 2025)
2+
#### Added
3+
- Added `jsonResponse` field (JSON string) to `AdjustAttribution` where every key-value pair sent by the backend as part of the attribution response can be found.
4+
5+
#### Native SDKs
6+
- [iOS@v5.1.1][ios_sdk_v5.1.1]
7+
- [Android@v5.1.0][android_sdk_v5.1.0]
8+
9+
---
10+
111
### Version 5.0.4 (6th February 2025)
212
#### Added
313
- Added sending of the additional parameter to improve troubleshooting of `SKAdNetwork` related issues.
@@ -515,7 +525,7 @@ In case you were using beta version of the SDK v5, please switch to the official
515525
[ios_sdk_v4.38.4]: https://github.com/adjust/ios_sdk/tree/v4.38.4
516526
[ios_sdk_v5.0.0]: https://github.com/adjust/ios_sdk/tree/v5.0.0
517527
[ios_sdk_v5.0.1]: https://github.com/adjust/ios_sdk/tree/v5.0.1
518-
[ios_sdk_v5.1.0]: https://github.com/adjust/ios_sdk/tree/v5.1.0
528+
[ios_sdk_v5.1.1]: https://github.com/adjust/ios_sdk/tree/v5.1.1
519529

520530
[android_sdk_v4.17.0]: https://github.com/adjust/android_sdk/tree/v4.17.0
521531
[android_sdk_v4.18.0]: https://github.com/adjust/android_sdk/tree/v4.18.0

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.4
1+
5.1.0

android/src/main/java/com/adjust/sdk/flutter/AdjustSdk.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ public void onAttributionChanged(AdjustAttribution adjustAttribution) {
423423
adjustAttribution.costAmount.toString() : "");
424424
adjustAttributionMap.put("costCurrency", adjustAttribution.costCurrency);
425425
adjustAttributionMap.put("fbInstallReferrer", adjustAttribution.fbInstallReferrer);
426+
adjustAttributionMap.put("jsonResponse", adjustAttribution.jsonResponse);
426427
if (channel != null) {
427428
channel.invokeMethod(dartMethodName, adjustAttributionMap);
428429
}
@@ -734,6 +735,7 @@ public void onAttributionRead(AdjustAttribution attribution){
734735
attribution.costAmount.toString() : "");
735736
adjustAttributionMap.put("costCurrency", attribution.costCurrency);
736737
adjustAttributionMap.put("fbInstallReferrer", attribution.fbInstallReferrer);
738+
adjustAttributionMap.put("jsonResponse", attribution.jsonResponse);
737739
result.success(adjustAttributionMap);
738740
}
739741
});

ios/Classes/AdjustSdk.m

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -420,16 +420,7 @@ - (void)processDeeplink:(FlutterMethodCall *)call withResult:(FlutterResult)resu
420420
return;
421421
}
422422

423-
NSURL *url;
424-
if ([NSString instancesRespondToSelector:@selector(stringByAddingPercentEncodingWithAllowedCharacters:)]) {
425-
url = [NSURL URLWithString:[urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]];
426-
} else {
427-
#pragma clang diagnostic push
428-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
429-
url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
430-
}
431-
#pragma clang diagnostic pop
432-
423+
NSURL *url = [NSURL URLWithString:urlString];
433424
ADJDeeplink *deeplink = [[ADJDeeplink alloc] initWithDeeplink:url];
434425
[Adjust processDeeplink:deeplink];
435426
}
@@ -585,6 +576,13 @@ - (void)getAttribution:(FlutterMethodCall *)call withResult:(FlutterResult)resul
585576
[self addValueOrEmpty:attribution.costType withKey:@"costType" toDictionary:dictionary];
586577
[self addNumberOrEmpty:attribution.costAmount withKey:@"costAmount" toDictionary:dictionary];
587578
[self addValueOrEmpty:attribution.costCurrency withKey:@"costCurrency" toDictionary:dictionary];
579+
NSData *dataJsonResponse = [NSJSONSerialization dataWithJSONObject:attribution.jsonResponse
580+
options:0
581+
error:nil];
582+
NSString *stringJsonResponse = [[NSString alloc] initWithBytes:[dataJsonResponse bytes]
583+
length:[dataJsonResponse length]
584+
encoding:NSUTF8StringEncoding];
585+
[self addValueOrEmpty:stringJsonResponse withKey:@"jsonResponse" toDictionary:dictionary];
588586
result(dictionary);
589587
}];
590588
}
@@ -706,16 +704,7 @@ - (void)verifyAppStorePurchase:(FlutterMethodCall *)call withResult:(FlutterResu
706704
- (void)processAndResolveDeeplink:(FlutterMethodCall *)call withResult:(FlutterResult)result {
707705
NSString *deeplink = call.arguments[@"deeplink"];
708706
if ([self isFieldValid:deeplink]) {
709-
NSURL *nsUrl;
710-
if ([NSString instancesRespondToSelector:@selector(stringByAddingPercentEncodingWithAllowedCharacters:)]) {
711-
nsUrl = [NSURL URLWithString:[deeplink stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]];
712-
} else {
713-
#pragma clang diagnostic push
714-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
715-
nsUrl = [NSURL URLWithString:[deeplink stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
716-
}
717-
#pragma clang diagnostic pop
718-
707+
NSURL *nsUrl = [NSURL URLWithString:deeplink];
719708
ADJDeeplink *deeplink = [[ADJDeeplink alloc] initWithDeeplink:nsUrl];
720709
[Adjust processAndResolveDeeplink:deeplink
721710
withCompletionHandler:^(NSString * _Nullable resolvedLink) {

ios/Classes/AdjustSdkDelegate.m

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,15 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
118118
@"clickLabel",
119119
@"costType",
120120
@"costAmount",
121-
@"costCurrency"
121+
@"costCurrency",
122+
@"jsonResponse"
122123
};
124+
NSData *dataJsonResponse = [NSJSONSerialization dataWithJSONObject:attribution.jsonResponse
125+
options:0
126+
error:nil];
127+
NSString *stringJsonResponse = [[NSString alloc] initWithBytes:[dataJsonResponse bytes]
128+
length:[dataJsonResponse length]
129+
encoding:NSUTF8StringEncoding];
123130
id values[] = {
124131
[self getValueOrEmpty:[attribution trackerToken]],
125132
[self getValueOrEmpty:[attribution trackerName]],
@@ -130,12 +137,13 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
130137
[self getValueOrEmpty:[attribution clickLabel]],
131138
[self getValueOrEmpty:[attribution costType]],
132139
[self getNumberValueOrEmpty:[attribution costAmount]],
133-
[self getValueOrEmpty:[attribution costCurrency]]
140+
[self getValueOrEmpty:[attribution costCurrency]],
141+
[self getValueOrEmpty:stringJsonResponse]
134142
};
135143
NSUInteger count = sizeof(values) / sizeof(id);
136144
NSDictionary *attributionMap = [NSDictionary dictionaryWithObjects:values
137-
forKeys:keys
138-
count:count];
145+
forKeys:keys
146+
count:count];
139147
[self.channel invokeMethod:dartAttributionCallback arguments:attributionMap];
140148
}
141149

ios/adjust_sdk.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'adjust_sdk'
3-
s.version = '5.0.4'
3+
s.version = '5.1.0'
44
s.summary = 'Adjust Flutter SDK for iOS platform'
55
s.description = <<-DESC
66
Adjust Flutter SDK for iOS platform.
@@ -14,5 +14,5 @@ Pod::Spec.new do |s|
1414
s.ios.deployment_target = '12.0'
1515

1616
s.dependency 'Flutter'
17-
s.dependency 'Adjust', '5.1.0'
17+
s.dependency 'Adjust', '5.1.1'
1818
end

lib/adjust.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import 'package:flutter/services.dart';
2424
import 'package:meta/meta.dart';
2525

2626
class Adjust {
27-
static const String _sdkPrefix = 'flutter5.0.4';
27+
static const String _sdkPrefix = 'flutter5.1.0';
2828
static const MethodChannel _channel =
2929
const MethodChannel('com.adjust.sdk/api');
3030

lib/adjust_attribution.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class AdjustAttribution {
1717
final String? costType;
1818
final num? costAmount;
1919
final String? costCurrency;
20+
final String? jsonResponse;
2021
// Android only
2122
final String? fbInstallReferrer;
2223

@@ -31,6 +32,7 @@ class AdjustAttribution {
3132
this.costType,
3233
this.costAmount,
3334
this.costCurrency,
35+
this.jsonResponse,
3436
this.fbInstallReferrer,
3537
});
3638

@@ -54,6 +56,7 @@ class AdjustAttribution {
5456
costType: map['costType'],
5557
costAmount: parsedCostAmount != -1 ? parsedCostAmount : null,
5658
costCurrency: map['costCurrency'],
59+
jsonResponse: map['jsonResponse'],
5760
fbInstallReferrer: map['fbInstallReferrer'],
5861
);
5962
} catch (e) {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: adjust_sdk
22
description: This is the Flutter SDK of Adjust™. You can read more about Adjust™ at adjust.com.
33
homepage: https://github.com/adjust/flutter_sdk
4-
version: 5.0.4
4+
version: 5.1.0
55

66
environment:
77
sdk: ">=2.12.0 <3.0.0"

test/app/lib/command_executor.dart

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import 'dart:io' show Platform;
10+
import 'dart:convert';
1011

1112
import 'package:adjust_sdk/adjust.dart';
1213
import 'package:adjust_sdk/adjust_ad_revenue.dart';
@@ -391,6 +392,28 @@ class CommandExecutor {
391392
TestLib.addInfoToSend('cost_amount', attribution.costAmount.toString());
392393
TestLib.addInfoToSend('cost_currency', attribution.costCurrency);
393394
TestLib.addInfoToSend('fb_install_referrer', attribution.fbInstallReferrer);
395+
396+
if(attribution.jsonResponse != null){
397+
try {
398+
String rawJson = attribution.jsonResponse!;
399+
print(rawJson);
400+
401+
// Ensure it's a valid JSON string
402+
if (rawJson.isEmpty) {
403+
throw FormatException("Empty JSON response");
404+
}
405+
406+
Map<String, dynamic> jsonMap = jsonDecode(rawJson);
407+
if (Platform.isIOS) {
408+
jsonMap.remove('fb_install_referrer');
409+
}
410+
411+
String jsonString = jsonEncode(jsonMap);
412+
TestLib.addInfoToSend('json_response', jsonString);
413+
} catch (e) {
414+
print("JSON Parsing Error: $e");
415+
}
416+
}
394417
TestLib.sendInfoToServer(localBasePath);
395418
};
396419
}
@@ -942,6 +965,27 @@ class CommandExecutor {
942965
fields["cost_amount"] = attribution.costAmount?.toString();
943966
fields["cost_currency"] = attribution.costCurrency;
944967
fields["fb_install_referrer"] = attribution.fbInstallReferrer;
968+
if (attribution.jsonResponse != null) {
969+
try {
970+
String rawJson = attribution.jsonResponse!;
971+
print(rawJson);
972+
973+
// Ensure it's a valid JSON string
974+
if (rawJson.isEmpty) {
975+
throw FormatException("Empty JSON response");
976+
}
977+
978+
Map<String, dynamic> jsonMap = jsonDecode(rawJson);
979+
if (Platform.isIOS) {
980+
jsonMap.remove('fb_install_referrer');
981+
}
982+
983+
String jsonString = jsonEncode(jsonMap);
984+
TestLib.addInfoToSend('json_response', jsonString);
985+
} catch (e) {
986+
print("JSON Parsing Error: $e");
987+
}
988+
}
945989
fields.forEach((key, value) {
946990
TestLib.addInfoToSend(key, value);
947991
});

0 commit comments

Comments
 (0)