Skip to content

Version 5.1.0 #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### Version 5.1.0 (25th February 2025)
#### Added
- 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.

#### Native SDKs
- [iOS@v5.1.1][ios_sdk_v5.1.1]
- [Android@v5.1.0][android_sdk_v5.1.0]

---

### Version 5.0.4 (6th February 2025)
#### Added
- Added sending of the additional parameter to improve troubleshooting of `SKAdNetwork` related issues.
Expand Down Expand Up @@ -515,7 +525,7 @@ In case you were using beta version of the SDK v5, please switch to the official
[ios_sdk_v4.38.4]: https://github.com/adjust/ios_sdk/tree/v4.38.4
[ios_sdk_v5.0.0]: https://github.com/adjust/ios_sdk/tree/v5.0.0
[ios_sdk_v5.0.1]: https://github.com/adjust/ios_sdk/tree/v5.0.1
[ios_sdk_v5.1.0]: https://github.com/adjust/ios_sdk/tree/v5.1.0
[ios_sdk_v5.1.1]: https://github.com/adjust/ios_sdk/tree/v5.1.1

[android_sdk_v4.17.0]: https://github.com/adjust/android_sdk/tree/v4.17.0
[android_sdk_v4.18.0]: https://github.com/adjust/android_sdk/tree/v4.18.0
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.4
5.1.0
2 changes: 2 additions & 0 deletions android/src/main/java/com/adjust/sdk/flutter/AdjustSdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ public void onAttributionChanged(AdjustAttribution adjustAttribution) {
adjustAttribution.costAmount.toString() : "");
adjustAttributionMap.put("costCurrency", adjustAttribution.costCurrency);
adjustAttributionMap.put("fbInstallReferrer", adjustAttribution.fbInstallReferrer);
adjustAttributionMap.put("jsonResponse", adjustAttribution.jsonResponse);
if (channel != null) {
channel.invokeMethod(dartMethodName, adjustAttributionMap);
}
Expand Down Expand Up @@ -734,6 +735,7 @@ public void onAttributionRead(AdjustAttribution attribution){
attribution.costAmount.toString() : "");
adjustAttributionMap.put("costCurrency", attribution.costCurrency);
adjustAttributionMap.put("fbInstallReferrer", attribution.fbInstallReferrer);
adjustAttributionMap.put("jsonResponse", attribution.jsonResponse);
result.success(adjustAttributionMap);
}
});
Expand Down
29 changes: 9 additions & 20 deletions ios/Classes/AdjustSdk.m
Original file line number Diff line number Diff line change
Expand Up @@ -420,16 +420,7 @@ - (void)processDeeplink:(FlutterMethodCall *)call withResult:(FlutterResult)resu
return;
}

