Skip to content

Commit fcd7c59

Browse files
Merge pull request #647 from SourcePointUSA/fix_metric_code_0
fix sp metric code sent as 0
2 parents cd6f63d + 810f2d9 commit fcd7c59

432 files changed

Lines changed: 18130 additions & 25160 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/swift.yml

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,73 +10,80 @@ defaults:
1010
working-directory: Example
1111
jobs:
1212
lint:
13-
runs-on: macos-15
13+
runs-on: macos-26
1414
steps:
1515
- uses: actions/checkout@v4
1616
- run: brew install swiftlint
1717
- run: swiftlint lint
1818
BuildSwiftPackage:
19-
runs-on: macos-15
19+
runs-on: macos-26
2020
steps:
2121
- uses: actions/checkout@v4
22-
- run: sudo xcode-select -s /Applications/Xcode_16.3.app
22+
- run: sudo xcode-select -s /Applications/Xcode_26.4.1.app
2323
- name: Building Swift Package
24-
run: xcodebuild clean build -scheme SPMBuild -workspace ConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.4'
24+
run: xcodebuild clean build -scheme SPMBuild -workspace ConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.4.1'
2525
- uses: actions/upload-artifact@v4
2626
if: failure()
2727
name: Upload Swift Package build results
2828
with:
2929
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
3030
BuildCarthageProject:
31-
runs-on: macos-15
31+
runs-on: macos-26
3232
steps:
3333
- uses: actions/checkout@v4
34-
- run: sudo xcode-select -s /Applications/Xcode_16.3.app
34+
- run: sudo xcode-select -s /Applications/Xcode_26.4.1.app
3535
- name: Building Carthage Project
3636
run: cd ./SPCarthageTest && ./build.sh
3737
ObjC-ExampleApp-tests:
38-
runs-on: macos-15
38+
runs-on: macos-26
39+
env:
40+
TOOLCHAINS: com.apple.dt.toolchain.XcodeDefault
3941
steps:
4042
- uses: actions/checkout@v4
41-
- run: sudo xcode-select -s /Applications/Xcode_16.3.app
42-
- name: ObjC-ExampleApp testing -> iPhone 16 (iOS 18.4)
43-
run: xcodebuild test -scheme ObjC-ExampleApp -workspace ConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.4'
43+
- run: |
44+
sudo xcode-select -s /Applications/Xcode_26.4.1.app
45+
xcodebuild -version
46+
xcrun --find swiftc
47+
xcrun --show-sdk-path --sdk iphonesimulator
48+
xcrun simctl list runtimes
49+
- name: ObjC-ExampleApp testing -> iPhone 17 (iOS 26.4.1)
50+
run: xcodebuild test -scheme ObjC-ExampleApp -workspace ConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.4.1'
4451
- uses: actions/upload-artifact@v4
4552
if: failure()
4653
name: Upload ObjCExampleApp tests results
4754
with:
4855
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
4956
ConsentViewController:
50-
runs-on: macos-15
57+
runs-on: macos-26
5158
steps:
5259
- uses: actions/checkout@v4
53-
- run: sudo xcode-select -s /Applications/Xcode_16.3.app
54-
- name: ConsentViewController testing -> iPhone 16 (iOS 18.4)
55-
run: xcodebuild test -scheme ConsentViewController_Example -workspace ConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.4'
60+
- run: sudo xcode-select -s /Applications/Xcode_26.4.1.app
61+
- name: ConsentViewController testing -> iPhone 17 (iOS 26.4.1)
62+
run: xcodebuild test -scheme ConsentViewController_Example -workspace ConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.4.1'
5663
- uses: actions/upload-artifact@v4
5764
if: failure()
5865
name: Upload ConsentViewController tests results
5966
with:
6067
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
6168
AuthExample-tests:
62-
runs-on: macos-15
69+
runs-on: macos-26
6370
steps:
6471
- uses: actions/checkout@v4
65-
- run: sudo xcode-select -s /Applications/Xcode_16.3.app
66-
- name: ConsentViewController testing -> iPhone 16 (iOS 18.4)
67-
run: xcodebuild test -scheme AuthExample -workspace ConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.4'
72+
- run: sudo xcode-select -s /Applications/Xcode_26.4.1.app
73+
- name: ConsentViewController testing -> iPhone 17 (iOS 26.4.1)
74+
run: xcodebuild test -scheme AuthExample -workspace ConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.4.1'
6875
- uses: actions/upload-artifact@v4
6976
if: failure()
7077
name: Upload ConsentViewController tests results
7178
with:
7279
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult
7380
TVOSExampleApp:
74-
runs-on: macos-15
81+
runs-on: macos-26
7582
steps:
7683
- uses: actions/checkout@v4
77-
- run: sudo xcode-select -s /Applications/Xcode_16.3.app
78-
- name: ConsentViewController testing -> Apple TV (tvOS 18.4)
79-
run: xcodebuild test -scheme TVOSExampleApp -workspace ConsentViewController.xcworkspace -destination 'platform=tvOS Simulator,name=Apple TV,OS=18.4'
84+
- run: sudo xcode-select -s /Applications/Xcode_26.4.1.app
85+
- name: ConsentViewController testing -> Apple TV (tvOS 26.4.1)
86+
run: xcodebuild test -scheme TVOSExampleApp -workspace ConsentViewController.xcworkspace -destination 'platform=tvOS Simulator,name=Apple TV,OS=26.4'
8087
- uses: actions/upload-artifact@v4
8188
if: failure()
8289
name: Upload TVOSExampleApp tests results

