From 5188d35ecd0ffc700f54c3630dd266225638a8f1 Mon Sep 17 00:00:00 2001 From: Sergey Korney Date: Tue, 20 Aug 2024 18:34:56 +0500 Subject: [PATCH] 1.6.20 --- CHANGELOG.md | 15 ++++ README.md | 68 ++++++++++++++----- android/build.gradle | 4 +- .../AffiseAttributionLibPlugin.kt | 12 +--- example/android/app/build.gradle | 2 +- example/ios/Podfile | 6 +- example/lib/affise/factories/api_factory.dart | 24 +++++-- example/pubspec.lock | 2 +- ios/affise_attribution_lib.podspec | 2 +- lib/affise.dart | 34 +++++++++- lib/native/affise_api_method.dart | 18 +++-- lib/native/affise_native.dart | 35 ++++++++-- lib/native_api_interface.dart | 4 ++ pubspec.yaml | 2 +- 14 files changed, 171 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a3a07a..2277ec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.6.20] - 2024-08-19 + +### Added + +- iOS only api `Affise.ios.getReferrerOnServer`. +- iOS only api `Affise.ios.getReferrerOnServerValue`. + +### Changed + +- Api `Affise.getReferrer` to `Affise.getReferrerUrl`. +- Api `Affise.getReferrerValue` to `Affise.getReferrerUrlValue`. +- Update native iOS to [`1.6.39`](https://github.com/affise/sdk-ios/blob/1.6.39/CHANGELOG.md). +- Update native Android to [`1.6.42`](https://github.com/affise/sdk-android/blob/v1.6.42/CHANGELOG.md). + ## [1.6.19] - 2024-08-01 ### Fixed @@ -116,6 +130,7 @@ - Api `Affise.android.getReferrer` to `Affise.getReferrer` - Api `Affise.android.getReferrerValue` to `Affise.getReferrerValue` +[1.6.20]: https://github.com/affise/flutter-sdk/compare/1.6.19...1.6.20 [1.6.19]: https://github.com/affise/flutter-sdk/compare/1.6.18...1.6.19 [1.6.18]: https://github.com/affise/flutter-sdk/compare/1.6.17...1.6.18 [1.6.17]: https://github.com/affise/flutter-sdk/compare/1.6.16...1.6.17 diff --git a/README.md b/README.md index 6120ba7..427e093 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ | Package | Version | |--------------------------|:--------------------------------------------------------:| -| `affise_attribution_lib` | [`1.6.19`](https://github.com/affise/sdk-react/releases) | +| `affise_attribution_lib` | [`1.6.20`](https://github.com/affise/sdk-react/releases) | - [Affise Attribution Flutter Library](#affise-attribution-flutter-library) - [Description](#description) @@ -59,7 +59,9 @@ - [Is first run](#is-first-run) - [Get referrer](#get-referrer) - [Get referrer value](#get-referrer-value) - - [Referrer keys](#referrer-keys) + - [Get referrer on server](#get-referrer-on-server) + - [Get referrer on server parameter](#get-referrer-on-server-parameter) + - [Referrer keys](#referrer-keys) - [Get module state](#get-module-state) - [Platform specific](#platform-specific) - [GDPR right to be forgotten](#gdpr-right-to-be-forgotten) @@ -125,12 +127,12 @@ Example [`example/android/app/build.gradle`](example/android/app/build.gradle) ```gradle dependencies { // Affise modules - implementation 'com.affise:module-advertising:1.6.40' - implementation 'com.affise:module-androidid:1.6.40' - implementation 'com.affise:module-link:1.6.40' - implementation 'com.affise:module-network:1.6.40' - implementation 'com.affise:module-phone:1.6.40' - implementation 'com.affise:module-status:1.6.40' + implementation 'com.affise:module-advertising:1.6.42' + implementation 'com.affise:module-androidid:1.6.42' + implementation 'com.affise:module-link:1.6.42' + implementation 'com.affise:module-network:1.6.42' + implementation 'com.affise:module-phone:1.6.42' + implementation 'com.affise:module-status:1.6.42' } ``` @@ -140,9 +142,9 @@ Add modules to iOS project | Module | Version | Start | |---------------|:------------------------------------------------------------------------------------:|----------| -| `ADVERTISING` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` | -| `LINK` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | -| `STATUS` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | +| `ADVERTISING` | [`1.6.39`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` | +| `LINK` | [`1.6.39`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | +| `STATUS` | [`1.6.39`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | Example [example/ios/Podfile](example/ios/Podfile) @@ -151,9 +153,9 @@ target 'Runner' do # ... # Affise Modules - pod 'AffiseModule/Advertising', `1.6.36` - pod 'AffiseModule/Link', `1.6.36` - pod 'AffiseModule/Status', `1.6.36` + pod 'AffiseModule/Advertising', `1.6.39` + pod 'AffiseModule/Link', `1.6.39` + pod 'AffiseModule/Status', `1.6.39` end ``` @@ -1057,7 +1059,7 @@ Affise.isFirstRun().then((isFirstRun) { Use the next public method of SDK ```dart -Affise.getReferrer((value) { +Affise.getReferrerUrl((value) { // handle referrer }); ``` @@ -1067,12 +1069,44 @@ Affise.getReferrer((value) { Use the next public method of SDK to get referrer value by ```dart -Affise.getReferrerValue(ReferrerKey.CLICK_ID, (value) { +Affise.getReferrerUrlValue(ReferrerKey.CLICK_ID, (value) { // handle referrer }); ``` -### Referrer keys +## Get referrer on server + +> `iOS Only` + +> **Note** +> +> Requires [Affise Status Module](#modules) for [ios](#ios) + +Use the next public method of SDK + +```dart +Affise.ios.getReferrerOnServer((value) { + // handle referrer +}); +``` + +## Get referrer on server parameter + +> `iOS Only` + +> **Note** +> +> Requires [Affise Status Module](#modules) for [ios](#ios) + +Use the next public method of SDK to get referrer parameter by + +```dart +Affise.ios.getReferrerOnServerValue(ReferrerKey.CLICK_ID, (value) { + // handle referrer value +}); +``` + +## Referrer keys In examples above `ReferrerKey.CLICK_ID` is used, but many others is available: diff --git a/android/build.gradle b/android/build.gradle index 113ef3a..0c51eea 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,9 +1,9 @@ group 'com.affise.attribution.affise_attribution_lib' -version '1.6.19' +version '1.6.20' buildscript { ext.kotlin_version = '1.7.10' - ext.affise_version = '1.6.40' + ext.affise_version = '1.6.42' ext.agp_version = '7.2.1' repositories { diff --git a/android/src/main/kotlin/com/affise/attribution/affise_attribution_lib/AffiseAttributionLibPlugin.kt b/android/src/main/kotlin/com/affise/attribution/affise_attribution_lib/AffiseAttributionLibPlugin.kt index 43f8425..3c01927 100644 --- a/android/src/main/kotlin/com/affise/attribution/affise_attribution_lib/AffiseAttributionLibPlugin.kt +++ b/android/src/main/kotlin/com/affise/attribution/affise_attribution_lib/AffiseAttributionLibPlugin.kt @@ -9,6 +9,7 @@ import android.os.Looper import com.affise.attribution.deeplink.toDeeplinkValue import com.affise.attribution.internal.AffiseApiMethod import com.affise.attribution.internal.AffiseApiWrapper +import com.affise.attribution.internal.utils.DataMapper import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding @@ -86,16 +87,7 @@ class AffiseAttributionLibPlugin : val value = Uri.parse(url).toDeeplinkValue() events?.success( - mapOf( - // TODO 1.6.39 internal utils - AffiseApiMethod.REGISTER_DEEPLINK_CALLBACK.method to mapOf( - "deeplink" to value.deeplink, - "scheme" to value.scheme, - "host" to value.host, - "path" to value.path, - "parameters" to value.parameters - ) - ) + DataMapper.fromDeeplinkValue(value) ) } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 1c4de5e..7bbfb50 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -65,7 +65,7 @@ flutter { source '../..' } -final affise_version = '1.6.40' +final affise_version = '1.6.42' dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" diff --git a/example/ios/Podfile b/example/ios/Podfile index ccdf23d..a722475 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -34,9 +34,9 @@ target 'Runner' do flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) # Affise modules - pod 'AffiseModule/Advertising', '1.6.36' - pod 'AffiseModule/Status', '1.6.36' - pod 'AffiseModule/Link', '1.6.36' + pod 'AffiseModule/Advertising', '1.6.39' + pod 'AffiseModule/Status', '1.6.39' + pod 'AffiseModule/Link', '1.6.39' end post_install do |installer| diff --git a/example/lib/affise/factories/api_factory.dart b/example/lib/affise/factories/api_factory.dart index 61965d0..95a8164 100644 --- a/example/lib/affise/factories/api_factory.dart +++ b/example/lib/affise/factories/api_factory.dart @@ -41,25 +41,37 @@ class ApiFactory { output?.call("Modules: $value"); }); }, - "Referrer": () { + "Get Referrer Url": () { // Get referrer https://github.com/affise/flutter-sdk#get-referrer - Affise.getReferrer((value) { + Affise.getReferrerUrl((value) { output?.call("Referrer: $value"); }); }, - "ReferrerValue": () { + "Get Referrer Url Value": () { // Get referrer value https://github.com/affise/flutter-sdk#get-referrer-value - Affise.getReferrerValue(ReferrerKey.CLICK_ID, (value) { + Affise.getReferrerUrlValue(ReferrerKey.CLICK_ID, (value) { output?.call("ReferrerValue: $value"); }); }, - "SKAd register": () { + "iOS Get Referrer On Server": () { + // Get referrer https://github.com/affise/flutter-sdk#get-referrer-on-server + Affise.ios.getReferrerOnServer((value) { + output?.call("ReferrerOnServer: $value"); + }); + }, + "iOS Get Referrer On Server Value": () { + // Get referrer value https://github.com/affise/flutter-sdk#get-referrer-on-server-parameter + Affise.ios.getReferrerOnServerValue(ReferrerKey.CLICK_ID, (value) { + output?.call("ReferrerOnServerValue: $value"); + }); + }, + "iOS SKAd register": () { // StoreKit Ad Network https://github.com/affise/flutter-sdk#storekit-ad-network Affise.ios.registerAppForAdNetworkAttribution((error) { output?.call("SKAd register: $error"); }); }, - "SKAd update": () { + "iOS SKAd update": () { // StoreKit Ad Network https://github.com/affise/flutter-sdk#storekit-ad-network Affise.ios.updatePostbackConversionValue( 1, SKAdNetwork.CoarseConversionValue.medium, (error) { diff --git a/example/pubspec.lock b/example/pubspec.lock index dedfa20..7fd7f91 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: path: ".." relative: true source: path - version: "1.6.19" + version: "1.6.20" async: dependency: transitive description: diff --git a/ios/affise_attribution_lib.podspec b/ios/affise_attribution_lib.podspec index 2be25d3..76c474a 100644 --- a/ios/affise_attribution_lib.podspec +++ b/ios/affise_attribution_lib.podspec @@ -21,6 +21,6 @@ Affise Attribution Flutter plugin. s.swift_version = '5.0' s.dependency 'Flutter' - s.dependency 'AffiseInternal', '1.6.36' + s.dependency 'AffiseInternal', '1.6.39' end diff --git a/lib/affise.dart b/lib/affise.dart index 25e24d0..d6cd812 100644 --- a/lib/affise.dart +++ b/lib/affise.dart @@ -226,16 +226,28 @@ class Affise { } /// Get referrer + @Deprecated('Use `Affise.getReferrerUrl` instead') static void getReferrer(ReferrerCallback callback) { + getReferrerUrl(callback); + } + + /// Get referrer Value + @Deprecated('Use `Affise.getReferrerUrlValue` instead') + static void getReferrerValue(ReferrerKey key, ReferrerCallback callback) { + getReferrerUrlValue(key, callback); + } + + /// Get referrer + static void getReferrerUrl(ReferrerCallback callback) { SchedulerBinding.instance.addPostFrameCallback((_) { - _native.getReferrer(callback); + _native.getReferrerUrl(callback); }); } /// Get referrer Value - static void getReferrerValue(ReferrerKey key, ReferrerCallback callback) { + static void getReferrerUrlValue(ReferrerKey key, ReferrerCallback callback) { SchedulerBinding.instance.addPostFrameCallback((_) { - _native.getReferrerValue(key, callback); + _native.getReferrerUrlValue(key, callback); }); } @@ -338,6 +350,22 @@ class _AffiseIOS implements AffiseIOSApi { native?.updatePostbackConversionValue(fineValue, coarseValue.value, completionHandler); }); } + + /// Get referrer on server + @override + void getReferrerOnServer(ReferrerCallback callback) { + SchedulerBinding.instance.addPostFrameCallback((_) { + native?.getReferrerOnServer(callback); + }); + } + + /// Get referrer on server value + @override + void getReferrerOnServerValue(ReferrerKey key, ReferrerCallback callback) { + SchedulerBinding.instance.addPostFrameCallback((_) { + native?.getReferrerOnServerValue(key, callback); + }); + } } class _AffiseDebug implements AffiseDebug { diff --git a/lib/native/affise_api_method.dart b/lib/native/affise_api_method.dart index bc0022a..f4ff949 100644 --- a/lib/native/affise_api_method.dart +++ b/lib/native/affise_api_method.dart @@ -23,8 +23,10 @@ enum AffiseApiMethod { IS_FIRST_RUN, // callbacks - GET_REFERRER_CALLBACK, - GET_REFERRER_VALUE_CALLBACK, + GET_REFERRER_URL_CALLBACK, + GET_REFERRER_URL_VALUE_CALLBACK, + GET_REFERRER_ON_SERVER_CALLBACK, + GET_REFERRER_ON_SERVER_VALUE_CALLBACK, REGISTER_DEEPLINK_CALLBACK, SKAD_REGISTER_ERROR_CALLBACK, SKAD_POSTBACK_ERROR_CALLBACK, @@ -99,10 +101,14 @@ extension AffiseApiMethodExt on AffiseApiMethod { return "get_providers"; case AffiseApiMethod.IS_FIRST_RUN: return "is_first_run"; - case AffiseApiMethod.GET_REFERRER_CALLBACK: - return "get_referrer_callback"; - case AffiseApiMethod.GET_REFERRER_VALUE_CALLBACK: - return "get_referrer_value_callback"; + case AffiseApiMethod.GET_REFERRER_URL_CALLBACK: + return "get_referrer_url_callback"; + case AffiseApiMethod.GET_REFERRER_URL_VALUE_CALLBACK: + return "get_referrer_url_value_callback"; + case AffiseApiMethod.GET_REFERRER_ON_SERVER_CALLBACK: + return "get_referrer_on_server_callback"; + case AffiseApiMethod.GET_REFERRER_ON_SERVER_VALUE_CALLBACK: + return "get_referrer_on_server_value_callback"; case AffiseApiMethod.REGISTER_DEEPLINK_CALLBACK: return "register_deeplink_callback"; case AffiseApiMethod.SKAD_REGISTER_ERROR_CALLBACK: diff --git a/lib/native/affise_native.dart b/lib/native/affise_native.dart index a66ad9e..b6a40f4 100644 --- a/lib/native/affise_native.dart +++ b/lib/native/affise_native.dart @@ -106,16 +106,31 @@ class AffiseNative extends NativeBase { native(AffiseApiMethod.CRASH_APPLICATION); } - void getReferrer(ReferrerCallback callback) { + void getReferrerUrl(ReferrerCallback callback) { nativeCallbackOnce( - AffiseApiMethod.GET_REFERRER_CALLBACK, + AffiseApiMethod.GET_REFERRER_URL_CALLBACK, callback, ); } - void getReferrerValue(ReferrerKey key, ReferrerCallback callback) { + void getReferrerUrlValue(ReferrerKey key, ReferrerCallback callback) { nativeCallbackOnce( - AffiseApiMethod.GET_REFERRER_VALUE_CALLBACK, + AffiseApiMethod.GET_REFERRER_URL_VALUE_CALLBACK, + callback, + key.value, + ); + } + + void getReferrerOnServer(ReferrerCallback callback) { + nativeCallbackOnce( + AffiseApiMethod.GET_REFERRER_ON_SERVER_CALLBACK, + callback, + ); + } + + void getReferrerOnServerValue(ReferrerKey key, ReferrerCallback callback) { + nativeCallbackOnce( + AffiseApiMethod.GET_REFERRER_ON_SERVER_VALUE_CALLBACK, callback, key.value, ); @@ -247,11 +262,19 @@ class AffiseNative extends NativeBase { break; } break; - case AffiseApiMethod.GET_REFERRER_CALLBACK: + case AffiseApiMethod.GET_REFERRER_URL_CALLBACK: + tryCast(callback) + ?.call(DataMapper.toNonNullString(from: data)); + break; + case AffiseApiMethod.GET_REFERRER_URL_VALUE_CALLBACK: + tryCast(callback) + ?.call(DataMapper.toNonNullString(from: data)); + break; + case AffiseApiMethod.GET_REFERRER_ON_SERVER_CALLBACK: tryCast(callback) ?.call(DataMapper.toNonNullString(from: data)); break; - case AffiseApiMethod.GET_REFERRER_VALUE_CALLBACK: + case AffiseApiMethod.GET_REFERRER_ON_SERVER_VALUE_CALLBACK: tryCast(callback) ?.call(DataMapper.toNonNullString(from: data)); break; diff --git a/lib/native_api_interface.dart b/lib/native_api_interface.dart index 982ea22..119f5be 100644 --- a/lib/native_api_interface.dart +++ b/lib/native_api_interface.dart @@ -24,6 +24,10 @@ abstract class AffiseIOSApi { void registerAppForAdNetworkAttribution(ErrorCallback completionHandler); void updatePostbackConversionValue(int fineValue, CoarseValue coarseValue, ErrorCallback completionHandler); + + void getReferrerOnServer(ReferrerCallback callback); + + void getReferrerOnServerValue(ReferrerKey key, ReferrerCallback callback); } abstract class AffiseDebug { diff --git a/pubspec.yaml b/pubspec.yaml index 232d609..902a3c1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: affise_attribution_lib description: Affise Attribution Flutter plugin. -version: 1.6.19 +version: 1.6.20 homepage: https://affise.com/ environment: