Skip to content

Commit 941a816

Browse files
authored
Merge pull request #164 from tumblr/bsu/AddConsentProvider
Add ConsentProvider to TMApiError
2 parents 851590a + 84beab2 commit 941a816

File tree

7 files changed

+18
-41
lines changed

7 files changed

+18
-41
lines changed

Classes/Errors/TMAPIError.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
*/
3737
@property (nonatomic, readonly) BOOL needsConsent;
3838

39+
/**
40+
A string that describes the expected consent flow.
41+
*/
42+
@property (nonatomic, readonly, nullable) NSString *consentProvider;
43+
3944
/**
4045
A specific property associated with some errors for the GUCE Consent flow.
4146
*/

Classes/Errors/TMAPIErrorFactory.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ - (nonnull instancetype)initWithErrors:(nonnull NSArray <NSDictionary *> *)error
4646
id needsAge = error[@"gdpr_needs_age"];
4747
id authToken = error[@"gdpr_auth_token"];
4848
id minimumRequiredAge = error[@"gdpr_minimum_required_age"];
49+
id consentProvider = error[@"consent_provider"];
4950

5051
/**
5152
* Only accept these things if they are the right type :/
@@ -64,7 +65,7 @@ - (nonnull instancetype)initWithErrors:(nonnull NSArray <NSDictionary *> *)error
6465
const NSInteger finalCodeValue = [code integerValue];
6566
const NSInteger finalMinimumRequiredAgeValue = [minimumRequiredAge integerValue];
6667

67-
[APIErrors addObject:[[TMTopLevelAPIError alloc] initWithLogout:finalLogoutValue title:title detail:detail code:finalCodeValue needsConsent:finalNeedsConsentValue isConsentBlocking:finalIsConsentBockingValue needsAge:finalNeedsAgeValue minimumRequiredAge:finalMinimumRequiredAgeValue authToken:authToken]];
68+
[APIErrors addObject:[[TMTopLevelAPIError alloc] initWithLogout:finalLogoutValue title:title detail:detail code:finalCodeValue needsConsent:finalNeedsConsentValue isConsentBlocking:finalIsConsentBockingValue needsAge:finalNeedsAgeValue minimumRequiredAge:finalMinimumRequiredAgeValue consentProvider:consentProvider authToken:authToken]];
6869
}
6970
}
7071
return APIErrors;

Classes/Errors/TMLegacyAPIError.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ @implementation TMLegacyAPIError
1717
@synthesize minimumRequiredAge = _minimumRequiredAge;
1818
@synthesize isConsentBlocking = _isConsentBlocking;
1919
@synthesize authToken = _authToken;
20+
@synthesize consentProvider = _consentProvider;
2021

2122
- (nonnull instancetype)initWithTitle:(nonnull NSString *)title detail:(nonnull NSString *)detail {
2223
NSParameterAssert(title);

Classes/Errors/TMTopLevelAPIError.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ __attribute__((objc_subclassing_restricted))
3030
*
3131
* @return An initialized instance of @c TMTopLevelAPIError.
3232
*/
33-
- (nonnull instancetype)initWithLogout:(BOOL)logout title:(nonnull NSString *)title detail:(nonnull NSString *)detail code:(NSInteger)code needsConsent:(BOOL)needsConsent isConsentBlocking:(BOOL)isConsentBlocking needsAge:(BOOL)needsAge minimumRequiredAge:(NSInteger)minimumRequiredAge authToken:(NSString * _Nullable)authToken;
33+
- (nonnull instancetype)initWithLogout:(BOOL)logout title:(nonnull NSString *)title detail:(nonnull NSString *)detail code:(NSInteger)code needsConsent:(BOOL)needsConsent isConsentBlocking:(BOOL)isConsentBlocking needsAge:(BOOL)needsAge minimumRequiredAge:(NSInteger)minimumRequiredAge consentProvider:(NSString * _Nullable)consentProvider authToken:(NSString * _Nullable)authToken;
3434

3535
@end

Classes/Errors/TMTopLevelAPIError.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ @implementation TMTopLevelAPIError
1818
@synthesize minimumRequiredAge = _minimumRequiredAge;
1919
@synthesize isConsentBlocking = _isConsentBlocking;
2020
@synthesize authToken = _authToken;
21+
@synthesize consentProvider = _consentProvider;
2122

22-
- (nonnull instancetype)initWithLogout:(BOOL)logout title:(nonnull NSString *)title detail:(nonnull NSString *)detail code:(NSInteger)code needsConsent:(BOOL)needsConsent isConsentBlocking:(BOOL)isConsentBlocking needsAge:(BOOL)needsAge minimumRequiredAge:(NSInteger)minimumRequiredAge authToken:(NSString * _Nullable)authToken {
23+
- (nonnull instancetype)initWithLogout:(BOOL)logout title:(nonnull NSString *)title detail:(nonnull NSString *)detail code:(NSInteger)code needsConsent:(BOOL)needsConsent isConsentBlocking:(BOOL)isConsentBlocking needsAge:(BOOL)needsAge minimumRequiredAge:(NSInteger)minimumRequiredAge consentProvider:(NSString *)consentProvider authToken:(NSString * _Nullable)authToken {
2324
NSParameterAssert(title);
2425
NSParameterAssert(detail);
2526
self = [super init];
@@ -34,6 +35,7 @@ - (nonnull instancetype)initWithLogout:(BOOL)logout title:(nonnull NSString *)ti
3435
_needsConsent = needsConsent;
3536
_isConsentBlocking = isConsentBlocking;
3637
_authToken = authToken;
38+
_consentProvider = consentProvider;
3739
}
3840

3941
return self;

ExampleiOS/ExampleiOS.xcodeproj/project.pbxproj

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@
320320
B901B7271C3DC99B007691FA /* Frameworks */,
321321
B901B7281C3DC99B007691FA /* Resources */,
322322
204A77D2FEE83753023A02E7 /* [CP] Embed Pods Frameworks */,
323-
15951C02DD9BA4726A6DFB51 /* [CP] Copy Pods Resources */,
324323
);
325324
buildRules = (
326325
);
@@ -340,7 +339,6 @@
340339
B901B7401C3DC99B007691FA /* Frameworks */,
341340
B901B7411C3DC99B007691FA /* Resources */,
342341
FA77AE57BB0E92B244B8AD86 /* [CP] Embed Pods Frameworks */,
343-
6BC2CF2A845D9AA7FF19F1BB /* [CP] Copy Pods Resources */,
344342
);
345343
buildRules = (
346344
);
@@ -421,28 +419,13 @@
421419
/* End PBXResourcesBuildPhase section */
422420