ConsentViewController.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Pod::Spec.new do |s|
3333
}
3434
s.pod_target_xcconfig = {
3535
'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES',
36-
'DEFINES_MODULE' => 'YES'
36+
'DEFINES_MODULE' => 'YES',
37+
'OTHER_SWIFT_FLAGS[config=Debug]' => '$(inherited) -enable-testing'
3738
}
3839
end

ConsentViewController/Classes/SourcePointClient/Adapters/SharedNativeToCoreAdapters.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extension KotlinFloat {
3232
extension SPError {
3333
func toCore() -> CoreSPError {
3434
return CoreSPError(
35-
code: String(code),
35+
code: spCode,
3636
description: description,
3737
cause: nil,
3838
campaignType: campaignType.toCore()

Example/AuthExampleUITests/AuthExampleUITests.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,48 @@ import Quick
1212
import XCTest
1313

1414
class AuthExampleUITests: QuickSpec {
15-
var app: AuthExampleApp!
15+
static var app: AuthExampleApp!
1616

17-
override func spec() {
17+
override class func spec() {
1818
beforeSuite {
19-
self.app = AuthExampleApp()
20-
Nimble.AsyncDefaults.timeout = .seconds(20)
21-
Nimble.AsyncDefaults.pollInterval = .milliseconds(100)
19+
app = AuthExampleApp()
20+
Nimble.PollingDefaults.timeout = .seconds(20)
21+
Nimble.PollingDefaults.pollInterval = .milliseconds(100)
2222
}
2323

2424
afterSuite {
25-
Nimble.AsyncDefaults.timeout = .seconds(1)
26-
Nimble.AsyncDefaults.pollInterval = .milliseconds(10)
25+
Nimble.PollingDefaults.timeout = .seconds(1)
26+
Nimble.PollingDefaults.pollInterval = .milliseconds(10)
2727
}
2828

2929
beforeEach {
30-
self.app.relaunch(clean: true, resetAtt: true)
30+
app.relaunch(clean: true, resetAtt: true)
3131
}
3232

3333
func acceptGDPRMessage() {
34-
expect(self.app.gdprMessage.messageTitle).toEventually(showUp())
35-
self.app.gdprMessage.acceptButton.tap()
34+
expect(app.gdprMessage.messageTitle).toEventually(showUp())
35+
app.gdprMessage.acceptButton.tap()
3636
}
3737

3838
func acceptCCPAMessage() {
39-
expect(self.app.ccpaMessage.messageTitle).toEventually(showUp())
40-
self.app.ccpaMessage.acceptButton.tap()
39+
expect(app.ccpaMessage.messageTitle).toEventually(showUp())
40+
app.ccpaMessage.acceptButton.tap()
4141
}
4242

4343
func waitForSdkToFinish() {
44-
expect(self.app.sdkStatusLabel).toEventually(containText("Finished"))
44+
expect(app.sdkStatusLabel).toEventually(containText("Finished"))
4545
}
4646

4747
func navigateToWebView() {
48-
self.app.webViewButton.tap()
48+
app.webViewButton.tap()
4949
}
5050

5151
it("Accepting all via native screen should prevent messages from showing on the webview screen") {
5252
acceptGDPRMessage()
5353
acceptCCPAMessage()
5454
waitForSdkToFinish()
5555
navigateToWebView()
56-
expect(self.app.webViewOnConsentReadyCalls.count).toEventually(equal(2))
56+
expect(app.webViewOnConsentReadyCalls.count).toEventually(equal(2))
5757
}
5858
}
5959
}

Example/AuthExampleUITests/CustomMatchers.swift

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,66 +11,39 @@ import Nimble
1111
import Quick
1212
import XCTest
1313

14-
public typealias Predicate = Nimble.Predicate
15-
16-
extension DispatchTimeInterval {
17-
func toDouble() -> Double {
18-
var result: Double = 0
19-
switch self {
20-
case .seconds(let value):
21-
result = Double(value)
22-
23-
case .milliseconds(let value):
24-
result = Double(value) * 0.001
25-
26-
case .microseconds(let value):
27-
result = Double(value) * 0.000_001
28-
29-
case .nanoseconds(let value):
30-
result = Double(value) * 0.000_000_001
31-
32-
case .never:
33-
result = Double.infinity
34-
@unknown default:
35-
result = Double.infinity
36-
}
37-
return result
38-
}
39-
}
40-
4114
/// A matcher that checks if a `XCUIElement` contains the given text
42-
public func containText(_ text: String) -> Predicate<XCUIElement> {
43-
Predicate.simple("contain text") { actualExpression in
15+
public func containText(_ text: String) -> Matcher<XCUIElement> {
16+
Matcher.simple("contain text") { actualExpression in
4417
guard let actual = try actualExpression.evaluate() else { return .fail }
45-
return PredicateStatus(bool: actual.label.contains(text))
18+
return MatcherStatus(bool: actual.label.contains(text))
4619
}
4720
}
4821

4922
/// A Nimble matcher that succeeds when an XCUIElement shows up after
5023
/// a certain amount of time. 20 seconds by default
51-
public func showUp() -> Predicate<XCUIElement> {
52-
Predicate.simple("show up") { actualExpression in
24+
public func showUp() -> Matcher<XCUIElement> {
25+
Matcher.simple("show up") { actualExpression in
5326
guard let actual = try actualExpression.evaluate() else { return .fail }
54-
return PredicateStatus(bool: actual.waitForExistence(timeout: Nimble.AsyncDefaults.timeout.toDouble()))
27+
return MatcherStatus(bool: actual.waitForExistence(timeout: Nimble.PollingDefaults.timeout.timeInterval))
5528
}
5629
}
5730

5831
/// A Nimble matcher that succeeds when an XCUIElement shows up after
5932
/// a certain amount of time.
60-
public func showUp(in timeout: TimeInterval) -> Predicate<XCUIElement> {
61-
Predicate.simple("show up") { actualExpression in
33+
public func showUp(in timeout: TimeInterval) -> Matcher<XCUIElement> {
34+
Matcher.simple("show up") { actualExpression in
6235
guard let actual = try actualExpression.evaluate() else { return .fail }
63-
return PredicateStatus(bool: actual.waitForExistence(timeout: timeout))
36+
return MatcherStatus(bool: actual.waitForExistence(timeout: timeout))
6437
}
6538
}
6639

6740
/// A Nimble matcher that succeeds when an XCUIElement no longer exists. Due to its async nature, it should
6841
/// be used together with `.toEventually`.
69-
public func disappear() -> Predicate<XCUIElement> {
70-
Predicate.simple("disappear") { actualExpression in
42+
public func disappear() -> Matcher<XCUIElement> {
43+
Matcher.simple("disappear") { actualExpression in
7144
guard let actual = try actualExpression.evaluate() else { return .fail }
7245
QuickSpec.current.expectation(for: NSPredicate(format: "exists == FALSE"), evaluatedWith: actual, handler: nil)
73-
QuickSpec.current.waitForExpectations(timeout: Double(Nimble.AsyncDefaults.timeout.toDouble()))
74-
return PredicateStatus(bool: !actual.exists)
46+
QuickSpec.current.waitForExpectations(timeout: Nimble.PollingDefaults.timeout.timeInterval)
47+
return MatcherStatus(bool: !actual.exists)
7548
}
7649
}

0 commit comments

Comments
 (0)