Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit eda321d

Browse files
Merge pull request #46 from SourcePointUSA/SP-4533_implement_action_description
SP-4533 implement action description
2 parents 0c48304 + 17cc61a commit eda321d

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

.github/workflows/swift.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,5 @@ jobs:
1919
- uses: actions/checkout@v2
2020
- name: CocoaPod Install
2121
run: cd Example && pod install
22-
- name: iOS build
23-
run: xcodebuild build-for-testing -scheme CCPAConsentViewController_ExampleTests -workspace Example/CCPAConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.5'
24-
- name: testing -> iPhone 11 (iOS 13.5)
25-
run: xcodebuild test-without-building -scheme CCPAConsentViewController_ExampleTests -workspace Example/CCPAConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.5'
22+
- name: testing -> iPhone 11 (iOS 13.6)
23+
run: xcodebuild test -scheme ConsentViewController-Example -workspace Example/CCPAConsentViewController.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.6' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"

CCPAConsentViewController/Classes/Action.swift

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,20 @@
88
import Foundation
99

1010
/// User actions. Its integer representation matches with what SourcePoint's endpoints expect.
11-
@objc public enum Action: Int {
11+
@objc public enum Action: Int, Codable, CaseIterable, CustomStringConvertible {
1212
case SaveAndExit = 1
1313
case AcceptAll = 11
1414
case ShowPrivacyManager = 12
1515
case RejectAll = 13
1616
case Dismiss = 15
17+
public var description: String {
18+
switch self {
19+
case .AcceptAll: return "AcceptAll"
20+
case .RejectAll: return "RejectAll"
21+
case .ShowPrivacyManager: return "ShowPrivacyManager"
22+
case .SaveAndExit: return "SaveAndExit"
23+
case .Dismiss: return "Dismiss"
24+
default: return "Unknown"
25+
}
26+
}
1727
}

CCPAConsentViewController/Classes/MessageWebViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class MessageWebViewController: MessageViewController, WKUIDelegate, WKNavigatio
114114
}
115115

116116
private func onConsentReady() {
117-
consentDelegate?.onConsentReady?(consentUUID: consentUUID ?? "", userConsent: userConsent ?? UserConsent.rejectedNone())
117+
consentDelegate?.onConsentReady?(consentUUID: consentUUID ?? "", userConsent: userConsent)
118118
closeConsentUIIfOpen()
119119
}
120120

Example/CCPAConsentViewController/ViewController.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import UIKit
1010
import CCPAConsentViewController
1111

1212
class ViewController: UIViewController {
13-
1413
lazy var consentViewController: CCPAConsentViewController = { return CCPAConsentViewController(
1514
accountId: 22,
1615
propertyId: 6099,
@@ -40,8 +39,8 @@ extension ViewController: ConsentDelegate {
4039
}
4140

4241
func onConsentReady(consentUUID: ConsentUUID, userConsent: UserConsent) {
43-
print("consentUUID: \(consentUUID)")
44-
print("userConsents: \(userConsent)")
42+
print("consentUUID:", consentUUID)
43+
print("userConsents:", userConsent)
4544

4645
print("CCPA applies:", UserDefaults.standard.bool(forKey: CCPAConsentViewController.CCPA_APPLIES_KEY))
4746

@@ -50,7 +49,7 @@ extension ViewController: ConsentDelegate {
5049
}
5150

5251
func onError(error: CCPAConsentViewControllerError?) {
53-
print("Error: \(error.debugDescription)")
52+
print("Error:", error.debugDescription)
5453
}
5554
}
5655

0 commit comments

Comments
 (0)