diff --git a/AffiseAttributionLib.podspec b/AffiseAttributionLib.podspec index de91545..3f2caa5 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.21" + spec.version = ENV['LIB_VERSION'] || "1.6.22" 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/events/EventsManager.swift b/AffiseAttributionLib/Classes/events/EventsManager.swift index b907ae6..e021da5 100644 --- a/AffiseAttributionLib/Classes/events/EventsManager.swift +++ b/AffiseAttributionLib/Classes/events/EventsManager.swift @@ -71,18 +71,25 @@ class EventsManager { * Start timer fo repeat send events */ private func startTimer() { - //Stop timer if running - stopTimer() - - //Create timer - timer = Timer(timeInterval: EventsManager.TIME_SEND_REPEAT, - target: self, - selector: #selector(fireTimer), - userInfo: nil, - repeats: true) - - DispatchQueue.main.async { - RunLoop.current.add(self.timer!, forMode: .common) + lockQueue.async(flags: .barrier) { + //Stop timer if running + self.stopTimer() + + //Create timer + let timer = Timer( + timeInterval: EventsManager.TIME_SEND_REPEAT, + target: self, + selector: #selector(self.fireTimer), + userInfo: nil, + repeats: true + ) + + self.setTimer(timer) + + DispatchQueue.main.async { + guard let timer = self.getTimer() else { return } + RunLoop.current.add(timer, forMode: .common) + } } } @@ -90,10 +97,11 @@ class EventsManager { * Stop timer fo repeat send events */ private func stopTimer() { - if timer == nil { return } - //Stop timer - timer?.invalidate() - timer = nil + lockQueue.async(flags: .barrier) { + if self.timer == nil { return } + self.timer?.invalidate() + self.timer = nil + } } @objc @@ -104,4 +112,18 @@ class EventsManager { //Stop timer stopTimer() } + + private let lockQueue = DispatchQueue(label: "com.affise.EventsManager", attributes: .concurrent) + + func getTimer() -> Timer? { + lockQueue.sync { + return timer + } + } + + func setTimer(_ timer: Timer?) { + lockQueue.async(flags: .barrier) { + self.timer = timer + } + } } diff --git a/AffiseAttributionLib/Classes/parameters/providers/init/AffSDKVersionProvider.swift b/AffiseAttributionLib/Classes/parameters/providers/init/AffSDKVersionProvider.swift index e0cda14..5e2f698 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.21" + return "1.6.22" } public override func getOrder() -> Float { diff --git a/AffiseInternal.podspec b/AffiseInternal.podspec index 87eb3b5..5f3d2d5 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.21" + spec.version = ENV['LIB_VERSION'] || "1.6.22" spec.summary = "Affise Internal library" spec.description = "Affise Internal wrapper library for crossplatform" spec.homepage = "https://github.com/affise/sdk-ios" diff --git a/AffiseModule.podspec b/AffiseModule.podspec index 285cae0..8c9920d 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.21" + s.version = ENV["LIB_VERSION"] || "1.6.22" 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 859b861..d6b8cad 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.21" + spec.version = ENV['LIB_VERSION'] || "1.6.22" 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 7386e7a..3b60137 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ | Pod | Version | | ---- |:-------:| -| `AffiseAttributionLib` | [`1.6.21`](https://github.com/CocoaPods/Specs/tree/master/Specs/a/9/3/AffiseAttributionLib) | -| `AffiseSKAdNetwork` | [`1.6.21`](https://github.com/CocoaPods/Specs/tree/master/Specs/3/6/f/AffiseSKAdNetwork) | -| `AffiseModule/Advertising` | [`1.6.21`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | -| `AffiseModule/Status` | [`1.6.21`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | +| `AffiseAttributionLib` | [`1.6.22`](https://github.com/CocoaPods/Specs/tree/master/Specs/a/9/3/AffiseAttributionLib) | +| `AffiseSKAdNetwork` | [`1.6.22`](https://github.com/CocoaPods/Specs/tree/master/Specs/3/6/f/AffiseSKAdNetwork) | +| `AffiseModule/Advertising` | [`1.6.22`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | +| `AffiseModule/Status` | [`1.6.22`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | - [Affise Attribution iOS Library](#affise-attribution-ios-library) - [Description](#description) @@ -73,20 +73,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.21' +pod 'AffiseAttributionLib', '~> 1.6.22' # Affise modules -pod 'AffiseModule/Advertising', '~> 1.6.21' -pod 'AffiseModule/Status', '~> 1.6.21' +pod 'AffiseModule/Advertising', '~> 1.6.22' +pod 'AffiseModule/Status', '~> 1.6.22' ``` Get source directly from GitHub ```ruby # Affise SDK library -pod 'AffiseAttributionLib', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.21' +pod 'AffiseAttributionLib', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.22' # Affise modules -pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.21' -pod 'AffiseModule/Status', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.21' +pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.22' +pod 'AffiseModule/Status', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.22' ``` ### Integrate as Swift Package Manager @@ -188,8 +188,8 @@ Affise | Module | Version | Start | | ------------- |:------------------------------------------------------------------------------------:|----------| -| `Advertising` | [`1.6.21`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` | -| `Status` | [`1.6.21`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | +| `Advertising` | [`1.6.22`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` | +| `Status` | [`1.6.22`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` | If module start type is `manual`, then call: @@ -241,14 +241,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.21' +pod 'AffiseSKAdNetwork', '~> 1.6.22' ``` Get source directly from GitHub ```ruby # Wrapper for StoreKit Ad Network -pod 'AffiseSKAdNetwork', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.21' +pod 'AffiseSKAdNetwork', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.22' ``` For `swift` use: