Skip to content

Commit 3d57dd7

Browse files
authored
Upgrade to Prebid 3 (#80)
1 parent 6bfda58 commit 3d57dd7

File tree

12 files changed

+186
-66
lines changed

12 files changed

+186
-66
lines changed

.github/workflows/test-pull-request.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,11 @@ jobs:
3636
- name: Run UID2 unit tests on tvOS
3737
run: xcodebuild test -scheme UID2 -destination "OS=18.5,name=Apple TV"
3838

39-
- name: Bootstrap Prebid Dependencies
40-
run: cd UID2Prebid && ./bootstrap.sh && cd -
41-
4239
- name: Build UID2Prebid for iOS
43-
run: xcodebuild -workspace UID2Prebid/UID2Prebid.xcworkspace -scheme UID2Prebid -destination "generic/platform=iOS"
40+
run: xcodebuild -scheme UID2Prebid -destination "generic/platform=iOS"
4441

4542
- name: Run UID2Prebid unit tests
46-
run: xcodebuild test -workspace UID2Prebid/UID2Prebid.xcworkspace -scheme UID2Prebid -destination "OS=18.5,name=iPhone 16"
43+
run: xcodebuild test -scheme UID2Prebid -destination "OS=18.5,name=iPhone 16"
4744

4845
- name: Lint UID2 pod spec
4946
run: pod lib lint UID2.podspec.json --verbose
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1530"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "UID2Prebid"
18+
BuildableName = "UID2Prebid"
19+
BlueprintName = "UID2Prebid"
20+
ReferencedContainer = "container:">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "NO"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "NO">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "UID2PrebidTests"
32+
BuildableName = "UID2PrebidTests"
33+
BlueprintName = "UID2PrebidTests"
34+
ReferencedContainer = "container:">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
<BuildActionEntry
38+
buildForTesting = "YES"
39+
buildForRunning = "YES"
40+
buildForProfiling = "YES"
41+
buildForArchiving = "YES"
42+
buildForAnalyzing = "YES">
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "UID2"
46+
BuildableName = "UID2"
47+
BlueprintName = "UID2"
48+
ReferencedContainer = "container:">
49+
</BuildableReference>
50+
</BuildActionEntry>
51+
</BuildActionEntries>
52+
</BuildAction>
53+
<TestAction
54+
buildConfiguration = "Debug"
55+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
shouldUseLaunchSchemeArgsEnv = "YES">
58+
<Testables>
59+
<TestableReference
60+
skipped = "NO">
61+
<BuildableReference
62+
BuildableIdentifier = "primary"
63+
BlueprintIdentifier = "UID2PrebidTests"
64+
BuildableName = "UID2PrebidTests"
65+
BlueprintName = "UID2PrebidTests"
66+
ReferencedContainer = "container:">
67+
</BuildableReference>
68+
</TestableReference>
69+
</Testables>
70+
</TestAction>
71+
<LaunchAction
72+
buildConfiguration = "Debug"
73+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
74+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
75+
launchStyle = "0"
76+
useCustomWorkingDirectory = "NO"
77+
ignoresPersistentStateOnLaunch = "NO"
78+
debugDocumentVersioning = "YES"
79+
debugServiceExtension = "internal"
80+
allowLocationSimulation = "YES">
81+
</LaunchAction>
82+
<ProfileAction
83+
buildConfiguration = "Release"
84+
shouldUseLaunchSchemeArgsEnv = "YES"
85+
savedToolIdentifier = ""
86+
useCustomWorkingDirectory = "NO"
87+
debugDocumentVersioning = "YES">
88+
<MacroExpansion>
89+
<BuildableReference
90+
BuildableIdentifier = "primary"
91+
BlueprintIdentifier = "UID2Prebid"
92+
BuildableName = "UID2Prebid"
93+
BlueprintName = "UID2Prebid"
94+
ReferencedContainer = "container:">
95+
</BuildableReference>
96+
</MacroExpansion>
97+
</ProfileAction>
98+
<AnalyzeAction
99+
buildConfiguration = "Debug">
100+
</AnalyzeAction>
101+
<ArchiveAction
102+
buildConfiguration = "Release"
103+
revealArchiveInOrganizer = "YES">
104+
</ArchiveAction>
105+
</Scheme>

Package.resolved

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ let package = Package(
1616
.library(
1717
name: "UID2",
1818
targets: ["UID2"]),
19+
.library(
20+
name: "UID2Prebid",
21+
targets: ["UID2Prebid"]),
1922
],
2023
dependencies: [
2124
.package(url: "https://github.com/apple/swift-asn1.git", .upToNextMajor(from: "1.0.0")),
25+
.package(url: "https://github.com/prebid/prebid-mobile-ios.git", .upToNextMajor(from: "3.1.0")),
2226
],
2327
targets: [
2428
.target(
@@ -31,10 +35,27 @@ let package = Package(
3135
.enableExperimentalFeature("StrictConcurrency")
3236
]
3337
),
38+
.target(
39+
name: "UID2Prebid",
40+
dependencies: [
41+
"UID2",
42+
.product(name: "PrebidMobile", package: "prebid-mobile-ios")
43+
],
44+
resources: [
45+
.copy("PrivacyInfo.xcprivacy")
46+
],
47+
swiftSettings: [
48+
.enableExperimentalFeature("StrictConcurrency")
49+
]
50+
),
3451
.testTarget(
3552
name: "UID2Tests",
3653
dependencies: ["UID2", "TestHelpers"]
3754
),
55+
.testTarget(
56+
name: "UID2PrebidTests",
57+
dependencies: ["UID2Prebid"]
58+
),
3859
.target(
3960
name: "TestHelpers",
4061
dependencies: ["UID2"],
File renamed without changes.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Foundation
33
@preconcurrency import PrebidMobile
44
import UID2
55

6+
@available(iOS 13, tvOS 13, *)
67
protocol UserIDUpdater: Sendable {
78
func updateUserIDs(_ userIDs: [ExternalUserId]) async
89
}
@@ -14,7 +15,8 @@ struct PrebidUserIDUpdater: UserIDUpdater {
1415
}
1516
}
1617

17-
public actor UID2Prebid: Sendable {
18+
@available(iOS 13, tvOS 13, *)
19+
public actor UID2Prebid {
1820
let thirdPartyUserIDs: @Sendable () async -> [ExternalUserId]
1921
let userIDUpdater: UserIDUpdater
2022

UID2Prebid/UID2PrebidTests/UID2PrebidTests.swift renamed to Tests/UID2PrebidTests/UID2PrebidTests.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ final class UID2PrebidTests: XCTestCase {
5252
)
5353
await observation(
5454
of: [
55-
ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 1)])
55+
ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 3)])
5656
],
5757
by: updater
5858
)
@@ -68,7 +68,7 @@ final class UID2PrebidTests: XCTestCase {
6868
)
6969
await observation(
7070
of: [
71-
ExternalUserId(source: "uidapi.com", uids: [.init(id: "turtle", aType: 1)])
71+
ExternalUserId(source: "uidapi.com", uids: [.init(id: "turtle", aType: 3)])
7272
],
7373
by: updater
7474
)
@@ -93,7 +93,7 @@ final class UID2PrebidTests: XCTestCase {
9393
manager: manager,
9494
thirdPartyUserIDs: {
9595
[
96-
ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)])
96+
ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 3)])
9797
]
9898
},
9999
userIDUpdater: updater,
@@ -106,16 +106,16 @@ final class UID2PrebidTests: XCTestCase {
106106
)
107107
await observation(
108108
of: [
109-
ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)]),
110-
ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 1)]),
109+
ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 3)]),
110+
ExternalUserId(source: "uidapi.com", uids: [.init(id: "cat", aType: 3)]),
111111
],
112112
by: updater
113113
)
114114

