Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Sources/Profile/Adapty+UpdateAttributionData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
import Foundation

public extension Adapty {
/// To set attribution data for the profile, use this method.
///
/// Read more on the [Adapty Documentation](https://docs.adapty.io/docs/attribution-integration)
///
/// - Parameter attribution: a dictionary containing attribution (conversion) data.
/// - Parameter source: a source of attribution. The allowed values are: `.appsflyer`, `.adjust`, `.branch` or custom.
nonisolated static func updateAttribution(
_ attribution: [AnyHashable: Any],
source: AdaptyAttributionSource
) async throws {
try await updateAttribution(attribution, source: source.rawValue)
}

/// To set attribution data for the profile, use this method.
///
/// Read more on the [Adapty Documentation](https://docs.adapty.io/docs/attribution-integration)
Expand Down
36 changes: 36 additions & 0 deletions Sources/Profile/AdaptyAttributionSource.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AdaptyAttributionSource.swift
// AdaptySDK
//
// Created by Ilya Laryionau on 26.12.24.
//

public struct AdaptyAttributionSource: RawRepresentable {
public let rawValue: String

public init(rawValue: String) {
self.rawValue = rawValue
}

public static var adjust: Self { "adjust" }
public static var appsflyer: Self { "appsflyer" }
public static var branch: Self { "branch" }
}

extension AdaptyAttributionSource: CustomStringConvertible {
public var description: String {
return String(describing: self.rawValue)
}
}

extension AdaptyAttributionSource: Equatable {}

extension AdaptyAttributionSource: ExpressibleByStringLiteral {
public init(stringLiteral: String) {
self.init(rawValue: stringLiteral)
}
}

extension AdaptyAttributionSource: Hashable {}

extension AdaptyAttributionSource: Sendable {}