Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Bump Publisher SDK version to 3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vguerci committed Jun 18, 2020
1 parent b925d15 commit d16bd3b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Criteo MoPub Mediation Adapters Changelog
--------------------------------------------------------------------------------
Note: Adapters are updated to follow Criteo Publisher SDK versions.
i.e. v3.6.1.0 adapters target a SDK with minimum v3.6.1
i.e. v3.6.1.0 adapters target a SDK with minimum v3.6.1
Unless the adapters themselves are modified, this won't be reflected in this changelog.
--------------------------------------------------------------------------------
## Version 3.4.1.0
Expand Down
4 changes: 2 additions & 2 deletions CRCriteoAdapterConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ - (NSString *)adapterVersion {
// We use an hardcoded value (not a macro) so
// that the file is self-contained in the
// open-source repository.
return @"3.6.1.0";
return @"3.7.0.0";
}

- (NSString *)biddingToken {
Expand All @@ -36,7 +36,7 @@ - (NSString *)moPubNetworkName{
}

- (NSString *)networkSdkVersion {
return @"3.6.1.0";
return @"3.7.0.0";
}

- (void)initializeNetworkWithConfiguration:(NSDictionary<NSString *, id> *)configuration complete:(void(^)(NSError *))complete {
Expand Down
8 changes: 7 additions & 1 deletion CRCustomEventHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@

NS_ASSUME_NONNULL_BEGIN

extern NSString * const kCRCustomEventHelperCpId;
extern NSString * const kCRCustomEventHelperAdUnitId;

@interface CRCustomEventHelper : NSObject

+ (BOOL) checkValidInfo:(NSDictionary *)info;
+ (BOOL)checkValidInfo:(NSDictionary *)info;

+ (BOOL)checkValidInfo:(NSDictionary *)eventInfo
withError:(NSError **)error;

@end

Expand Down
40 changes: 31 additions & 9 deletions CRCustomEventHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,43 @@
// limitations under the License.

#import "CRCustomEventHelper.h"
#import "MPNativeAdError.h"

NSString * const cpId = @"cpId";
NSString * const adUnitId = @"adUnitId";
NSString * const kCRCustomEventHelperCpId = @"cpId";
NSString * const kCRCustomEventHelperAdUnitId = @"adUnitId";

@implementation CRCustomEventHelper

+ (BOOL) checkValidInfo:(NSDictionary *)info {
if (info){
if ([info[cpId] isKindOfClass:NSString.class] && [info[adUnitId] isKindOfClass:NSString.class]){
if ([info[cpId] length] > 0 && [info[adUnitId] length] > 0){
return YES;
}
+ (BOOL)checkValidInfo:(NSDictionary *)info {
return [self checkValidInfo:info
withError:nil];
}

+ (BOOL)checkValidInfo:(NSDictionary *)eventInfo
withError:(NSError **)error {
NSArray<NSString *> *expectedKeys = @[
kCRCustomEventHelperCpId,
kCRCustomEventHelperAdUnitId
];
NSMutableString *errorMsg = [[NSMutableString alloc] init];
BOOL isValid = YES;
for (NSString *key in expectedKeys) {
NSString *value = eventInfo[key];
if (![value isKindOfClass:NSString.class] ||
(value.length == 0)) {
isValid = NO;
NSString *str = [[NSString alloc] initWithFormat:
@"The Criteo '%@' key is missing or invalid. ",
key];
[errorMsg appendString:str];
}
}
return NO;
if (!isValid && (error != nil)) {
[errorMsg appendString:@"No ad request sent. "
"Ensure this key is valid on the MoPub dashboard."];
*error = MPNativeAdNSErrorForInvalidAdServerResponse(errorMsg);
}
return isValid;
}

@end

0 comments on commit d16bd3b

Please sign in to comment.