-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sergey Korney
committed
Aug 18, 2023
1 parent
8959994
commit 4c6ad78
Showing
17 changed files
with
157 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...eAttributionLib/AffiseAttributionLib/Attribution/events/parameters/PredefinedCustom.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(¶meters, PredefinedString.PRODUCT_ID.value()) as? String else { break } | ||
let value = "\(string)\(productId)" | ||
set(¶meters, CONVERSION_ID, value) | ||
break | ||
case .PRODUCT_ID: | ||
guard let orderId = get(¶meters, PredefinedString.ORDER_ID.value()) as? String else { break } | ||
let value = "\(orderId)\(string)" | ||
set(¶meters, 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(¶meters, 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 | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...seAttributionLib/AffiseAttributionLib/Attribution/events/parameters/PredefinedGroup.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.