105 lines
3.0 KiB
Swift
105 lines
3.0 KiB
Swift
// AdsProfile.swift
|
|
// Defines advertisement profile configurations
|
|
// Corresponds to AdsProfile.kt in Android implementation
|
|
|
|
import Foundation
|
|
|
|
public struct SegmentWrapper: Codable {
|
|
public let key: Int
|
|
public let values: [Int]
|
|
|
|
public init(key: Int, values: [Int] = []) {
|
|
self.key = key
|
|
self.values = values
|
|
}
|
|
|
|
private enum CodingKeys: String, CodingKey {
|
|
case key = "k"
|
|
case values = "v"
|
|
}
|
|
}
|
|
|
|
public struct SegmentCollectionWrapper: Codable {
|
|
public let segments: [SegmentWrapper]
|
|
|
|
public init(segments: [SegmentWrapper] = []) {
|
|
self.segments = segments
|
|
}
|
|
}
|
|
|
|
public struct AdsProfile: Codable {
|
|
public let adPlatforms: [AdPlatform]
|
|
public let maxSdkKey: String
|
|
public let ironSourceSdkKey: String?
|
|
public let amazonAppId: String?
|
|
public let pubmaticStoreUrl: String?
|
|
public let uid2Token: String?
|
|
public let userId: String
|
|
public let tpCreativeKey: String
|
|
public let debugMode: Bool
|
|
public let segments: SegmentCollectionWrapper
|
|
|
|
public let maxB2BDisabledAdUnitIds: [String]?
|
|
|
|
public init(adPlatforms: [AdPlatform], maxSdkKey: String,
|
|
ironSourceSdkKey: String? = nil,
|
|
amazonAppId: String? = nil,
|
|
pubmaticStoreUrl: String? = nil,
|
|
uid2Token: String? = nil,
|
|
userId: String = "",
|
|
tpCreativeKey: String = "",
|
|
debugMode: Bool = false,
|
|
segments: SegmentCollectionWrapper = SegmentCollectionWrapper(segments: []),
|
|
maxB2BDisabledAdUnitIds: [String]? = nil
|
|
) {
|
|
self.adPlatforms = adPlatforms
|
|
self.maxSdkKey = maxSdkKey
|
|
self.ironSourceSdkKey = ironSourceSdkKey
|
|
self.amazonAppId = amazonAppId
|
|
self.pubmaticStoreUrl = pubmaticStoreUrl
|
|
self.uid2Token = uid2Token
|
|
self.userId = userId
|
|
self.tpCreativeKey = tpCreativeKey
|
|
self.debugMode = debugMode
|
|
self.segments = segments
|
|
self.maxB2BDisabledAdUnitIds = maxB2BDisabledAdUnitIds
|
|
}
|
|
|
|
private enum CodingKeys : String, CodingKey {
|
|
case adPlatforms = "ad_platforms",
|
|
maxSdkKey = "max_sdk_key",
|
|
ironSourceSdkKey = "iron_source_sdk_key",
|
|
amazonAppId = "amazon_app_id",
|
|
pubmaticStoreUrl = "pubmatic_store_url",
|
|
uid2Token = "uid2_token",
|
|
segments = "segments",
|
|
userId = "user_id",
|
|
debugMode = "debug_mode",
|
|
tpCreativeKey = "tp_creative_key",
|
|
maxB2BDisabledAdUnitIds = "max_disable_b2b_ad_unit_ids"
|
|
|
|
}
|
|
}
|
|
|
|
public enum AdsCommand {
|
|
// Add specific commands as needed
|
|
}
|
|
|
|
public class ActionResult {
|
|
// Base result class
|
|
}
|
|
|
|
public class BoolActionResult: ActionResult {
|
|
public let value: Bool
|
|
|
|
public init(value: Bool) {
|
|
self.value = value
|
|
}
|
|
}
|
|
|
|
public struct AdsCrossAction {
|
|
public let cmd: AdsCommand
|
|
public let params: Any
|
|
public let onResult: (ActionResult) -> Void
|
|
}
|