Skip to content

Commit d55e956

Browse files
committed
add consentprovider to tmapierror
1 parent 851590a commit d55e956

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
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;

0 commit comments

Comments
 (0)