From f2d0c525d9f36e912f926d96ef18747203a8f310 Mon Sep 17 00:00:00 2001 From: Sergey Korney Date: Tue, 12 Mar 2024 18:31:20 +0500 Subject: [PATCH] 1.6.27 --- AffiseAttributionLib.podspec | 2 +- AffiseAttributionLib/Classes/Affise.swift | 7 ++++ .../init/AffSDKVersionProvider.swift | 2 +- .../Classes/usecase/FirstAppOpenUseCase.swift | 11 ++++++ AffiseInternal.podspec | 2 +- AffiseInternal/Classes/AffiseApiMethod.swift | 2 ++ AffiseInternal/Classes/AffiseApiWrapper.swift | 5 +++ AffiseModule.podspec | 2 +- AffiseSKAdNetwork.podspec | 2 +- README.md | 35 +++++++++++-------- 10 files changed, 51 insertions(+), 19 deletions(-) diff --git a/AffiseAttributionLib.podspec b/AffiseAttributionLib.podspec index 359b30b..aaee19e 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.26" + spec.version = ENV['LIB_VERSION'] || "1.6.27" 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 9741670..59f011f 100644 --- a/AffiseAttributionLib/Classes/Affise.swift +++ b/AffiseAttributionLib/Classes/Affise.swift @@ -205,6 +205,13 @@ public final class Affise: NSObject { public static func getProviders() -> [ProviderType:Any?] { return api?.postBackModelFactory.getProvidersMap().toMap() ?? [:] } + + /** + * Is it first run + */ + public static func isFirstRun() -> Bool { + return api?.firstAppOpenUseCase.isFirstRun() ?? true + } /** * Get module status diff --git a/AffiseAttributionLib/Classes/parameters/providers/init/AffSDKVersionProvider.swift b/AffiseAttributionLib/Classes/parameters/providers/init/AffSDKVersionProvider.swift index a48944e..2489061 100644 --- a/AffiseAttributionLib/Classes/parameters/providers/init/AffSDKVersionProvider.swift +++ b/AffiseAttributionLib/Classes/parameters/providers/init/AffSDKVersionProvider.swift @@ -6,7 +6,7 @@ import Foundation class AffSDKVersionProvider: StringPropertyProvider { override func provide() -> String? { - return "1.6.26" + return "1.6.27" } public override func getOrder() -> Float { diff --git a/AffiseAttributionLib/Classes/usecase/FirstAppOpenUseCase.swift b/AffiseAttributionLib/Classes/usecase/FirstAppOpenUseCase.swift index 1ed0aa5..3cefead 100644 --- a/AffiseAttributionLib/Classes/usecase/FirstAppOpenUseCase.swift +++ b/AffiseAttributionLib/Classes/usecase/FirstAppOpenUseCase.swift @@ -9,6 +9,7 @@ internal class FirstAppOpenUseCase { private let AFF_ALT_DEVICE_ID = "AFF_ALT_DEVICE_ID" private let preferences: UserDefaults + private var firstRun: Bool = false init(preferences: UserDefaults) { self.preferences = preferences @@ -21,6 +22,8 @@ internal class FirstAppOpenUseCase { if (preferences.value(forKey: FIRST_OPENED_DATE_KEY) == nil) { onAppFirstOpen() } + + firstRun = preferences.value(forKey: FIRST_OPENED) as? Bool ?? true } /** @@ -63,6 +66,14 @@ internal class FirstAppOpenUseCase { return value } + /** + * Get first run + * @return is first run + */ + func isFirstRun() -> Bool { + return firstRun + } + /** * Get first open date * @return first open date diff --git a/AffiseInternal.podspec b/AffiseInternal.podspec index 5e57eda..44e32f1 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.26" + spec.version = ENV['LIB_VERSION'] || "1.6.27" 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 0bf758f..c14e963 100644 --- a/AffiseInternal/Classes/AffiseApiMethod.swift +++ b/AffiseInternal/Classes/AffiseApiMethod.swift @@ -25,6 +25,7 @@ public enum AffiseApiMethod: Int { case GET_PROVIDERS case MODULE_START case GET_MODULES_INSTALLED + case IS_FIRST_RUN // callback case GET_REFERRER_CALLBACK case GET_REFERRER_VALUE_CALLBACK @@ -63,6 +64,7 @@ public enum AffiseApiMethod: Int { case .GET_PROVIDERS: return "get_providers" case .MODULE_START: return "module_start" case .GET_MODULES_INSTALLED: return "get_modules_installed" + 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" diff --git a/AffiseInternal/Classes/AffiseApiWrapper.swift b/AffiseInternal/Classes/AffiseApiWrapper.swift index be8410e..3905444 100644 --- a/AffiseInternal/Classes/AffiseApiWrapper.swift +++ b/AffiseInternal/Classes/AffiseApiWrapper.swift @@ -85,6 +85,7 @@ public class AffiseApiWrapper: NSObject { case .GET_PROVIDERS: callGetProviders(api, map: map, result: result) case .MODULE_START: callModuleStart(api, map: map, result: result) case .GET_MODULES_INSTALLED: callGetModulesInstalled(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_STATUS_CALLBACK: callGetStatusCallback(api, map: map, result: result) @@ -276,6 +277,10 @@ public class AffiseApiWrapper: NSObject { result?.success(data) } + private func callIsFirstRun(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { + result?.success(Affise.isFirstRun()) + } + private func callGetReferrer(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) { guard let uuid: String = map.opt(UUID) else { result?.error("api [\(api.method)]: no valid Callback UUID") diff --git a/AffiseModule.podspec b/AffiseModule.podspec index 55b3e4f..40c745d 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.26" + s.version = ENV["LIB_VERSION"] || "1.6.27" s.summary = "Affise Modules" s.description = "Affise module collection" s.homepage = "https://github.com/affise/sdk-ios" diff --git a/AffiseSKAdNetwork.podspec b/AffiseSKAdNetwork.podspec index 5d06972..521fe27 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.26" + spec.version = ENV['LIB_VERSION'] || "1.6.27" 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/README.md b/README.md index 89a0ac6..8860931 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ | Pod | Version | | ---- |:-------:| -| `AffiseAttributionLib` | [`1.6.26`](https://github.com/CocoaPods/Specs/tree/master/Specs/a/9/3/AffiseAttributionLib) | -| `AffiseSKAdNetwork` | [`1.6.26`](https://github.com/CocoaPods/Specs/tree/master/Specs/3/6/f/AffiseSKAdNetwork) | -| `AffiseModule/Advertising` | [`1.6.26`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | -| `AffiseModule/Status` | [`1.6.26`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | +| `AffiseAttributionLib` | [`1.6.27`](https://github.com/CocoaPods/Specs/tree/master/Specs/a/9/3/AffiseAttributionLib) | +| `AffiseSKAdNetwork` | [`1.6.27`](https://github.com/CocoaPods/Specs/tree/master/Specs/3/6/f/AffiseSKAdNetwork) | +| `AffiseModule/Advertising` | [`1.6.27`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | +| `AffiseModule/Status` | [`1.6.27`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | - [Affise Attribution iOS Library](#affise-attribution-ios-library) - [Description](#description) @@ -38,6 +38,7 @@ - [Get random user Id](#get-random-user-id) - [Get random device Id](#get-random-device-id) - [Get providers](#get-providers) + - [Is first run](#is-first-run) - [Get referrer](#get-referrer) - [Get referrer parameter](#get-referrer-parameter) - [Referrer keys](#referrer-keys) @@ -73,20 +74,20 @@ To add the SDK using Cocoapods, specify the version you want to use in your Podf ```ruby # Affise SDK library -pod 'AffiseAttributionLib', '~> 1.6.26' +pod 'AffiseAttributionLib', '~> 1.6.27' # Affise modules -pod 'AffiseModule/Advertising', '~> 1.6.26' -pod 'AffiseModule/Status', '~> 1.6.26' +pod 'AffiseModule/Advertising', '~> 1.6.27' +pod 'AffiseModule/Status', '~> 1.6.27' ``` Get source directly from GitHub ```ruby # Affise SDK library -pod 'AffiseAttributionLib', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.26' +pod 'AffiseAttributionLib', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.27' # Affise modules -pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.26' -pod 'AffiseModule/Status', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.26' +pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.27' +pod 'AffiseModule/Status', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.27' ``` ### Integrate as Swift Package Manager @@ -188,8 +189,8 @@ Affise | Module | Version | Start | | ------------- |:------------------------------------------------------------------------------------:|----------| -| `Advertising` | [`1.6.26`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` | -| `Status` | [`1.6.26`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | +| `Advertising` | [`1.6.27`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` | +| `Status` | [`1.6.27`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | If module start type is `manual`, then call: @@ -241,14 +242,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.26' +pod 'AffiseSKAdNetwork', '~> 1.6.27' ``` Get source directly from GitHub ```ruby # Wrapper for StoreKit Ad Network -pod 'AffiseSKAdNetwork', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.26' +pod 'AffiseSKAdNetwork', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.27' ``` For `swift` use: @@ -815,6 +816,12 @@ let key = ProviderType.AFFISE_APP_TOKEN let value = providers[key] ``` +## Is first run + +```swift +Affise.isFirstRun() +``` + ## Get referrer > **Note**