Skip to content

Commit

Permalink
Merge pull request #101 from adjust/v4330
Browse files Browse the repository at this point in the history
Version 4.33.0
  • Loading branch information
uerceg authored Dec 9, 2022
2 parents 4e93eba + 96b082c commit 2007ce9
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 10 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
### Version 4.33.0 (9th December 2022)
#### Added
- Added support for SKAD 4.0.
- Added support for setting a new China URL Strategy. You can choose this setting by setting `urlStrategy` member of `AdjustConfig` instance to `AdjustConfig.UrlStrategyCn` value.

#### Native SDKs
- [[email protected]][ios_sdk_v4.33.2]
- [[email protected]][android_sdk_v4.32.2]

---

### Version 4.32.0 (7th October 2022)
#### Added
- Added partner sharing settings to the third party sharing feature.
Expand Down Expand Up @@ -301,6 +312,7 @@
[ios_sdk_v4.30.0]: https://github.com/adjust/ios_sdk/tree/v4.30.0
[ios_sdk_v4.31.0]: https://github.com/adjust/ios_sdk/tree/v4.31.0
[ios_sdk_v4.32.1]: https://github.com/adjust/ios_sdk/tree/v4.32.1
[ios_sdk_v4.33.2]: https://github.com/adjust/ios_sdk/tree/v4.33.2

