diff --git a/UID2Prebid.podspec.json b/UID2Prebid.podspec.json index 1cc0d74..b8261e9 100644 --- a/UID2Prebid.podspec.json +++ b/UID2Prebid.podspec.json @@ -32,7 +32,7 @@ "~> 1.3.0" ], "PrebidMobile": [ - "~> 2.0" + "~> 2.4" ] } } diff --git a/UID2Prebid/Cartfile.resolved b/UID2Prebid/Cartfile.resolved index 51e51d5..aec8628 100644 --- a/UID2Prebid/Cartfile.resolved +++ b/UID2Prebid/Cartfile.resolved @@ -1 +1 @@ -github "prebid/prebid-mobile-ios" "2.2.3" +github "prebid/prebid-mobile-ios" "2.4.0" diff --git a/UID2Prebid/Carthage/Checkouts/prebid-mobile-ios b/UID2Prebid/Carthage/Checkouts/prebid-mobile-ios index 4020716..f18bf54 160000 --- a/UID2Prebid/Carthage/Checkouts/prebid-mobile-ios +++ b/UID2Prebid/Carthage/Checkouts/prebid-mobile-ios @@ -1 +1 @@ -Subproject commit 4020716722b7a73b45abb91c869cd6b0af12f046 +Subproject commit f18bf54bd58abf6f5cfd20ae53ec8eabb3d60b65 diff --git a/UID2Prebid/UID2Prebid/UID2Prebid.swift b/UID2Prebid/UID2Prebid/UID2Prebid.swift index 7d50e96..85dc4e8 100644 --- a/UID2Prebid/UID2Prebid/UID2Prebid.swift +++ b/UID2Prebid/UID2Prebid/UID2Prebid.swift @@ -10,13 +10,17 @@ protocol UserIDUpdater: Sendable { struct PrebidUserIDUpdater: UserIDUpdater { /// Passes the observed IDs to Prebid func updateUserIDs(_ userIDs: [ExternalUserId]) { - Prebid.shared.externalUserIdArray = userIDs + Targeting.shared.setExternalUserIds(userIDs) } } public actor UID2Prebid: Sendable { let thirdPartyUserIDs: @Sendable () async -> [ExternalUserId] let userIDUpdater: UserIDUpdater + + // https://github.com/InteractiveAdvertisingBureau/AdCOM/blob/main/AdCOM%20v1.0%20FINAL.md#list_agenttypes + // "A person-based ID, i.e., that is the same across devices." + private let agentType: NSNumber = 3 private let source = "uidapi.com" private var task: Task? @@ -72,8 +76,10 @@ public actor UID2Prebid: Sendable { func updateExternalUserID(_ advertisingToken: String?) async { var userIDs = await self.thirdPartyUserIDs() if let advertisingToken { - let advertisingTokenUser = ExternalUserId(source: source, identifier: advertisingToken) - userIDs.append(advertisingTokenUser) + userIDs.append(ExternalUserId( + source: source, + uids: [.init(id: advertisingToken, aType: agentType)] + )) } await userIDUpdater.updateUserIDs(userIDs) } diff --git a/UID2Prebid/UID2PrebidTests/UID2PrebidTests.swift b/UID2Prebid/UID2PrebidTests/UID2PrebidTests.swift index e20e10b..f4b98dc 100644 --- a/UID2Prebid/UID2PrebidTests/UID2PrebidTests.swift +++ b/UID2Prebid/UID2PrebidTests/UID2PrebidTests.swift @@ -51,7 +51,9 @@ final class UID2PrebidTests: XCTestCase { } ) await observation( - of: [ExternalUserId(source: "uidapi.com", identifier: "cat")], + of: [ + ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 1)]) + ], by: updater ) @@ -65,7 +67,9 @@ final class UID2PrebidTests: XCTestCase { .established(.established(advertisingToken: "turtle")) ) await observation( - of: [ExternalUserId(source: "uidapi.com", identifier: "turtle")], + of: [ + ExternalUserId(source: "uidapi.com", uids: [.init(id: "turtle", aType: 1)]) + ], by: updater ) } @@ -89,7 +93,7 @@ final class UID2PrebidTests: XCTestCase { manager: manager, thirdPartyUserIDs: { [ - ExternalUserId(source: "example.com", identifier: "dog") + ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)]) ] }, userIDUpdater: updater, @@ -102,8 +106,8 @@ final class UID2PrebidTests: XCTestCase { ) await observation( of: [ - ExternalUserId(source: "example.com", identifier: "dog"), - ExternalUserId(source: "uidapi.com", identifier: "cat"), + ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)]), + ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 1)]), ], by: updater ) @@ -111,7 +115,7 @@ final class UID2PrebidTests: XCTestCase { continuation.yield(.invalid) await observation( of: [ - ExternalUserId(source: "example.com", identifier: "dog"), + ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)]), ], by: updater ) @@ -141,7 +145,7 @@ extension UID2PrebidTests { } struct ExternalUserIdEquatable: Equatable { var source: String - var identifier: String + var identifier: String? var atype: Int? init(_ userId: ExternalUserId) {