115115
continuation.yield(.invalid)
116116
await observation(
117117
of: [
118-
ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 1)]),
118+
ExternalUserId(source: "example.com", uids: [.init(id: "dog", aType: 3)]),
119119
],
120120
by: updater
121121
)
@@ -145,13 +145,19 @@ extension UID2PrebidTests {
145145
}
146146
struct ExternalUserIdEquatable: Equatable {
147147
var source: String
148-
var identifier: String?
149-
var atype: Int?
148+
var uids: [UserUniqueIDEquatable] = []
150149

151150
init(_ userId: ExternalUserId) {
152151
self.source = userId.source
153-
self.identifier = userId.identifier
154-
self.atype = userId.atype?.intValue
152+
self.uids = userId.uids.map(UserUniqueIDEquatable.init)
153+
}
154+
}
155+
struct UserUniqueIDEquatable: Equatable {
156+
var id: String
157+
var aType: Int
158+
init(_ userId: UserUniqueID) {
159+
self.id = userId.id
160+
self.aType = userId.aType.intValue
155161
}
156162
}
157163
}

UID2Prebid.podspec.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
"frameworks": "Foundation",
2222
"resource_bundles": {
2323
"UID2Prebid": [
24-
"UID2Prebid/UID2Prebid/PrivacyInfo.xcprivacy"
24+
"Sources/UID2Prebid/PrivacyInfo.xcprivacy"
2525
]
2626
},
2727
"source_files": [
28-
"UID2Prebid/UID2Prebid/**/*.swift"
28+
"Sources/UID2Prebid/**/*.swift"
2929
],
3030
"dependencies": {
3131
"UID2": [
3232
"~> 1.3.0"
3333
],
3434
"PrebidMobile": [
35-
"~> 2.4"
35+
"~> 3.1"
3636
]
3737
}
3838
}

UID2Prebid/Podfile

Lines changed: 0 additions & 13 deletions
This file was deleted.

UID2Prebid/Podfile.lock

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)