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

Commit fef2cb6

Browse files
prepare for v1.3.0
1 parent 758fa46 commit fef2cb6

8 files changed

+65
-60
lines changed

CCPAConsentViewController.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'CCPAConsentViewController'
3-
s.version = '1.2.0'
3+
s.version = '1.3.0'
44
s.summary = 'SourcePoint\'s CCPAConsentViewController to handle privacy consents.'
55
s.homepage = 'https://www.sourcepoint.com'
66
s.license = { :type => 'MIT', :file => 'LICENSE' }

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.3.0 (Jun, 12, 2020)
2+
* Store the `IABUSPrivacy_String` as spec'ed by the [CCPA IAB](https://github.com/InteractiveAdvertisingBureau/USPrivacy/blob/master/CCPA/USP%20API.md#in-app-support).
3+
* Fixed an issue that'd prevent the consent message from showing again if the user dismissed it in the first place.
4+
15
## 1.2.0 (April, 30, 2020)
26
* Added authenticated consent. For more details on how to use it check the README
37

Example/Podfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- CCPAConsentViewController (1.2.0)
2+
- CCPAConsentViewController (1.3.0)
33
- IQKeyboardManagerSwift (6.5.4)
44
- Nimble (8.0.4)
55
- Quick (2.2.0)
@@ -24,7 +24,7 @@ EXTERNAL SOURCES:
2424
:path: "../"
2525

2626
SPEC CHECKSUMS:
27-
CCPAConsentViewController: d958510fbcb970a607ad51dbe73fbc8e98e1737a
27+
CCPAConsentViewController: 559add7ce7cfb9ec282cbff2a60c6903d080c8a3
2828
IQKeyboardManagerSwift: 2dde0fc70110e8eac7ccce2a46fdbec6a850b414
2929
Nimble: 18d5360282923225d62b09d781f63abc1a0111fc
3030
Quick: 7fb19e13be07b5dfb3b90d4f9824c855a11af40e