[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 All @@ -315,3 +327,4 @@
[android_sdk_v4.30.1]: https://github.com/adjust/android_sdk/tree/v4.30.1
[android_sdk_v4.31.0]: https://github.com/adjust/android_sdk/tree/v4.31.0
[android_sdk_v4.32.0]: https://github.com/adjust/android_sdk/tree/v4.32.0
[android_sdk_v4.33.2]: https://github.com/adjust/android_sdk/tree/v4.33.2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ You can add Adjust SDK to your Flutter app by adding following to your `pubspec.

```yaml
dependencies:
adjust_sdk: ^4.32.0
adjust_sdk: ^4.33.0
```
Then navigate to your project in the terminal and run:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.32.0
4.33.0
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ android {
}

dependencies {
api 'com.adjust.sdk:adjust-android:4.32.0'
api 'com.adjust.sdk:adjust-android:4.33.2'
}
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 @@ -335,6 +335,8 @@ private void start(final MethodCall call, final Result result) {
adjustConfig.setUrlStrategy(AdjustConfig.URL_STRATEGY_CHINA);
} else if (urlStrategy.equalsIgnoreCase("india")) {
adjustConfig.setUrlStrategy(AdjustConfig.URL_STRATEGY_INDIA);
} else if (urlStrategy.equalsIgnoreCase("cn")) {
adjustConfig.setUrlStrategy(AdjustConfig.URL_STRATEGY_CN);
} else if (urlStrategy.equalsIgnoreCase("data-residency-eu")) {
adjustConfig.setUrlStrategy(AdjustConfig.DATA_RESIDENCY_EU);
} else if (urlStrategy.equalsIgnoreCase("data-residency-tr")) {
Expand Down
7 changes: 7 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver {
conversionValue!.toString());
};

config.skad4ConversionValueUpdatedCallback = (num? conversionValue, String? coarseValue, bool? lockWindow) {
print('[Adjust]: Received conversion value update!');
print('[Adjust]: Conversion value: ' + conversionValue!.toString());
print('[Adjust]: Coarse value: ' + coarseValue!);
print('[Adjust]: Lock window: ' + lockWindow!.toString());
};

// Add session callback parameters.
Adjust.addSessionCallbackParameter('scp_foo_1', 'scp_bar');
Adjust.addSessionCallbackParameter('scp_foo_2', 'scp_value');
Expand Down
37 changes: 36 additions & 1 deletion ios/Classes/AdjustSdk.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
[Adjust checkForNewAttStatus];
} else if ([@"getLastDeeplink" isEqualToString:call.method]) {
[self getLastDeeplink:call withResult:result];
} else if ([@"updateConversionValueWithErrorCallback" isEqualToString:call.method]) {
[self updateConversionValueWithErrorCallback:call withResult:result];
} else if ([@"updateConversionValueWithErrorCallbackSkad4" isEqualToString:call.method]) {
[self updateConversionValueWithErrorCallbackSkad4:call withResult:result];
} else {
result(FlutterMethodNotImplemented);
}
Expand Down Expand Up @@ -160,6 +164,7 @@ - (void)start:(FlutterMethodCall *)call withResult:(FlutterResult)result {
NSString *dartEventFailureCallback = call.arguments[@"eventFailureCallback"];
NSString *dartDeferredDeeplinkCallback = call.arguments[@"deferredDeeplinkCallback"];
NSString *dartConversionValueUpdatedCallback = call.arguments[@"conversionValueUpdatedCallback"];
NSString *dartSkad4ConversionValueUpdatedCallback = call.arguments[@"skad4ConversionValueUpdatedCallback"];
BOOL allowSuppressLogLevel = NO;
BOOL launchDeferredDeeplink = [call.arguments[@"launchDeferredDeeplink"] boolValue];

Expand Down Expand Up @@ -221,6 +226,8 @@ - (void)start:(FlutterMethodCall *)call withResult:(FlutterResult)result {
[adjustConfig setUrlStrategy:ADJUrlStrategyChina];
} else if ([urlStrategy isEqualToString:@"india"]) {
[adjustConfig setUrlStrategy:ADJUrlStrategyIndia];
} else if ([urlStrategy isEqualToString:@"cn"]) {
[adjustConfig setUrlStrategy:ADJUrlStrategyCn];
} else if ([urlStrategy isEqualToString:@"data-residency-eu"]) {
[adjustConfig setUrlStrategy:ADJDataResidencyEU];
} else if ([urlStrategy isEqualToString:@"data-residency-tr"]) {
Expand Down Expand Up @@ -292,7 +299,8 @@ - (void)start:(FlutterMethodCall *)call withResult:(FlutterResult)result {
|| dartEventSuccessCallback != nil
|| dartEventFailureCallback != nil
|| dartDeferredDeeplinkCallback != nil
|| dartConversionValueUpdatedCallback != nil) {
|| dartConversionValueUpdatedCallback != nil
|| dartSkad4ConversionValueUpdatedCallback != nil) {
[adjustConfig setDelegate:
[AdjustSdkDelegate getInstanceWithSwizzleOfAttributionCallback:dartAttributionCallback
sessionSuccessCallback:dartSessionSuccessCallback
Expand All @@ -301,6 +309,7 @@ - (void)start:(FlutterMethodCall *)call withResult:(FlutterResult)result {
eventFailureCallback:dartEventFailureCallback
deferredDeeplinkCallback:dartDeferredDeeplinkCallback
conversionValueUpdatedCallback:dartConversionValueUpdatedCallback
skad4ConversionValueUpdatedCallback:dartSkad4ConversionValueUpdatedCallback
shouldLaunchDeferredDeeplink:launchDeferredDeeplink
andMethodChannel:self.channel]];
}
Expand Down Expand Up @@ -691,6 +700,32 @@ - (void)getLastDeeplink:(FlutterMethodCall *)call withResult:(FlutterResult)resu
}
}

- (void)updateConversionValueWithErrorCallback:(FlutterMethodCall *)call withResult:(FlutterResult)result {
NSString *conversionValue = call.arguments[@"conversionValue"];
if ([self isFieldValid:conversionValue]) {
[Adjust updatePostbackConversionValue:[conversionValue intValue]
completionHandler:^(NSError * _Nullable error) {
result([error localizedDescription]);
}];
}
}

- (void)updateConversionValueWithErrorCallbackSkad4:(FlutterMethodCall *)call withResult:(FlutterResult)result {
NSString *conversionValue = call.arguments[@"conversionValue"];
NSString *coarseValue = call.arguments[@"coarseValue"];
NSString *lockWindow = call.arguments[@"lockWindow"];
if ([self isFieldValid:conversionValue] &&
[self isFieldValid:coarseValue] &&
[self isFieldValid:lockWindow]) {
[Adjust updatePostbackConversionValue:[conversionValue intValue]
coarseValue:coarseValue
lockWindow:(BOOL)lockWindow
completionHandler:^(NSError * _Nullable error) {
result([error localizedDescription]);
}];
}
}

- (void)setTestOptions:(FlutterMethodCall *)call withResult:(FlutterResult)result {
AdjustTestOptions *testOptions = [[AdjustTestOptions alloc] init];
NSString *baseUrl = call.arguments[@"baseUrl"];
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/AdjustSdkDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
eventFailureCallback:(NSString *)swizzleEventFailureCallback
deferredDeeplinkCallback:(NSString *)swizzleDeferredDeeplinkCallback
conversionValueUpdatedCallback:(NSString *)swizzleConversionValueUpdatedCallback
skad4ConversionValueUpdatedCallback:(NSString *)swizzleSkad4ConversionValueUpdatedCallback
shouldLaunchDeferredDeeplink:(BOOL)shouldLaunchDeferredDeeplink
andMethodChannel:(FlutterMethodChannel *)channel;

Expand Down
19 changes: 19 additions & 0 deletions ios/Classes/AdjustSdkDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
static NSString *dartEventFailureCallback;
static NSString *dartDeferredDeeplinkCallback;
static NSString *dartConversionValueUpdatedCallback;
static NSString *dartSkad4ConversionValueUpdatedCallback;

@implementation AdjustSdkDelegate

Expand All @@ -40,6 +41,7 @@ + (id)getInstanceWithSwizzleOfAttributionCallback:(NSString *)swizzleAttribution
eventFailureCallback:(NSString *)swizzleEventFailureCallback
deferredDeeplinkCallback:(NSString *)swizzleDeferredDeeplinkCallback
conversionValueUpdatedCallback:(NSString *)swizzleConversionValueUpdatedCallback
skad4ConversionValueUpdatedCallback:(NSString *)swizzleSkad4ConversionValueUpdatedCallback
shouldLaunchDeferredDeeplink:(BOOL)shouldLaunchDeferredDeeplink
andMethodChannel:(FlutterMethodChannel *)channel {

Expand Down Expand Up @@ -82,6 +84,11 @@ + (id)getInstanceWithSwizzleOfAttributionCallback:(NSString *)swizzleAttribution
swizzledSelector:@selector(adjustConversionValueUpdatedWannabe:)];
dartConversionValueUpdatedCallback = swizzleConversionValueUpdatedCallback;
}
if (swizzleSkad4ConversionValueUpdatedCallback != nil) {
[defaultInstance swizzleCallbackMethod:@selector(adjustConversionValueUpdated:coarseValue:lockWindow:)
swizzledSelector:@selector(adjustConversionValueUpdatedWannabe:coarseValue:lockWindow:)];
dartSkad4ConversionValueUpdatedCallback = swizzleSkad4ConversionValueUpdatedCallback;
}

[defaultInstance setShouldLaunchDeferredDeeplink:shouldLaunchDeferredDeeplink];
[defaultInstance setChannel:channel];
Expand Down Expand Up @@ -239,6 +246,18 @@ - (void)adjustConversionValueUpdatedWannabe:(NSNumber *)conversionValue {
[self.channel invokeMethod:dartConversionValueUpdatedCallback arguments:conversionValueMap];
}

- (void)adjustConversionValueUpdatedWannabe:(nullable NSNumber *)fineValue
coarseValue:(nullable NSString *)coarseValue
lockWindow:(nullable NSNumber *)lockWindow {
id keys[] = { @"fineValue", @"coarseValue", @"lockWindow" };
id values[] = { [fineValue stringValue], coarseValue, [lockWindow stringValue] };
NSUInteger count = sizeof(values) / sizeof(id);
NSDictionary *conversionValueMap = [NSDictionary dictionaryWithObjects:values
forKeys:keys
count:count];
[self.channel invokeMethod:dartSkad4ConversionValueUpdatedCallback arguments:conversionValueMap];
}

- (void)swizzleCallbackMethod:(SEL)originalSelector
swizzledSelector:(SEL)swizzledSelector {
Class class = [self class];
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 = '4.32.0'
s.version = '4.33.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 = '8.0'

s.dependency 'Flutter'
s.dependency 'Adjust', '4.32.1'
s.dependency 'Adjust', '4.33.2'
end
19 changes: 18 additions & 1 deletion lib/adjust.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:flutter/services.dart';
import 'package:meta/meta.dart';

class Adjust {
static const String _sdkPrefix = 'flutter4.32.0';
static const String _sdkPrefix = 'flutter4.33.0';
static const MethodChannel _channel =
const MethodChannel('com.adjust.sdk/api');

Expand Down Expand Up @@ -189,6 +189,23 @@ class Adjust {
return deeplink;
}

static Future<String?> updateConversionValueWithErrorCallback(int conversionValue) async {
final String? error = await _channel.invokeMethod(
'updateConversionValueWithErrorCallback', {'conversionValue': conversionValue});
return error;
}

static Future<String?> updateConversionValueWithErrorCallbackSkad4(
int conversionValue,
String coarseValue,
bool lockWindow) async {
final String? error = await _channel.invokeMethod(
'updateConversionValueWithErrorCallbackSkad4', {'conversionValue': conversionValue,
'coarseValue': coarseValue,
'lockWindow': lockWindow});
return error;
}

// For testing purposes only. Do not use in production.
@visibleForTesting
static void setTestOptions(final dynamic testOptions) {
Expand Down
22 changes: 22 additions & 0 deletions lib/adjust_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ typedef void EventSuccessCallback(AdjustEventSuccess successData);
typedef void EventFailureCallback(AdjustEventFailure failureData);
typedef void DeferredDeeplinkCallback(String? uri);
typedef void ConversionValueUpdatedCallback(num? conversionValue);
typedef void Skad4ConversionValueUpdatedCallback(num? conversionValue, String? coarseValue, bool? lockWindow);

class AdjustConfig {
static const MethodChannel _channel =
Expand All @@ -36,9 +37,12 @@ class AdjustConfig {
static const String _deferredDeeplinkCallbackName = 'adj-deferred-deeplink';
static const String _conversionValueUpdatedCallbackName =
'adj-conversion-value-updated';
static const String _skad4ConversionValueUpdatedCallbackName =
'adj-skad4-conversion-value-updated';

static const String UrlStrategyIndia = 'india';
static const String UrlStrategyChina = 'china';
static const String UrlStrategyCn = 'cn';

static const String DataResidencyEU = 'data-residency-eu';
static const String DataResidencyTR = 'data-residency-tr';
Expand Down Expand Up @@ -91,6 +95,7 @@ class AdjustConfig {
EventFailureCallback? eventFailureCallback;
DeferredDeeplinkCallback? deferredDeeplinkCallback;
ConversionValueUpdatedCallback? conversionValueUpdatedCallback;
Skad4ConversionValueUpdatedCallback? skad4ConversionValueUpdatedCallback;

AdjustConfig(this._appToken, this._environment) {
_initCallbackHandlers();
Expand Down Expand Up @@ -152,6 +157,19 @@ class AdjustConfig {
}
}
break;
case _skad4ConversionValueUpdatedCallbackName:
if (skad4ConversionValueUpdatedCallback != null) {
String? conversionValue = call.arguments['fineValue'];
String? coarseValue = call.arguments['coarseValue'];
String? lockWindow = call.arguments['lockWindow'];
if (conversionValue != null && coarseValue != null && lockWindow != null) {
skad4ConversionValueUpdatedCallback!(
int.parse(conversionValue),
coarseValue,
lockWindow.toLowerCase() == 'true');
}
}
break;
default:
throw new UnsupportedError(
'[AdjustFlutter]: Received unknown native method: ${call.method}');
Expand Down Expand Up @@ -283,6 +301,10 @@ class AdjustConfig {
configMap['conversionValueUpdatedCallback'] =
_conversionValueUpdatedCallbackName;
}
if (skad4ConversionValueUpdatedCallback != null) {
configMap['skad4ConversionValueUpdatedCallback'] =
_skad4ConversionValueUpdatedCallbackName;
}

return configMap;
}
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: 4.32.0
version: 4.33.0

environment:
sdk: ">=2.12.0 <3.0.0"
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 = '4.32.0'
s.version = '4.33.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: 4.32.0
version: 4.33.0
author: Adjust ([email protected])

environment:
Expand Down

0 comments on commit 2007ce9

Please sign in to comment.