423421
/* Begin PBXShellScriptBuildPhase section */
424-
15951C02DD9BA4726A6DFB51 /* [CP] Copy Pods Resources */ = {
425-
isa = PBXShellScriptBuildPhase;
426-
buildActionMask = 2147483647;
427-
files = (
428-
);
429-
inputPaths = (
430-
);
431-
name = "[CP] Copy Pods Resources";
432-
outputPaths = (
433-
);
434-
runOnlyForDeploymentPostprocessing = 0;
435-
shellPath = /bin/sh;
436-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExampleiOS/Pods-ExampleiOS-resources.sh\"\n";
437-
showEnvVarsInLog = 0;
438-
};
439422
204A77D2FEE83753023A02E7 /* [CP] Embed Pods Frameworks */ = {
440423
isa = PBXShellScriptBuildPhase;
441424
buildActionMask = 2147483647;
442425
files = (
443426
);
444427
inputPaths = (
445-
"${SRCROOT}/Pods/Target Support Files/Pods-ExampleiOS/Pods-ExampleiOS-frameworks.sh",
428+
"${PODS_ROOT}/Target Support Files/Pods-ExampleiOS/Pods-ExampleiOS-frameworks.sh",
446429
"${BUILT_PRODUCTS_DIR}/TMTumblrSDK/TMTumblrSDK.framework",
447430
);
448431
name = "[CP] Embed Pods Frameworks";
@@ -451,7 +434,7 @@
451434
);
452435
runOnlyForDeploymentPostprocessing = 0;
453436
shellPath = /bin/sh;
454-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExampleiOS/Pods-ExampleiOS-frameworks.sh\"\n";
437+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ExampleiOS/Pods-ExampleiOS-frameworks.sh\"\n";
455438
showEnvVarsInLog = 0;
456439
};
457440
35122AA6CEBF3302083F7076 /* [CP] Check Pods Manifest.lock */ = {
@@ -472,21 +455,6 @@
472455
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
473456
showEnvVarsInLog = 0;
474457
};
475-
6BC2CF2A845D9AA7FF19F1BB /* [CP] Copy Pods Resources */ = {
476-
isa = PBXShellScriptBuildPhase;
477-
buildActionMask = 2147483647;
478-
files = (
479-
);
480-
inputPaths = (
481-
);
482-
name = "[CP] Copy Pods Resources";
483-
outputPaths = (
484-
);
485-
runOnlyForDeploymentPostprocessing = 0;
486-
shellPath = /bin/sh;
487-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExampleiOSTests/Pods-ExampleiOSTests-resources.sh\"\n";
488-
showEnvVarsInLog = 0;
489-
};
490458
E0F1E3731D0C9C45B8FF0037 /* [CP] Check Pods Manifest.lock */ = {
491459
isa = PBXShellScriptBuildPhase;
492460
buildActionMask = 2147483647;
@@ -511,7 +479,7 @@
511479
files = (
512480
);
513481
inputPaths = (
514-
"${SRCROOT}/Pods/Target Support Files/Pods-ExampleiOSTests/Pods-ExampleiOSTests-frameworks.sh",
482+
"${PODS_ROOT}/Target Support Files/Pods-ExampleiOSTests/Pods-ExampleiOSTests-frameworks.sh",
515483
"${BUILT_PRODUCTS_DIR}/TMTumblrSDK/TMTumblrSDK.framework",
516484
);
517485
name = "[CP] Embed Pods Frameworks";
@@ -520,7 +488,7 @@
520488
);
521489
runOnlyForDeploymentPostprocessing = 0;
522490
shellPath = /bin/sh;
523-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExampleiOSTests/Pods-ExampleiOSTests-frameworks.sh\"\n";
491+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ExampleiOSTests/Pods-ExampleiOSTests-frameworks.sh\"\n";
524492
showEnvVarsInLog = 0;
525493
};
526494
/* End PBXShellScriptBuildPhase section */

TMTumblrSDK.podspec.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "TMTumblrSDK",
3-
"version": "5.3.1",
3+
"version": "5.3.2",
44
"summary": "An unopinionated and flexible library for easily integrating Tumblr data into your iOS or OS X application.",
55
"homepage": "https://github.com/tumblr/TMTumblrSDK",
66
"source": {
77
"git": "https://github.com/tumblr/TMTumblrSDK.git",
8-
"tag": "5.3.1"
8+
"tag": "5.3.2"
99
},
1010
"license": {
1111
"type": "Apache 2.0",

0 commit comments

Comments
 (0)