From 9bca54071924c6634d8cae5c735dd7f3fc0f50ac Mon Sep 17 00:00:00 2001 From: Sergey Korney Date: Tue, 6 Aug 2024 20:35:48 +0500 Subject: [PATCH] 1.6.38 --- AffiseAttributionLib.podspec | 2 +- AffiseAttributionLib/Classes/Affise.swift | 28 +++++-- AffiseAttributionLib/Classes/AffiseApi.swift | 3 +- .../Classes/AffiseComponent.swift | 7 +- .../Classes/internal/BuildConfig.swift | 2 +- .../Classes/internal/InternalAffise.swift | 2 +- .../providers/ReferrerProvider.swift | 25 ++++++ .../factory/PropertiesProviderFactory.swift | 8 +- .../RetrieveInstallReferrerUseCase.swift | 65 --------------- .../RetrieveReferrerOnServerUseCase.swift | 45 ++++++++++ .../referrer/RetrieveReferrerUseCase.swift | 31 +++++++ .../Classes/utils/StringUtils.swift | 5 ++ AffiseInternal.podspec | 2 +- AffiseInternal/Classes/AffiseApiMethod.swift | 12 ++- AffiseInternal/Classes/AffiseApiWrapper.swift | 58 +++++++++++-- AffiseModule.podspec | 2 +- .../Classes/AdvertisingModule.swift | 2 +- AffiseModule/Link/Classes/LinkModule.swift | 2 +- .../Status/Classes/StatusModule.swift | 2 +- .../Classes/SubscriptionModule.swift | 2 +- AffiseSKAdNetwork.podspec | 2 +- CHANGELOG.md | 15 ++++ README.md | 82 ++++++++++++------- example/app/Podfile | 2 +- 24 files changed, 279 insertions(+), 127 deletions(-) create mode 100644 AffiseAttributionLib/Classes/parameters/providers/ReferrerProvider.swift delete mode 100644 AffiseAttributionLib/Classes/referrer/RetrieveInstallReferrerUseCase.swift create mode 100644 AffiseAttributionLib/Classes/referrer/RetrieveReferrerOnServerUseCase.swift create mode 100644 AffiseAttributionLib/Classes/referrer/RetrieveReferrerUseCase.swift diff --git a/AffiseAttributionLib.podspec b/AffiseAttributionLib.podspec index c0cf55d..0eec221 100644 --- a/AffiseAttributionLib.podspec +++ b/AffiseAttributionLib.podspec @@ -5,7 +5,7 @@ Pod::Spec.new do |spec| spec.name = "AffiseAttributionLib" - spec.version = ENV['LIB_VERSION'] || "1.6.37" + spec.version = ENV['LIB_VERSION'] || "1.6.38" spec.summary = "Affise Attribution iOS library" spec.description = "Affise SDK is a software you can use to collect app usage statistics, device identifiers, deeplink usage, track install referrer." spec.homepage = "https://github.com/affise/sdk-ios" diff --git a/AffiseAttributionLib/Classes/Affise.swift b/AffiseAttributionLib/Classes/Affise.swift index 8e87b70..beb8706 100644 --- a/AffiseAttributionLib/Classes/Affise.swift +++ b/AffiseAttributionLib/Classes/Affise.swift @@ -158,19 +158,35 @@ public final class Affise: NSObject { } /** - * Get referrer + * Get referrer url */ @objc - public static func getReferrer(_ callback: @escaping OnReferrerCallback) { - api?.retrieveInstallReferrerUseCase.getReferrer(callback) + public static func getReferrerUrl(_ callback: @escaping OnReferrerCallback) { + api?.retrieveReferrerUseCase.getReferrerUrl(callback) } /** - * Get referrer Value + * Get referrer url value */ @objc - public static func getReferrerValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) { - api?.retrieveInstallReferrerUseCase.getReferrerValue(key, callback) + public static func getReferrerUrlValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) { + api?.retrieveReferrerUseCase.getReferrerUrlValue(key, callback) + } + + /** + * Get referrer on server + */ + @objc + public static func getReferrerOnServer(_ callback: @escaping OnReferrerCallback) { + api?.retrieveReferrerOnServerUseCase.getReferrerOnServer(callback) + } + + /** + * Get referrer on server value + */ + @objc + public static func getReferrerOnServerValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) { + api?.retrieveReferrerOnServerUseCase.getReferrerOnServerValue(key, callback) } /** diff --git a/AffiseAttributionLib/Classes/AffiseApi.swift b/AffiseAttributionLib/Classes/AffiseApi.swift index 63d4649..b8053e7 100644 --- a/AffiseAttributionLib/Classes/AffiseApi.swift +++ b/AffiseAttributionLib/Classes/AffiseApi.swift @@ -12,7 +12,8 @@ internal protocol AffiseApi { var initPropertiesStorage: InitPropertiesStorage {get} var preferencesUseCase: PreferencesUseCase {get} var postBackModelFactory: PostBackModelFactory {get} - var retrieveInstallReferrerUseCase: RetrieveInstallReferrerUseCase {get} + var retrieveReferrerUseCase: RetrieveReferrerUseCase {get} + var retrieveReferrerOnServerUseCase: RetrieveReferrerOnServerUseCase {get} var moduleManager: AffiseModuleManager {get} var storeInternalEventUseCase: StoreInternalEventUseCase {get} var debugValidateUseCase: DebugValidateUseCase {get} diff --git a/AffiseAttributionLib/Classes/AffiseComponent.swift b/AffiseAttributionLib/Classes/AffiseComponent.swift index 346025b..53704d5 100644 --- a/AffiseAttributionLib/Classes/AffiseComponent.swift +++ b/AffiseAttributionLib/Classes/AffiseComponent.swift @@ -164,10 +164,13 @@ internal class AffiseComponent: AffiseApi { logsManager: logsManager, deeplinkClickRepository: deeplinkClickRepository, deviceUseCase: deviceUseCase, - remarketingUseCase: remarketingUseCase + remarketingUseCase: remarketingUseCase, + retrieveReferrerUseCase: retrieveReferrerUseCase ).create() - lazy var retrieveInstallReferrerUseCase: RetrieveInstallReferrerUseCase = RetrieveInstallReferrerUseCase( + lazy var retrieveReferrerUseCase: RetrieveReferrerUseCase = RetrieveReferrerUseCase() + + lazy var retrieveReferrerOnServerUseCase: RetrieveReferrerOnServerUseCase = RetrieveReferrerOnServerUseCase( moduleManager: moduleManager ) diff --git a/AffiseAttributionLib/Classes/internal/BuildConfig.swift b/AffiseAttributionLib/Classes/internal/BuildConfig.swift index fda27e7..6aac47f 100644 --- a/AffiseAttributionLib/Classes/internal/BuildConfig.swift +++ b/AffiseAttributionLib/Classes/internal/BuildConfig.swift @@ -1,5 +1,5 @@ import Foundation internal struct BuildConfig { - static let AFFISE_VERSION = "1.6.37" + static let AFFISE_VERSION = "1.6.38" } diff --git a/AffiseAttributionLib/Classes/internal/InternalAffise.swift b/AffiseAttributionLib/Classes/internal/InternalAffise.swift index 018aa7b..716fa6a 100644 --- a/AffiseAttributionLib/Classes/internal/InternalAffise.swift +++ b/AffiseAttributionLib/Classes/internal/InternalAffise.swift @@ -16,7 +16,7 @@ extension Affise { */ @objc public static func handleReferrer(_ url: URL?) { - Affise.getApi()?.retrieveInstallReferrerUseCase.setReferrer(url) + Affise.getApi()?.retrieveReferrerUseCase.setReferrer(url) } /** diff --git a/AffiseAttributionLib/Classes/parameters/providers/ReferrerProvider.swift b/AffiseAttributionLib/Classes/parameters/providers/ReferrerProvider.swift new file mode 100644 index 0000000..925a3bc --- /dev/null +++ b/AffiseAttributionLib/Classes/parameters/providers/ReferrerProvider.swift @@ -0,0 +1,25 @@ +import Foundation + +/** + * Provider for parameter [ProviderType.REFERRER] + */ +class ReferrerProvider: StringPropertyProvider { + + private let useCase: RetrieveReferrerUseCase + + init(_ useCase: RetrieveReferrerUseCase) { + self.useCase = useCase + } + + override func provide() -> String? { + return useCase.getReferrer() + } + + public override func getOrder() -> Float { + 34.0 + } + + public override func getKey() -> ProviderType? { + ProviderType.REFERRER + } +} diff --git a/AffiseAttributionLib/Classes/parameters/providers/factory/PropertiesProviderFactory.swift b/AffiseAttributionLib/Classes/parameters/providers/factory/PropertiesProviderFactory.swift index ed4b8c7..1ffaeb8 100644 --- a/AffiseAttributionLib/Classes/parameters/providers/factory/PropertiesProviderFactory.swift +++ b/AffiseAttributionLib/Classes/parameters/providers/factory/PropertiesProviderFactory.swift @@ -20,6 +20,7 @@ internal class PropertiesProviderFactory { private let deeplinkClickRepository: DeeplinkClickRepository private let deviceUseCase: DeviceUseCase private let remarketingUseCase: RemarketingUseCase + private let retrieveReferrerUseCase: RetrieveReferrerUseCase init(app: UIApplication, bundle: Bundle, @@ -32,7 +33,8 @@ internal class PropertiesProviderFactory { logsManager: LogsManager, deeplinkClickRepository: DeeplinkClickRepository, deviceUseCase: DeviceUseCase, - remarketingUseCase: RemarketingUseCase + remarketingUseCase: RemarketingUseCase, + retrieveReferrerUseCase: RetrieveReferrerUseCase ) { self.app = app self.bundle = bundle @@ -46,6 +48,7 @@ internal class PropertiesProviderFactory { self.deeplinkClickRepository = deeplinkClickRepository self.deviceUseCase = deviceUseCase self.remarketingUseCase = remarketingUseCase + self.retrieveReferrerUseCase = retrieveReferrerUseCase } func create() -> PostBackModelFactory { @@ -119,7 +122,8 @@ internal class PropertiesProviderFactory { PushTokenProvider(preferences: preferences), OsAndVersionProvider(remarketingUseCase), DeviceProvider(remarketingUseCase), - BuildProvider(remarketingUseCase) + BuildProvider(remarketingUseCase), + ReferrerProvider(retrieveReferrerUseCase) ] ) } diff --git a/AffiseAttributionLib/Classes/referrer/RetrieveInstallReferrerUseCase.swift b/AffiseAttributionLib/Classes/referrer/RetrieveInstallReferrerUseCase.swift deleted file mode 100644 index 15a6649..0000000 --- a/AffiseAttributionLib/Classes/referrer/RetrieveInstallReferrerUseCase.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation - -class RetrieveInstallReferrerUseCase { - - private let moduleManager: AffiseModuleManager - private var referrerModule: ReferrerCallback? - private var referrerURL: URL? - - init( - moduleManager: AffiseModuleManager - ) { - self.moduleManager = moduleManager - } - - private func getReffererModule() -> ReferrerCallback? { - if self.referrerModule != nil { - return self.referrerModule - } - guard let module = moduleManager.getModule(.Status) else { return nil } - guard let referrerModule = module as? ReferrerCallback else { return nil } - self.referrerModule = referrerModule - return referrerModule - } - - private func getQueryStringParameter(_ url: String?, _ param: String) -> String? { - guard let url = url else { - return nil - } - guard let url = URLComponents(string: url) else { return nil } - return url.queryItems?.first(where: { $0.name == param })?.value - } - - private func handleReferrer(_ callback: @escaping OnReferrerCallback) { - guard let referrer = referrerURL else { - getReffererModule()?.getReferrer(callback) ?? callback(nil) - return - } - callback(referrer.absoluteString) - } - - /** - * Set referrerURL - */ - func setReferrer(_ url: URL?) { - referrerURL = url - } - - /** - * Return referrerURL - */ - func getReferrer(_ callback: @escaping OnReferrerCallback) { - handleReferrer { value in - callback(value) - } - } - - /** - * Return referrerURL parameter by key - */ - func getReferrerValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) { - handleReferrer { value in - callback(self.getQueryStringParameter(value, key.value())) - } - } -} diff --git a/AffiseAttributionLib/Classes/referrer/RetrieveReferrerOnServerUseCase.swift b/AffiseAttributionLib/Classes/referrer/RetrieveReferrerOnServerUseCase.swift new file mode 100644 index 0000000..9f4354b --- /dev/null +++ b/AffiseAttributionLib/Classes/referrer/RetrieveReferrerOnServerUseCase.swift @@ -0,0 +1,45 @@ +import Foundation + +class RetrieveReferrerOnServerUseCase { + + private let moduleManager: AffiseModuleManager + private var referrerModule: ReferrerCallback? + + init( + moduleManager: AffiseModuleManager + ) { + self.moduleManager = moduleManager + } + + private func getReffererModule() -> ReferrerCallback? { + if self.referrerModule != nil { + return self.referrerModule + } + guard let module = moduleManager.getModule(.Status) else { return nil } + guard let referrerModule = module as? ReferrerCallback else { return nil } + self.referrerModule = referrerModule + return referrerModule + } + + private func handleReferrerOnServer(_ callback: @escaping OnReferrerCallback) { + getReffererModule()?.getReferrer(callback) ?? callback(nil) + } + + /** + * Return referrer on server + */ + func getReferrerOnServer(_ callback: @escaping OnReferrerCallback) { + handleReferrerOnServer { value in + callback(value) + } + } + + /** + * Return referrer on server parameter by key + */ + func getReferrerOnServerValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) { + handleReferrerOnServer { value in + callback(value?.getQueryStringParameter(key.value())) + } + } +} diff --git a/AffiseAttributionLib/Classes/referrer/RetrieveReferrerUseCase.swift b/AffiseAttributionLib/Classes/referrer/RetrieveReferrerUseCase.swift new file mode 100644 index 0000000..b3b1ba9 --- /dev/null +++ b/AffiseAttributionLib/Classes/referrer/RetrieveReferrerUseCase.swift @@ -0,0 +1,31 @@ +import Foundation + +class RetrieveReferrerUseCase { + + private var referrerURL: URL? + + /** + * Set referrerURL + */ + func setReferrer(_ url: URL?) { + referrerURL = url + } + + func getReferrer() -> String? { + return referrerURL?.absoluteString + } + + /** + * Return referrer URL + */ + func getReferrerUrl(_ callback: @escaping OnReferrerCallback) { + callback(referrerURL?.absoluteString) + } + + /** + * Return referrer URL parameter by key + */ + func getReferrerUrlValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) { + callback(referrerURL?.absoluteString.getQueryStringParameter(key.value())) + } +} diff --git a/AffiseAttributionLib/Classes/utils/StringUtils.swift b/AffiseAttributionLib/Classes/utils/StringUtils.swift index a7421b6..a64e105 100644 --- a/AffiseAttributionLib/Classes/utils/StringUtils.swift +++ b/AffiseAttributionLib/Classes/utils/StringUtils.swift @@ -29,6 +29,11 @@ public extension String { var isBlank: Bool { return allSatisfy { $0.isWhitespace } } + + internal func getQueryStringParameter(_ param: String) -> String? { + guard let url = URLComponents(string: self) else { return nil } + return url.queryItems?.first(where: { $0.name == param })?.value + } } diff --git a/AffiseInternal.podspec b/AffiseInternal.podspec index 4745f61..b81a0d5 100644 --- a/AffiseInternal.podspec +++ b/AffiseInternal.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |spec| spec.name = "AffiseInternal" - spec.version = ENV['LIB_VERSION'] || "1.6.37" + spec.version = ENV['LIB_VERSION'] || "1.6.38" spec.summary = "Affise Internal library" spec.description = "Affise Internal wrapper library for crossplatform" spec.homepage = "https://github.com/affise/sdk-ios" diff --git a/AffiseInternal/Classes/AffiseApiMethod.swift b/AffiseInternal/Classes/AffiseApiMethod.swift index 6329d1b..2fe801d 100644 --- a/AffiseInternal/Classes/AffiseApiMethod.swift +++ b/AffiseInternal/Classes/AffiseApiMethod.swift @@ -26,8 +26,10 @@ public enum AffiseApiMethod: Int { case GET_PROVIDERS case IS_FIRST_RUN // callback - case GET_REFERRER_CALLBACK - case GET_REFERRER_VALUE_CALLBACK + case GET_REFERRER_URL_CALLBACK + case GET_REFERRER_URL_VALUE_CALLBACK + case GET_REFERRER_ON_SERVER_CALLBACK + case GET_REFERRER_ON_SERVER_VALUE_CALLBACK case REGISTER_DEEPLINK_CALLBACK case SKAD_REGISTER_ERROR_CALLBACK case SKAD_POSTBACK_ERROR_CALLBACK @@ -73,8 +75,10 @@ public enum AffiseApiMethod: Int { case .GET_PROVIDERS: return "get_providers" case .IS_FIRST_RUN: return "is_first_run" // callback - case .GET_REFERRER_CALLBACK: return "get_referrer_callback" - case .GET_REFERRER_VALUE_CALLBACK: return "get_referrer_value_callback" + case .GET_REFERRER_URL_CALLBACK: return "get_referrer_url_callback" + case .GET_REFERRER_URL_VALUE_CALLBACK: return "get_referrer_url_value_callback" + case .GET_REFERRER_ON_SERVER_CALLBACK: return "get_referrer_on_server_callback" + case .GET_REFERRER_ON_SERVER_VALUE_CALLBACK: return "get_referrer_on_server_value_callback" case .REGISTER_DEEPLINK_CALLBACK: return "register_deeplink_callback" case .SKAD_REGISTER_ERROR_CALLBACK: return "skad_register_error_callback" case .SKAD_POSTBACK_ERROR_CALLBACK: return "skad_postback_error_callback" diff --git a/AffiseInternal/Classes/AffiseApiWrapper.swift b/AffiseInternal/Classes/AffiseApiWrapper.swift index 3f8e82f..69ac9d0 100644 --- a/AffiseInternal/Classes/AffiseApiWrapper.swift +++ b/AffiseInternal/Classes/AffiseApiWrapper.swift @@ -87,8 +87,10 @@ public class AffiseApiWrapper: NSObject { case .GET_RANDOM_DEVICE_ID: callGetRandomDeviceId(api, map: map, result: result) case .GET_PROVIDERS: callGetProviders(api, map: map, result: result) case .IS_FIRST_RUN: callIsFirstRun(api, map: map, result: result) - case .GET_REFERRER_CALLBACK: callGetReferrer(api, map: map, result: result) - case .GET_REFERRER_VALUE_CALLBACK: callGetReferrerValue(api, map: map, result: result) + case .GET_REFERRER_URL_CALLBACK: callGetReferrerUrl(api, map: map, result: result) + case .GET_REFERRER_URL_VALUE_CALLBACK: callGetReferrerUrlValue(api, map: map, result: result) + case .GET_REFERRER_ON_SERVER_CALLBACK: callGetReferrerOnServer(api, map: map, result: result) + case .GET_REFERRER_ON_SERVER_VALUE_CALLBACK: callGetReferrerOnServerValue(api, map: map, result: result) case .REGISTER_DEEPLINK_CALLBACK: callRegisterDeeplinkCallback(api, map: map, result: result) case .SKAD_REGISTER_ERROR_CALLBACK: callSkadRegisterErrorCallback(api, map: map, result: result) case .SKAD_POSTBACK_ERROR_CALLBACK: callSkadPostbackErrorCallback(api, map: map, result: result) @@ -304,13 +306,13 @@ public class AffiseApiWrapper: NSObject { result?.success(Affise.isFirstRun()) } - private func callGetReferrer(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { + private func callGetReferrerUrl(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { guard let uuid: String = map.opt(UUID) else { result?.error("api [\(api.method)]: no valid Callback UUID") return } - Affise.getReferrer { referrer in + Affise.getReferrerUrl { referrer in let data: [String: Any?] = [ self.UUID: uuid, api.method: referrer, @@ -321,7 +323,7 @@ public class AffiseApiWrapper: NSObject { result?.success(nil) } - private func callGetReferrerValue(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { + private func callGetReferrerUrlValue(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { guard let uuid: String = map.opt(UUID) else { result?.error("api [\(api.method)]: no valid Callback UUID") return @@ -337,7 +339,7 @@ public class AffiseApiWrapper: NSObject { return } - Affise.getReferrerValue(key) { value in + Affise.getReferrerUrlValue(key) { value in let data: [String: Any?] = [ self.UUID: uuid, api.method: value, @@ -347,7 +349,51 @@ public class AffiseApiWrapper: NSObject { result?.success(nil) } + + private func callGetReferrerOnServer(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { + guard let uuid: String = map.opt(UUID) else { + result?.error("api [\(api.method)]: no valid Callback UUID") + return + } + + Affise.getReferrerOnServer { referrer in + let data: [String: Any?] = [ + self.UUID: uuid, + api.method: referrer, + ] + self.callback?(api.method, data) + } + + result?.success(nil) + } + + private func callGetReferrerOnServerValue(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { + guard let uuid: String = map.opt(UUID) else { + result?.error("api [\(api.method)]: no valid Callback UUID") + return + } + guard let name: String = map.opt(api) else { + result?.error("api [\(api.method)]: value not set") + return + } + + guard let key: ReferrerKey = ReferrerKey.from(name) else { + result?.error("api [\(api.method)]: no valid ReferrerKey") + return + } + + Affise.getReferrerOnServerValue(key) { value in + let data: [String: Any?] = [ + self.UUID: uuid, + api.method: value, + ] + self.callback?(api.method, data) + } + + result?.success(nil) + } + private func callRegisterDeeplinkCallback(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { Affise.registerDeeplinkCallback { value in let data: [String: Any?] = [ diff --git a/AffiseModule.podspec b/AffiseModule.podspec index 15fdd54..0366ba5 100644 --- a/AffiseModule.podspec +++ b/AffiseModule.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "AffiseModule" - s.version = ENV["LIB_VERSION"] || "1.6.37" + s.version = ENV["LIB_VERSION"] || "1.6.38" s.summary = "Affise Modules" s.description = "Affise module collection" s.homepage = "https://github.com/affise/sdk-ios" diff --git a/AffiseModule/Advertising/Classes/AdvertisingModule.swift b/AffiseModule/Advertising/Classes/AdvertisingModule.swift index 2a76bea..4d69ad4 100644 --- a/AffiseModule/Advertising/Classes/AdvertisingModule.swift +++ b/AffiseModule/Advertising/Classes/AdvertisingModule.swift @@ -4,7 +4,7 @@ import Foundation @objc(AffiseAdvertisingModule) public final class AdvertisingModule: AffiseModule { - public override var version: String { "1.6.37" } + public override var version: String { "1.6.38" } private lazy var advertisingIdManager: AdvertisingIdManager = AdvertisingIdManagerImpl() diff --git a/AffiseModule/Link/Classes/LinkModule.swift b/AffiseModule/Link/Classes/LinkModule.swift index ed77835..ea2d770 100644 --- a/AffiseModule/Link/Classes/LinkModule.swift +++ b/AffiseModule/Link/Classes/LinkModule.swift @@ -5,7 +5,7 @@ import AffiseAttributionLib @objc(AffiseLinkModule) public final class LinkModule: AffiseModule { - public override var version: String { "1.6.37" } + public override var version: String { "1.6.38" } private var useCase: LinkResolveUseCase? = nil diff --git a/AffiseModule/Status/Classes/StatusModule.swift b/AffiseModule/Status/Classes/StatusModule.swift index 28f0a34..c0e121f 100644 --- a/AffiseModule/Status/Classes/StatusModule.swift +++ b/AffiseModule/Status/Classes/StatusModule.swift @@ -5,7 +5,7 @@ import AffiseAttributionLib @objc(AffiseStatusModule) public final class StatusModule: AffiseModule { - public override var version: String { "1.6.37" } + public override var version: String { "1.6.38" } private var checkStatusUseCase: CheckStatusUseCase? = nil private var referrerUseCase: ReferrerUseCase? = nil diff --git a/AffiseModule/Subscription/Classes/SubscriptionModule.swift b/AffiseModule/Subscription/Classes/SubscriptionModule.swift index 01c76dd..159aab8 100644 --- a/AffiseModule/Subscription/Classes/SubscriptionModule.swift +++ b/AffiseModule/Subscription/Classes/SubscriptionModule.swift @@ -6,7 +6,7 @@ import AffiseAttributionLib @objc(AffiseSubscriptionModule) public final class SubscriptionModule: AffiseModule { - public override var version: String { "1.6.37" } + public override var version: String { "1.6.38" } lazy var storeManager: StoreManager = StoreManager() diff --git a/AffiseSKAdNetwork.podspec b/AffiseSKAdNetwork.podspec index 9961845..1c89bda 100644 --- a/AffiseSKAdNetwork.podspec +++ b/AffiseSKAdNetwork.podspec @@ -5,7 +5,7 @@ Pod::Spec.new do |spec| spec.name = "AffiseSKAdNetwork" - spec.version = ENV['LIB_VERSION'] || "1.6.37" + spec.version = ENV['LIB_VERSION'] || "1.6.38" spec.summary = "AffiseSKAdNetwork iOS library" spec.description = "Affise library for StoreKit Ad Network (SKAdNetwork)" spec.homepage = "https://github.com/affise/sdk-ios" diff --git a/CHANGELOG.md b/CHANGELOG.md index e9cd443..ce20785 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.6.38] - 2024-08-06 + +### Added + +- Api `Affise.getReferrerUrl`. +- Api `Affise.getReferrerUrlValue`. +- Api `Affise.getReferrerOnServer`. +- Api `Affise.getReferrerOnServerValue`. + +### Removed + +- Api `Affise.getReferrer`. +- Api `Affise.getReferrerValue`. + ## [1.6.37] - 2024-08-05 ### Added @@ -86,6 +100,7 @@ - Improve `AffiseModuleManager` - Update for demo app +[1.6.38]: https://github.com/affise/sdk-ios/compare/1.6.37...1.6.38 [1.6.37]: https://github.com/affise/sdk-ios/compare/1.6.36...1.6.37 [1.6.36]: https://github.com/affise/sdk-ios/compare/1.6.35...1.6.36 [1.6.35]: https://github.com/affise/sdk-ios/compare/1.6.34...1.6.35 diff --git a/README.md b/README.md index 020093c..ffce2f8 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ | Pod | Version | | ---- |:-------:| -| `AffiseAttributionLib` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/a/9/3/AffiseAttributionLib) | -| `AffiseSKAdNetwork` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/3/6/f/AffiseSKAdNetwork) | -| `AffiseModule/Advertising` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | -| `AffiseModule/Link` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | -| `AffiseModule/Status` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | +| `AffiseAttributionLib` | [`1.6.38`](https://github.com/CocoaPods/Specs/tree/master/Specs/a/9/3/AffiseAttributionLib) | +| `AffiseSKAdNetwork` | [`1.6.38`](https://github.com/CocoaPods/Specs/tree/master/Specs/3/6/f/AffiseSKAdNetwork) | +| `AffiseModule/Advertising` | [`1.6.38`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | +| `AffiseModule/Link` | [`1.6.38`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | +| `AffiseModule/Status` | [`1.6.38`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | - [Affise Attribution iOS Library](#affise-attribution-ios-library) - [Description](#description) @@ -47,7 +47,9 @@ - [Is first run](#is-first-run) - [Get referrer](#get-referrer) - [Get referrer parameter](#get-referrer-parameter) - - [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) - [WebView tracking](#webview-tracking) - [Initialize WebView](#initialize-webview) @@ -80,22 +82,22 @@ To add the SDK using Cocoapods, specify the version you want to use in your Podf ```ruby # Affise SDK library -pod 'AffiseAttributionLib', '~> 1.6.37' +pod 'AffiseAttributionLib', '~> 1.6.38' # Affise modules -pod 'AffiseModule/Advertising', '~> 1.6.37' -pod 'AffiseModule/Link', '~> 1.6.37' -pod 'AffiseModule/Status', '~> 1.6.37' +pod 'AffiseModule/Advertising', '~> 1.6.38' +pod 'AffiseModule/Link', '~> 1.6.38' +pod 'AffiseModule/Status', '~> 1.6.38' ``` Get source directly from GitHub ```ruby # Affise SDK library -pod 'AffiseAttributionLib', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37' +pod 'AffiseAttributionLib', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.38' # Affise modules -pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37' -pod 'AffiseModule/Link', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37' -pod 'AffiseModule/Status', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37' +pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.38' +pod 'AffiseModule/Link', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.38' +pod 'AffiseModule/Status', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.38' ``` ### Integrate as Swift Package Manager @@ -197,9 +199,9 @@ Affise | Module | Version | Start | | ------------- |:------------------------------------------------------------------------------------:|----------| -| `Advertising` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` | -| `Link` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | -| `Status` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | +| `Advertising` | [`1.6.38`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` | +| `Link` | [`1.6.38`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | +| `Status` | [`1.6.38`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | If module start type is `manual`, then call: @@ -263,14 +265,14 @@ To add the SDK using Cocoapods, specify the version you want to use in your Podf ```ruby # Wrapper for StoreKit Ad Network -pod 'AffiseSKAdNetwork', '~> 1.6.37' +pod 'AffiseSKAdNetwork', '~> 1.6.38' ``` Get source directly from GitHub ```ruby # Wrapper for StoreKit Ad Network -pod 'AffiseSKAdNetwork', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37' +pod 'AffiseSKAdNetwork', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.38' ``` For `swift` use: @@ -965,10 +967,6 @@ Affise.isFirstRun() ## Get referrer -> **Note** -> -> Requires [Affise Status Module](#modules) - - Add referrer handler to `AppDelegate.swift` ```swift @@ -985,17 +983,13 @@ func application( Use the next public method of SDK ```swift -Affise.getReferrer { referrer in +Affise.getReferrerUrl { referrer in // handle referrer } ``` ## Get referrer parameter -> **Note** -> -> Requires [Affise Status Module](#modules) - - Add referrer handler to `AppDelegate.swift` ```swift @@ -1012,12 +1006,40 @@ func application( Use the next public method of SDK to get referrer parameter by ```swift -Affise.getReferrerValue(ReferrerKey.CLICK_ID) { value in +Affise.getReferrerUrlValue(ReferrerKey.CLICK_ID) { value in + // handle referrer value +} +``` + +## Get referrer on server + +> **Note** +> +> Requires [Affise Status Module](#modules) + +Use the next public method of SDK + +```swift +Affise.getReferrerOnServer { referrer in + // handle referrer +} +``` + +## Get referrer on server parameter + +> **Note** +> +> Requires [Affise Status Module](#modules) + +Use the next public method of SDK to get referrer parameter by + +```swift +Affise.getReferrerOnServerValue(ReferrerKey.CLICK_ID) { value in // handle referrer value } ``` -### Referrer keys +## Referrer keys In examples above `ReferrerKey.CLICK_ID` is used, but many others is available: diff --git a/example/app/Podfile b/example/app/Podfile index d8c357a..cd9879a 100644 --- a/example/app/Podfile +++ b/example/app/Podfile @@ -8,6 +8,6 @@ workspace 'app' target 'app' do pod 'AffiseAttributionLib', :path => '../../' pod 'AffiseSKAdNetwork', :path => '../../' - # pod 'AffiseInternal', :path => '../../' pod 'AffiseModule', :path => '../../' + # pod 'AffiseInternal', :path => '../../' end