diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index 7e5b64f..1bed287 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -36,14 +36,11 @@ jobs: - name: Run UID2 unit tests on tvOS run: xcodebuild test -scheme UID2 -destination "OS=18.5,name=Apple TV" - - name: Bootstrap Prebid Dependencies - run: cd UID2Prebid && ./bootstrap.sh && cd - - - name: Build UID2Prebid for iOS - run: xcodebuild -workspace UID2Prebid/UID2Prebid.xcworkspace -scheme UID2Prebid -destination "generic/platform=iOS" + run: xcodebuild -scheme UID2Prebid -destination "generic/platform=iOS" - name: Run UID2Prebid unit tests - run: xcodebuild test -workspace UID2Prebid/UID2Prebid.xcworkspace -scheme UID2Prebid -destination "OS=18.5,name=iPhone 16" + run: xcodebuild test -scheme UID2Prebid -destination "OS=18.5,name=iPhone 16" - name: Lint UID2 pod spec run: pod lib lint UID2.podspec.json --verbose diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/UID2Prebid.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/UID2Prebid.xcscheme new file mode 100644 index 0000000..b93cb9c --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/UID2Prebid.xcscheme @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Package.resolved b/Package.resolved index 5ca8fbb..e14c6c7 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,23 @@ { "pins" : [ + { + "identity" : "applovin-max-swift-package", + "kind" : "remoteSourceControl", + "location" : "https://github.com/AppLovin/AppLovin-MAX-Swift-Package.git", + "state" : { + "revision" : "c184b428415a05dcad488c6834e0bd02fe1d8f3e", + "version" : "13.3.1" + } + }, + { + "identity" : "prebid-mobile-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/prebid/prebid-mobile-ios.git", + "state" : { + "revision" : "e632be68c5f74261fa550374b41699b481824dd3", + "version" : "3.1.0" + } + }, { "identity" : "swift-asn1", "kind" : "remoteSourceControl", @@ -8,6 +26,24 @@ "revision" : "df5d2fcd22e3f480e3ef85bf23e277a4a0ef524d", "version" : "1.2.0" } + }, + { + "identity" : "swift-package-manager-google-mobile-ads", + "kind" : "remoteSourceControl", + "location" : "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", + "state" : { + "revision" : "d24a9f5ad472610598449dc669befa5b7ed50658", + "version" : "12.7.0" + } + }, + { + "identity" : "swift-package-manager-google-user-messaging-platform", + "kind" : "remoteSourceControl", + "location" : "https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git", + "state" : { + "revision" : "69b53394c5258b3fe688e625a998047d1f393497", + "version" : "3.0.0" + } } ], "version" : 2 diff --git a/Package.swift b/Package.swift index 37ecffd..144da9b 100644 --- a/Package.swift +++ b/Package.swift @@ -16,9 +16,13 @@ let package = Package( .library( name: "UID2", targets: ["UID2"]), + .library( + name: "UID2Prebid", + targets: ["UID2Prebid"]), ], dependencies: [ .package(url: "https://github.com/apple/swift-asn1.git", .upToNextMajor(from: "1.0.0")), + .package(url: "https://github.com/prebid/prebid-mobile-ios.git", .upToNextMajor(from: "3.1.0")), ], targets: [ .target( @@ -31,10 +35,27 @@ let package = Package( .enableExperimentalFeature("StrictConcurrency") ] ), + .target( + name: "UID2Prebid", + dependencies: [ + "UID2", + .product(name: "PrebidMobile", package: "prebid-mobile-ios") + ], + resources: [ + .copy("PrivacyInfo.xcprivacy") + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") + ] + ), .testTarget( name: "UID2Tests", dependencies: ["UID2", "TestHelpers"] ), + .testTarget( + name: "UID2PrebidTests", + dependencies: ["UID2Prebid"] + ), .target( name: "TestHelpers", dependencies: ["UID2"], diff --git a/UID2Prebid/UID2Prebid/PrivacyInfo.xcprivacy b/Sources/UID2Prebid/PrivacyInfo.xcprivacy similarity index 100% rename from UID2Prebid/UID2Prebid/PrivacyInfo.xcprivacy rename to Sources/UID2Prebid/PrivacyInfo.xcprivacy diff --git a/UID2Prebid/UID2Prebid/UID2Prebid.swift b/Sources/UID2Prebid/UID2Prebid.swift similarity index 97% rename from UID2Prebid/UID2Prebid/UID2Prebid.swift rename to Sources/UID2Prebid/UID2Prebid.swift index 85dc4e8..1118f4c 100644 --- a/UID2Prebid/UID2Prebid/UID2Prebid.swift +++ b/Sources/UID2Prebid/UID2Prebid.swift @@ -3,6 +3,7 @@ import Foundation @preconcurrency import PrebidMobile import UID2 +@available(iOS 13, tvOS 13, *) protocol UserIDUpdater: Sendable { func updateUserIDs(_ userIDs: [ExternalUserId]) async } @@ -14,7 +15,8 @@ struct PrebidUserIDUpdater: UserIDUpdater { } } -public actor UID2Prebid: Sendable { +@available(iOS 13, tvOS 13, *) +public actor UID2Prebid { let thirdPartyUserIDs: @Sendable () async -> [ExternalUserId] let userIDUpdater: UserIDUpdater diff --git a/UID2Prebid/UID2PrebidTests/UID2PrebidTests.swift b/Tests/UID2PrebidTests/UID2PrebidTests.swift similarity index 90% rename from UID2Prebid/UID2PrebidTests/UID2PrebidTests.swift rename to Tests/UID2PrebidTests/UID2PrebidTests.swift index f4b98dc..7c040c9 100644 --- a/UID2Prebid/UID2PrebidTests/UID2PrebidTests.swift +++ b/Tests/UID2PrebidTests/UID2PrebidTests.swift @@ -52,7 +52,7 @@ final class UID2PrebidTests: XCTestCase { ) await observation( of: [ - ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 1)]) + ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 3)]) ], by: updater ) @@ -68,7 +68,7 @@ final class UID2PrebidTests: XCTestCase { ) await observation( of: [ - ExternalUserId(source: "uidapi.com", uids: [.init(id: "turtle", aType: 1)]) + ExternalUserId(source: "uidapi.com", uids: [.init(id: "turtle", aType: 3)]) ], by: updater ) @@ -93,7 +93,7 @@ final class UID2PrebidTests: XCTestCase { manager: manager, thirdPartyUserIDs: { [ - ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)]) + ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 3)]) ] }, userIDUpdater: updater, @@ -106,8 +106,8 @@ final class UID2PrebidTests: XCTestCase { ) await observation( of: [ - ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)]), - ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 1)]), + ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 3)]), + ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 3)]), ], by: updater ) @@ -115,7 +115,7 @@ final class UID2PrebidTests: XCTestCase { continuation.yield(.invalid) await observation( of: [ - ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)]), + ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 3)]), ], by: updater ) @@ -145,13 +145,19 @@ extension UID2PrebidTests { } struct ExternalUserIdEquatable: Equatable { var source: String - var identifier: String? - var atype: Int? + var uids: [UserUniqueIDEquatable] = [] init(_ userId: ExternalUserId) { self.source = userId.source - self.identifier = userId.identifier - self.atype = userId.atype?.intValue + self.uids = userId.uids.map(UserUniqueIDEquatable.init) + } + } + struct UserUniqueIDEquatable: Equatable { + var id: String + var aType: Int + init(_ userId: UserUniqueID) { + self.id = userId.id + self.aType = userId.aType.intValue } } } diff --git a/UID2Prebid.podspec.json b/UID2Prebid.podspec.json index 6fb677b..e755794 100644 --- a/UID2Prebid.podspec.json +++ b/UID2Prebid.podspec.json @@ -21,18 +21,18 @@ "frameworks": "Foundation", "resource_bundles": { "UID2Prebid": [ - "UID2Prebid/UID2Prebid/PrivacyInfo.xcprivacy" + "Sources/UID2Prebid/PrivacyInfo.xcprivacy" ] }, "source_files": [ - "UID2Prebid/UID2Prebid/**/*.swift" + "Sources/UID2Prebid/**/*.swift" ], "dependencies": { "UID2": [ "~> 1.3.0" ], "PrebidMobile": [ - "~> 2.4" + "~> 3.1" ] } } diff --git a/UID2Prebid/Podfile b/UID2Prebid/Podfile deleted file mode 100644 index 5f638cc..0000000 --- a/UID2Prebid/Podfile +++ /dev/null @@ -1,13 +0,0 @@ -platform :ios, '13.0' - -def pod_PrebidMobile - pod 'PrebidMobile', '~> 2.4.0' -end - -target 'UID2Prebid' do - pod_PrebidMobile -end - -target 'UID2PrebidTests' do - pod_PrebidMobile -end diff --git a/UID2Prebid/Podfile.lock b/UID2Prebid/Podfile.lock deleted file mode 100644 index fbba45a..0000000 --- a/UID2Prebid/Podfile.lock +++ /dev/null @@ -1,18 +0,0 @@ -PODS: - - PrebidMobile (2.4.0): - - PrebidMobile/core (= 2.4.0) - - PrebidMobile/core (2.4.0) - -DEPENDENCIES: - - PrebidMobile (~> 2.4.0) - -SPEC REPOS: - trunk: - - PrebidMobile - -SPEC CHECKSUMS: - PrebidMobile: cad263381f04c99e7be8311155cf32a707afe442 - -PODFILE CHECKSUM: cf8c2b5adbf2b526289bb5c4b5083e6e04594f39 - -COCOAPODS: 1.16.2 diff --git a/UID2Prebid/README.md b/UID2Prebid/README.md deleted file mode 100644 index b1f7b05..0000000 --- a/UID2Prebid/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# UID2Prebid for UDI2 iOS SDK - -This project exists because the Prebid mobile SDK for iOS, a dependency for UID2Prebid, does not support Swift Package Manager. It configures the UID2Prebid framework for testing, and houses sources for CocoaPods. If/when Prebid supports SPM, this project will not be necessary. - -To bootstrap this project you will need to: - -```sh -cd UID2Prebid -./bootstrap.sh -``` - -To develop & test UID2Prebid, open `UID2Prebid.xcworkspace`. diff --git a/UID2Prebid/bootstrap.sh b/UID2Prebid/bootstrap.sh deleted file mode 100755 index 104b715..0000000 --- a/UID2Prebid/bootstrap.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -set -euxo pipefail - -pod install