Skip to content

Commit

Permalink
1.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Korney committed Aug 18, 2023
1 parent 8959994 commit 4c6ad78
Show file tree
Hide file tree
Showing 17 changed files with 157 additions and 24 deletions.
2 changes: 1 addition & 1 deletion AffiseAttributionLib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Pod::Spec.new do |spec|
spec.name = "AffiseAttributionLib"
spec.version = ENV['LIB_VERSION'] || "1.6.5"
spec.version = ENV['LIB_VERSION'] || "1.6.6"
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@
2B9FA7A72A5C36D300942EA5 /* ToSnakeCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B9FA7A62A5C36D300942EA5 /* ToSnakeCase.swift */; };
2B9FA7A92A5C3A0000942EA5 /* AffiseProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B9FA7A82A5C3A0000942EA5 /* AffiseProperty.swift */; };
2BE995682A6C4559001E4060 /* EventName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE995672A6C4559001E4060 /* EventName.swift */; };
2BEEE4672A8FF1CC008AEDAB /* PredefinedCustom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BEEE4632A8FF1CC008AEDAB /* PredefinedCustom.swift */; };
2BEEE4682A8FF1CC008AEDAB /* PredefinedGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BEEE4642A8FF1CC008AEDAB /* PredefinedGroup.swift */; };
7C1642D728BCDB6E007A1FAB /* LastSessionTimeProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C1642D628BCDB6E007A1FAB /* LastSessionTimeProvider.swift */; };
7C7F5650289650AA0062DA71 /* AffiseAttributionLib.docc in Sources */ = {isa = PBXBuildFile; fileRef = 7C7F564F289650AA0062DA71 /* AffiseAttributionLib.docc */; };
7C7F5656289650AA0062DA71 /* AffiseAttributionLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C7F564B289650AA0062DA71 /* AffiseAttributionLib.framework */; };
Expand Down Expand Up @@ -435,6 +437,8 @@
2B9FA7A62A5C36D300942EA5 /* ToSnakeCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToSnakeCase.swift; sourceTree = "<group>"; };
2B9FA7A82A5C3A0000942EA5 /* AffiseProperty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AffiseProperty.swift; sourceTree = "<group>"; };
2BE995672A6C4559001E4060 /* EventName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventName.swift; sourceTree = "<group>"; };
2BEEE4632A8FF1CC008AEDAB /* PredefinedCustom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PredefinedCustom.swift; path = parameters/PredefinedCustom.swift; sourceTree = "<group>"; };
2BEEE4642A8FF1CC008AEDAB /* PredefinedGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PredefinedGroup.swift; path = parameters/PredefinedGroup.swift; sourceTree = "<group>"; };
7C1642D628BCDB6E007A1FAB /* LastSessionTimeProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LastSessionTimeProvider.swift; sourceTree = "<group>"; };
7C7F564B289650AA0062DA71 /* AffiseAttributionLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AffiseAttributionLib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7C7F564E289650AA0062DA71 /* AffiseAttributionLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AffiseAttributionLib.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -705,7 +709,9 @@
isa = PBXGroup;
children = (
2B5128282A5F158800FA1F52 /* Predefined.swift */,
2BEEE4632A8FF1CC008AEDAB /* PredefinedCustom.swift */,
2B5128262A5F158800FA1F52 /* PredefinedFloat.swift */,
2BEEE4642A8FF1CC008AEDAB /* PredefinedGroup.swift */,
2B51282B2A5F158900FA1F52 /* PredefinedListObject.swift */,
2B5128252A5F158800FA1F52 /* PredefinedListString.swift */,
2B5128292A5F158800FA1F52 /* PredefinedLong.swift */,
Expand Down Expand Up @@ -1283,6 +1289,7 @@
1053B24C28DCDC28004FD4B3 /* PushTokenProvider.swift in Sources */,
7C9789C928965770009CE639 /* NetworkServiceImpl.swift in Sources */,
7C9789CA28965770009CE639 /* SessionManager.swift in Sources */,
2BEEE4672A8FF1CC008AEDAB /* PredefinedCustom.swift in Sources */,
2B7A55B32A6EBF21003780DA /* InternalCrossPlatform.swift in Sources */,
8481C9D429B632B200FAAE4B /* AffiseFlag.swift in Sources */,
7C9789CB28965770009CE639 /* SessionManagerImpl.swift in Sources */,
Expand Down Expand Up @@ -1383,6 +1390,7 @@
1053B28528EB38F4004FD4B3 /* ApplicationLifecyclePreferencesRepositoryImpl.swift in Sources */,
10C07E0F28B6B9C300A903FD /* CustomId04Event.swift in Sources */,
10C07E2D28B6BA0E00A903FD /* SubscriptionParameters.swift in Sources */,
2BEEE4682A8FF1CC008AEDAB /* PredefinedGroup.swift in Sources */,
10C07E1728B6B9C300A903FD /* CompleteTrialEvent.swift in Sources */,
2B5128342A5F161400FA1F52 /* Provider+Extension.swift in Sources */,
10B173E328CF572000E96EA8 /* DeviceManufacturerProvider.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public class Affise: NSObject {
self.api = AffiseComponent(app: app, initProperties: initProperties, launchOptions: launchOptions)
}
}

@objc
public func isInitialized() -> Bool {
return self.api?.isInitialized() ?? false
}

/**
* Send events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ internal protocol AffiseApi {
var initPropertiesStorage: InitPropertiesStorage {get}
var preferencesUseCase: PreferencesUseCase {get}
var postBackModelFactory: PostBackModelFactory {get}

func isInitialized() -> Bool
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ internal class AffiseComponent: AffiseApi {
private let app: UIApplication
private let initProperties: AffiseInitProperties
private let launchOptions: [UIApplication.LaunchOptionsKey: Any]?
private var isReady: Bool = false

init(app: UIApplication,
initProperties: AffiseInitProperties,
Expand All @@ -34,6 +35,11 @@ internal class AffiseComponent: AffiseApi {
deeplinkManager.initialize(launchOptions: launchOptions)
// autoCatchingClickProvider.init(initProperties.autoCatchingClickEvents)
// metricsManager.setEnabledMetrics(initProperties.enabledMetrics)
isReady = true
}

func isInitialized() -> Bool {
return isReady
}

lazy var bundle: Bundle = Bundle.main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ const PredefinedString = {
UTM_SOURCE: "utm_source",
VERTICAL: "vertical",
VOUCHER_CODE: "voucher_code",
CLICK_ID: "click_id",
CAMPAIGN_ID: "campaign_id",
EVENT_NAME: "event_name",
PID: "pid",
PRODUCT_ID: "product_id",
};

const PredefinedLong = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,61 +68,70 @@ public class Event: NSObject {
* Add predefined [parameter] with [value] type String to event
*/
@objc
public func addPredefinedParameter(_ parameter: PredefinedString, string: String) {
public func addPredefinedParameter(_ parameter: PredefinedString, string: String) -> Event {
predefinedParameters.append((parameter.value(), string))
PredefinedCustom().add(&predefinedParameters, parameter, string: string)
return self
}

/**
* Add predefined [parameter] with [value] type Array of String to event
*/
@objc
public func addPredefinedParameter(_ parameter: PredefinedListString, listString: [String]) {
public func addPredefinedParameter(_ parameter: PredefinedListString, listString: [String]) -> Event {
predefinedParameters.append((parameter.value(), listString))
return self
}

/**
* Add predefined [parameter] with [value] type Int64 to event
*/
@objc
public func addPredefinedParameter(_ parameter: PredefinedLong, long: Int64) {
public func addPredefinedParameter(_ parameter: PredefinedLong, long: Int64) -> Event {
predefinedParameters.append((parameter.value(), long))
return self
}

/**
* Add predefined [parameter] with [value] type Float to event
*/
@objc
public func addPredefinedParameter(_ parameter: PredefinedFloat, float: Float) {
public func addPredefinedParameter(_ parameter: PredefinedFloat, float: Float) -> Event {
predefinedParameters.append((parameter.value(), float))
return self
}

/**
* Add predefined [parameter] with [value] type JSON to event
*/
public func addPredefinedParameter(_ parameter: PredefinedObject, object: [(String, Any?)]) {
public func addPredefinedParameter(_ parameter: PredefinedObject, object: [(String, Any?)]) -> Event {
predefinedParameters.append((parameter.value(), object))
return self
}
/**
* Add predefined [parameter] with [value] type JSON to event
*/
@objc
public func addPredefinedParameter(_ parameter: PredefinedObject, object: [[String: AnyObject]]) {
public func addPredefinedParameter(_ parameter: PredefinedObject, object: [[String: AnyObject]]) -> Event {
addPredefinedParameter(parameter, object: object.toFlatList())
return self
}

/**
* Add predefined [parameter] with [value] type Array of JSON to event
*/
public func addPredefinedParameter(_ parameter: PredefinedListObject, listObject: [[(String, Any?)]]) {
public func addPredefinedParameter(_ parameter: PredefinedListObject, listObject: [[(String, Any?)]]) -> Event {
predefinedParameters.append((parameter.value(), listObject))
return self
}

/**
* Add predefined [parameter] with [value] type Array of JSON to event
*/
@objc
public func addPredefinedParameter(_ parameter: PredefinedListObject, listObject: [[String: AnyObject]]) {
public func addPredefinedParameter(_ parameter: PredefinedListObject, listObject: [[String: AnyObject]]) -> Event {
addPredefinedParameter(parameter, listObject: listObject.toListOfList())
return self
}

@objc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
internal class PredefinedCustom {
private let CONVERSION_ID = "\(PredefinedConstants.PREFIX)conversion_id"


func add(_ parameters: inout [(String, Any?)], _ parameter: PredefinedString, string: String) {
switch parameter {
case .ORDER_ID:
guard let productId = get(&parameters, PredefinedString.PRODUCT_ID.value()) as? String else { break }
let value = "\(string)\(productId)"
set(&parameters, CONVERSION_ID, value)
break
case .PRODUCT_ID:
guard let orderId = get(&parameters, PredefinedString.ORDER_ID.value()) as? String else { break }
let value = "\(orderId)\(string)"
set(&parameters, CONVERSION_ID, value)
break
default:
break
}
}

private func hasKey(_ parameters: inout [(String, Any?)], _ predefined: String) -> Bool {
for (key, _) in parameters {
if key == predefined {
return true
}
}
return false
}

private func get(_ parameters: inout [(String, Any?)], _ predefined: String) -> Any? {
for (key, value) in parameters {
if key == predefined {
return value
}
}
return nil
}

private func set(_ parameters: inout [(String, Any?)], _ predefined: String, _ newValue: Any?) {
delete(&parameters, predefined)
parameters.append((predefined, newValue))
}

private func delete(_ parameters: inout [(String, Any?)], _ predefined: String) {
for (idx, (key, _)) in parameters.enumerated() {
if key == predefined {
parameters.remove(at: idx)
return
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public class PredefinedGroup {

static let NAME: String = "\(PredefinedConstants.PREFIX)list_group"

private(set) var predefinedParameters: [(String, Any?)] = []

public func addPredefinedParameter(_ parameter: PredefinedString, string: String) -> PredefinedGroup {
predefinedParameters.append((parameter.value(), string))
return self
}

public func addPredefinedParameter(_ parameter: PredefinedLong, long: Int64) -> PredefinedGroup {
predefinedParameters.append((parameter.value(), long))
return self
}

public func addPredefinedParameter(_ parameter: PredefinedFloat, float: Float) -> PredefinedGroup {
predefinedParameters.append((parameter.value(), float))
return self
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public enum PredefinedString: Int, Predefined, CaseIterable {
case UTM_SOURCE
case VERTICAL
case VOUCHER_CODE
case CLICK_ID
case CAMPAIGN_ID
case EVENT_NAME
case PID
case PRODUCT_ID

public func value() -> String {
return "\(PredefinedConstants.PREFIX)\(enumValue())"
Expand Down Expand Up @@ -119,6 +124,11 @@ public enum PredefinedString: Int, Predefined, CaseIterable {
case .UTM_SOURCE: return "utm_source"
case .VERTICAL: return "vertical"
case .VOUCHER_CODE: return "voucher_code"
case .CLICK_ID: return "click_id"
case .CAMPAIGN_ID: return "campaign_id"
case .EVENT_NAME: return "event_name"
case .PID: return "pid"
case .PRODUCT_ID: return "product_id"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Foundation
class AffSDKVersionProvider: StringPropertyProvider {

override func provide() -> String? {
return "1.6.5"
return "1.6.6"
}

override func getOrder() -> Float {
Expand Down
2 changes: 1 addition & 1 deletion AffiseInternal.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |spec|
spec.name = "AffiseInternal"
spec.version = ENV['LIB_VERSION'] || "1.6.5"
spec.version = ENV['LIB_VERSION'] || "1.6.6"
spec.summary = "Affise Internal library"
spec.description = "Affise Internal wrapper library for cross platform"
spec.homepage = "https://github.com/affise/sdk-ios"
Expand Down
2 changes: 2 additions & 0 deletions AffiseInternal/AffiseInternal/Classes/AffiseApiMethod.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@objc
public enum AffiseApiMethod: Int, CaseIterable {
case INIT
case IS_INITIALIZED
case SEND_EVENTS
case SEND_EVENT
case ADD_PUSH_TOKEN
Expand Down Expand Up @@ -33,6 +34,7 @@ public enum AffiseApiMethod: Int, CaseIterable {
func value() -> String {
switch self {
case .INIT: return "init"
case .IS_INITIALIZED: return "is_initialized"
case .SEND_EVENTS: return "send_events"
case .SEND_EVENT: return "send_event"
case .ADD_PUSH_TOKEN: return "add_push_token"
Expand Down
5 changes: 5 additions & 0 deletions AffiseInternal/AffiseInternal/Classes/AffiseApiWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class AffiseApiWrapper: NSObject {
public func call(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) {
switch api {
case .INIT: callInit(api, map: map, result: result)
case .IS_INITIALIZED: callIsInitialized(api, map: map, result: result)
case .SEND_EVENTS: callSendEvents(api, map: map, result: result)
case .SEND_EVENT: callSendEvent(api, map: map, result: result)
case .ADD_PUSH_TOKEN: callAddPushToken(api, map: map, result: result)
Expand Down Expand Up @@ -108,6 +109,10 @@ public class AffiseApiWrapper: NSObject {
result?.success(nil)
}

private func callIsInitialized(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) {
result?.success(Affise.shared.isInitialized())
}

private func callSendEvents(_ api: AffiseApiMethod, map: [String: Any?], result: AffiseResult?) {
Affise.shared.sendEvents()
result?.success(nil)
Expand Down
2 changes: 1 addition & 1 deletion AffiseSKAdNetwork.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Pod::Spec.new do |spec|
spec.name = "AffiseSKAdNetwork"
spec.version = ENV['LIB_VERSION'] || "1.6.5"
spec.version = ENV['LIB_VERSION'] || "1.6.6"
spec.summary = "AffiseSKAdNetwork iOS library"
spec.description = "Affise library for StoreKit Ad Network (SKAdNetwork)"
spec.homepage = "https://github.com/affise/sdk-ios"
Expand Down
Loading

0 comments on commit 4c6ad78

Please sign in to comment.