Example/Pods/Local Podspecs/CCPAConsentViewController.podspec.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/CCPAConsentViewController/CCPAConsentViewController-Info.plist

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/CCPAConsentViewController/ResourceBundle-CCPAConsentViewController-CCPAConsentViewController-Info.plist

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+52-51
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We strongly recommend the use of [CocoaPods](https://cocoapods.org) in order to
88
In your `Podfile` add the following line to your app target:
99

1010
```
11-
pod 'CCPAConsentViewController', '1.1.3'
11+
pod 'CCPAConsentViewController', '1.3.0'
1212
```
1313
### Carthage
1414
We also support [Carthage](https://github.com/Carthage/Carthage). It requires a couple more steps to install so we dedicated a whole [wiki page](https://github.com/SourcePointUSA/CCPA_iOS_SDK/wiki/Carthage-SDK-integration-guide) for it.
@@ -30,19 +30,31 @@ It's pretty simple, here are 5 easy steps for you:
3030

3131
### Swift
3232
```swift
33-
import UIKit
3433
import CCPAConsentViewController
3534

36-
class ViewController: UIViewController, ConsentDelegate {
35+
class ViewController: UIViewController {
36+
let logger = Logger()
37+
3738
lazy var consentViewController: CCPAConsentViewController = { return CCPAConsentViewController(
38-
accountId: 22,
39-
propertyId: 6099,
40-
propertyName: try! PropertyName("ccpa.mobile.demo"),
41-
PMId: "5df9105bcf42027ce707bb43",
42-
campaignEnv: .Public,
43-
consentDelegate: self
39+
accountId: 22,
40+
propertyId: 6099,
41+
propertyName: try! PropertyName("ccpa.mobile.demo"),
42+
PMId: "5df9105bcf42027ce707bb43",
43+
campaignEnv: .Public,
44+
consentDelegate: self
4445
)}()
4546

47+
@IBAction func onPrivacySettingsTap(_ sender: Any) {
48+
consentViewController.loadPrivacyManager()
49+
}
50+
51+
override func viewDidLoad() {
52+
super.viewDidLoad()
53+
consentViewController.loadMessage()
54+
}
55+
}
56+
57+
extension ViewController: ConsentDelegate {
4658
func ccpaConsentUIWillShow() {
4759
present(consentViewController, animated: true, completion: nil)
4860
}
@@ -54,19 +66,12 @@ class ViewController: UIViewController, ConsentDelegate {
5466
func onConsentReady(consentUUID: ConsentUUID, userConsent: UserConsent) {
5567
print("consentUUID: \(consentUUID)")
5668
print("userConsents: \(userConsent)")
69+
print("CCPA applies:", UserDefaults.standard.bool(forKey: CCPAConsentViewController.CCPA_APPLIES_KEY))
70+
print("US Privacy String:", UserDefaults.standard.string(forKey: CCPAConsentViewController.IAB_PRIVACY_STRING_KEY)!)
5771
}
5872

5973
func onError(error: CCPAConsentViewControllerError?) {
60-
print("Error: \(error?.description ?? "Something Went Wrong")")
61-
}
62-
63-
@IBAction func onPrivacySettingsTap(_ sender: Any) {
64-
consentViewController.loadPrivacyManager()
65-
}
66-
67-
override func viewDidLoad() {
68-
super.viewDidLoad()
69-
consentViewController.loadMessage()
74+
logger.log("Error: %{public}@", [error?.description ?? "Something Went Wrong"])
7075
}
7176
}
7277
```
@@ -76,53 +81,49 @@ class ViewController: UIViewController, ConsentDelegate {
7681
#import "ViewController.h"
7782
@import CCPAConsentViewController;
7883

79-
@interface ViewController ()<ConsentDelegate>
80-
84+
@interface ViewController ()<ConsentDelegate> {
85+
CCPAConsentViewController *ccpa;
86+
}
8187
@end
8288

8389
@implementation ViewController
8490

85-
CCPAConsentViewController *cvc;
86-
8791
- (void)viewDidLoad {
8892
[super viewDidLoad];
93+
PropertyName *propertyName = [[PropertyName alloc] init:@"ccpa.mobile.demo" error:NULL];
94+
ccpa = [[CCPAConsentViewController alloc]
95+
initWithAccountId:22
96+
propertyId:6099
97+
propertyName:propertyName
98+
PMId:@"5df9105bcf42027ce707bb43"
99+
campaignEnv:CampaignEnvPublic
100+
consentDelegate:self];
101+
[ccpa loadMessage];
102+
}
89103

90-
PropertyName *propertyName = [[PropertyName alloc] init:@"ccpa.mobile.demo" error: nil];
91-
92-
cvc = [[CCPAConsentViewController alloc]
93-
initWithAccountId:22
94-
propertyId:6099
95-
propertyName:propertyName
96-
PMId:@"5df9105bcf42027ce707bb43"
97-
campaignEnv:CampaignEnvPublic
98-
consentDelegate:self];
99-
100-
[cvc loadMessage];
104+
- (void)consentUIWillShow {
105+
[self presentViewController:ccpa animated:true completion:NULL];
101106
}
102107

103-
- (IBAction)onPrivacySettingsTap:(UIButton *)sender {
104-
[cvc loadPrivacyManager];
108+
- (void)consentUIDidDisappear {
109+
[self dismissViewControllerAnimated:true completion:nil];
105110
}
106111

107112
- (void)onConsentReadyWithConsentUUID:(NSString *)consentUUID userConsent:(UserConsent *)userConsent {
108-
NSLog(@"uuid: %@", consentUUID);
109-
NSLog(@"userConsent: %@", userConsent);
113+
NSLog(@"ConsentUUID: %@", consentUUID);
114+
NSLog(@"US Privacy String: %@", userConsent.uspstring);
115+
NSLog(@"Consent status: %ld", (long)userConsent.status);
116+
for (id vendorId in userConsent.rejectedVendors) {
117+
NSLog(@"Rejected to Vendor(id: %@)", vendorId);
118+
}
119+
for (id purposeId in userConsent.rejectedCategories) {
120+
NSLog(@"Rejected to Purpose(id: %@)", purposeId);
121+
}
110122
}
111123

112124
- (void)onErrorWithError:(CCPAConsentViewControllerError *)error {
113-
NSLog(@"Error: %@", error);
114-
[self dismissViewControllerAnimated:NO completion:nil];
115-
}
116-
117-
118-
- (void)consentUIDidDisappear {
119-
[self dismissViewControllerAnimated:YES completion:nil];
120-
}
121-
122-
- (void)ccpaConsentUIWillShow {
123-
[self presentViewController:cvc animated:YES completion:NULL];
125+
NSLog(@"Something went wrong: %@", error);
124126
}
125-
126127
@end
127128
```
128129
@@ -131,7 +132,7 @@ CCPAConsentViewController *cvc;
131132
#### How does it work?
132133
You need to give us a `authId`, that can be anything, user name, email, uuid, as long as you can uniquely identifies an user in your user base.
133134
134-
We'll check our database for a consent profile associated with that `authId`. If we find one, we'll bring it to the user's device and not show a consent message again (technically this will depend on the scenario setup in our dashboard). If we haven't found any consent profile for that `authId` we'll create one and associate with the current user.
135+
We'll check our database for a consent profile associated with that `authId`. If we find one, we'll bring it to the user's device and not show a consent message again (technically this will depend on the scenario setup in our dashboard). If we haven't found any consent profile for that `authId` we'll create one and associate with the current user.
135136
136137
#### How to use it?
137138

0 commit comments

Comments
 (0)