NSURL *url;
if ([NSString instancesRespondToSelector:@selector(stringByAddingPercentEncodingWithAllowedCharacters:)]) {
url = [NSURL URLWithString:[urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}
#pragma clang diagnostic pop

NSURL *url = [NSURL URLWithString:urlString];
ADJDeeplink *deeplink = [[ADJDeeplink alloc] initWithDeeplink:url];
[Adjust processDeeplink:deeplink];
}
Expand Down Expand Up @@ -585,6 +576,13 @@ - (void)getAttribution:(FlutterMethodCall *)call withResult:(FlutterResult)resul
[self addValueOrEmpty:attribution.costType withKey:@"costType" toDictionary:dictionary];
[self addNumberOrEmpty:attribution.costAmount withKey:@"costAmount" toDictionary:dictionary];
[self addValueOrEmpty:attribution.costCurrency withKey:@"costCurrency" toDictionary:dictionary];
NSData *dataJsonResponse = [NSJSONSerialization dataWithJSONObject:attribution.jsonResponse
options:0
error:nil];
NSString *stringJsonResponse = [[NSString alloc] initWithBytes:[dataJsonResponse bytes]
length:[dataJsonResponse length]
encoding:NSUTF8StringEncoding];
[self addValueOrEmpty:stringJsonResponse withKey:@"jsonResponse" toDictionary:dictionary];
result(dictionary);
}];
}
Expand Down Expand Up @@ -706,16 +704,7 @@ - (void)verifyAppStorePurchase:(FlutterMethodCall *)call withResult:(FlutterResu
- (void)processAndResolveDeeplink:(FlutterMethodCall *)call withResult:(FlutterResult)result {
NSString *deeplink = call.arguments[@"deeplink"];
if ([self isFieldValid:deeplink]) {
NSURL *nsUrl;
if ([NSString instancesRespondToSelector:@selector(stringByAddingPercentEncodingWithAllowedCharacters:)]) {
nsUrl = [NSURL URLWithString:[deeplink stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
nsUrl = [NSURL URLWithString:[deeplink stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}
#pragma clang diagnostic pop

NSURL *nsUrl = [NSURL URLWithString:deeplink];
ADJDeeplink *deeplink = [[ADJDeeplink alloc] initWithDeeplink:nsUrl];
[Adjust processAndResolveDeeplink:deeplink
withCompletionHandler:^(NSString * _Nullable resolvedLink) {
Expand Down
16 changes: 12 additions & 4 deletions ios/Classes/AdjustSdkDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,15 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
@"clickLabel",
@"costType",
@"costAmount",
@"costCurrency"
@"costCurrency",
@"jsonResponse"
};
NSData *dataJsonResponse = [NSJSONSerialization dataWithJSONObject:attribution.jsonResponse
options:0
error:nil];
NSString *stringJsonResponse = [[NSString alloc] initWithBytes:[dataJsonResponse bytes]
length:[dataJsonResponse length]
encoding:NSUTF8StringEncoding];
id values[] = {
[self getValueOrEmpty:[attribution trackerToken]],
[self getValueOrEmpty:[attribution trackerName]],
Expand All @@ -130,12 +137,13 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
[self getValueOrEmpty:[attribution clickLabel]],
[self getValueOrEmpty:[attribution costType]],
[self getNumberValueOrEmpty:[attribution costAmount]],
[self getValueOrEmpty:[attribution costCurrency]]
[self getValueOrEmpty:[attribution costCurrency]],
[self getValueOrEmpty:stringJsonResponse]
};
NSUInteger count = sizeof(values) / sizeof(id);
NSDictionary *attributionMap = [NSDictionary dictionaryWithObjects:values
forKeys:keys
count:count];
forKeys:keys
count:count];
[self.channel invokeMethod:dartAttributionCallback arguments:attributionMap];
}

Expand Down
4 changes: 2 additions & 2 deletions ios/adjust_sdk.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'adjust_sdk'
s.version = '5.0.4'
s.version = '5.1.0'
s.summary = 'Adjust Flutter SDK for iOS platform'
s.description = <<-DESC
Adjust Flutter SDK for iOS platform.
Expand All @@ -14,5 +14,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '12.0'

s.dependency 'Flutter'
s.dependency 'Adjust', '5.1.0'
s.dependency 'Adjust', '5.1.1'
end
2 changes: 1 addition & 1 deletion lib/adjust.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import 'package:flutter/services.dart';
import 'package:meta/meta.dart';

class Adjust {
static const String _sdkPrefix = 'flutter5.0.4';
static const String _sdkPrefix = 'flutter5.1.0';
static const MethodChannel _channel =
const MethodChannel('com.adjust.sdk/api');

Expand Down
3 changes: 3 additions & 0 deletions lib/adjust_attribution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class AdjustAttribution {
final String? costType;
final num? costAmount;
final String? costCurrency;
final String? jsonResponse;
// Android only
final String? fbInstallReferrer;

Expand All @@ -31,6 +32,7 @@ class AdjustAttribution {
this.costType,
this.costAmount,
this.costCurrency,
this.jsonResponse,
this.fbInstallReferrer,
});

Expand All @@ -54,6 +56,7 @@ class AdjustAttribution {
costType: map['costType'],
costAmount: parsedCostAmount != -1 ? parsedCostAmount : null,
costCurrency: map['costCurrency'],
jsonResponse: map['jsonResponse'],
fbInstallReferrer: map['fbInstallReferrer'],
);
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: adjust_sdk
description: This is the Flutter SDK of Adjust™. You can read more about Adjust™ at adjust.com.
homepage: https://github.com/adjust/flutter_sdk
version: 5.0.4
version: 5.1.0

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down
44 changes: 44 additions & 0 deletions test/app/lib/command_executor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import 'dart:io' show Platform;
import 'dart:convert';

import 'package:adjust_sdk/adjust.dart';
import 'package:adjust_sdk/adjust_ad_revenue.dart';
Expand Down Expand Up @@ -391,6 +392,28 @@ class CommandExecutor {
TestLib.addInfoToSend('cost_amount', attribution.costAmount.toString());
TestLib.addInfoToSend('cost_currency', attribution.costCurrency);
TestLib.addInfoToSend('fb_install_referrer', attribution.fbInstallReferrer);

if(attribution.jsonResponse != null){
try {
String rawJson = attribution.jsonResponse!;
print(rawJson);

// Ensure it's a valid JSON string
if (rawJson.isEmpty) {
throw FormatException("Empty JSON response");
}

Map<String, dynamic> jsonMap = jsonDecode(rawJson);
if (Platform.isIOS) {
jsonMap.remove('fb_install_referrer');
}

String jsonString = jsonEncode(jsonMap);
TestLib.addInfoToSend('json_response', jsonString);
} catch (e) {
print("JSON Parsing Error: $e");
}
}
TestLib.sendInfoToServer(localBasePath);
};
}
Expand Down Expand Up @@ -942,6 +965,27 @@ class CommandExecutor {
fields["cost_amount"] = attribution.costAmount?.toString();
fields["cost_currency"] = attribution.costCurrency;
fields["fb_install_referrer"] = attribution.fbInstallReferrer;
if (attribution.jsonResponse != null) {
try {
String rawJson = attribution.jsonResponse!;
print(rawJson);

// Ensure it's a valid JSON string
if (rawJson.isEmpty) {
throw FormatException("Empty JSON response");
}

Map<String, dynamic> jsonMap = jsonDecode(rawJson);
if (Platform.isIOS) {
jsonMap.remove('fb_install_referrer');
}

String jsonString = jsonEncode(jsonMap);
TestLib.addInfoToSend('json_response', jsonString);
} catch (e) {
print("JSON Parsing Error: $e");
}
}
fields.forEach((key, value) {
TestLib.addInfoToSend(key, value);
});
Expand Down
2 changes: 1 addition & 1 deletion test/ios/test_lib.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'test_lib'
s.version = '5.0.4'
s.version = '5.1.0'
s.summary = 'Adjust test library for iOS platform'
s.description = <<-DESC
Adjust test library for iOS platform.
Expand Down
2 changes: 1 addition & 1 deletion test/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: test_lib
description: Flutter plugin for Adjust Testing Library. Intended exclusively for internal use.
version: 5.0.4
version: 5.1.0
author: Adjust (sdk@adjust.com)

environment:
Expand Down