Skip to content

Commit

Permalink
Merge branch 'master' into Fyber-adapter-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
leberwurstsaft committed Sep 15, 2021
2 parents a467a70 + c8ea5a6 commit edd979c
Show file tree
Hide file tree
Showing 35 changed files with 411 additions and 511 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.podspec
.DS_Store
3 changes: 3 additions & 0 deletions AdMob/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Changelog
* 8.10.0.0
* This version of the adapters has been certified with AdMob 8.10.0 and MoPub 5.18.0.

* 8.9.0.0
* This version of the adapters has been certified with AdMob 8.9.0 and MoPub 5.18.0.

Expand Down
2 changes: 1 addition & 1 deletion AdMob/GoogleAdMobAdapterConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ + (void)updateInitializationParameters:(NSDictionary *)parameters {
#pragma mark - MPAdapterConfiguration

- (NSString *)adapterVersion {
return @"8.9.0.0";
return @"8.10.0.0";
}

- (NSString *)biddingToken {
Expand Down
2 changes: 1 addition & 1 deletion AppLovin/AppLovinAdapterConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ @implementation AppLovinAdapterConfiguration

static NSString *const kAppLovinSDKInfoPlistKey = @"AppLovinSdkKey";
static NSString *const kAdapterErrorDomain = @"com.mopub.mopub-ios-sdk.mopub-applovin-adapters";
static NSString *const kAdapterVersion = @"10.3.4.0";
static NSString *const kAdapterVersion = @"10.3.5.0";

static NSString *gSdkKey = nil;

Expand Down
3 changes: 3 additions & 0 deletions AppLovin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Changelog
* 10.3.5.0
* This version of the adapters has been certified with AppLovin SDK 10.3.5 and MoPub SDK 5.18.0.

* 10.3.4.0
* This version of the adapters has been certified with AppLovin SDK 10.3.4 and MoPub SDK 5.18.0.

Expand Down
5 changes: 4 additions & 1 deletion Fyber/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog
* 7.8.8.0
* 7.8.9.0
* This version of the adapters has been certified with Fyber Marketplace 7.8.9 and MoPub SDK 5.18.0.

* 7.8.8.0
* Added support for DV360 SCAR integration for full screen ads.
* iOS 14.5 and SKAdNetwork 2.2 support - Xcode 12.5+ is not required anymore, 12.4+ required (in contrary to version 7.8.5).
* Changed the SDK frameworks type from “.framework” to “.xcframework”. When integrating manually: “IASDKResources.bundle” is now inside ‘IASDKCore.xcframework’ and should be taken from there.
Expand Down
2 changes: 1 addition & 1 deletion Fyber/FyberAdapterConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ + (void)initialize {
#pragma mark - MPAdapterConfiguration

- (NSString *)adapterVersion {
return @"7.8.8.0";
return @"7.8.9.0";
}

- (NSString *)biddingToken {
Expand Down
3 changes: 3 additions & 0 deletions InMobi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Changelog
* 9.2.1.0
* This version of the adapters has been certified with InMobi 9.2.1 and MoPub SDK 5.18.0.

* 9.2.0.1
* Adjust minimium MoPub SDK version from 5.17.0 to 5.17. This allows integrations to use MoPub 5.17.x up to (but not including) 6.0.
* Service release. No new features.
Expand Down
2 changes: 1 addition & 1 deletion InMobi/InMobiAdapterConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ @implementation InMobiAdapterConfiguration
#pragma mark - MPAdapterConfiguration

- (NSString *)adapterVersion {
return @"9.2.0.1";
return @"9.2.1.0";
}

- (NSString *)biddingToken {
Expand Down
3 changes: 3 additions & 0 deletions IronSource/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Changelog
* 7.1.10.0.0
* This version of the adapters has been certified with ironSource 7.1.10.0 and MoPub SDK 5.18.0.

* 7.1.8.0.0
* This version of the adapters has been certified with ironSource 7.1.8.0 and MoPub SDK 5.18.0.

Expand Down
2 changes: 1 addition & 1 deletion IronSource/IronSourceAdapterConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ + (void)updateInitializationParameters:(NSDictionary *)parameters {
#pragma mark - MPAdapterConfiguration

- (NSString *)adapterVersion {
return @"7.1.8.0.0";
return @"7.1.10.0.0";
}

- (NSString *)biddingToken {
Expand Down
6 changes: 6 additions & 0 deletions Mintegral/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## Changelog
* 7.0.1.0.0
* This version of the adapters has been certified with Mintegral 7.0.1.0 and MoPub 5.18.0.

* 7.0.0.0.0
* This version of the adapters has been certified with Mintegral 7.0.0.0 and MoPub 5.18.0.

* 6.9.6.0.0
* This version of the adapters has been certified with Mintegral 6.9.6.0 and MoPub 5.18.0.

Expand Down
2 changes: 1 addition & 1 deletion Mintegral/MintegralAdapterConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ @interface MintegralAdapterConfiguration()

static NSString * const MintegralConfigurationKeyAppIdKey = @"appId";
static NSString * const MintegralConfigurationKeyAppKey = @"appKey";
static NSString * const kAdapterVersion = @"6.9.6.0.0";
static NSString * const kAdapterVersion = @"7.0.1.0.0";
static NSString * const kPluginNumber = @"Y+H6DFttYrPQYcIA+F2F+F5/Hv==";
static NSString * const kNetworkName = @"mintegral";

Expand Down
3 changes: 3 additions & 0 deletions Pangle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Changelog
* 3.9.0.4.0
* This version of the adapters has been certified with Pangle 3.9.0.4 and MoPub SDK 5.18.0.

* 3.8.1.0.0
* This version of the adapters has been certified with Pangle 3.8.1.0 and MoPub SDK 5.18.0.

Expand Down
2 changes: 1 addition & 1 deletion Pangle/PangleAdapterConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ @implementation PangleAdapterConfiguration
static NSInteger mRewardAmount;
static NSString *mMediaExtra;

static NSString * const kAdapterVersion = @"3.8.1.0.0";
static NSString * const kAdapterVersion = @"3.9.0.4.0";
static NSString * const kAdapterErrorDomain = @"com.mopub.mopub-ios-sdk.mopub-pangle-adapters";

typedef NS_ENUM(NSInteger, PangleAdapterErrorCode) {
Expand Down
3 changes: 3 additions & 0 deletions UnityAds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

## Changelog
* 3.7.5.2
* Refactor and update adapters to use latest Unity APIs.

* 3.7.5.1
* Adjust minimium MoPub SDK version from 5.17.0 to 5.17. This allows integrations to use MoPub 5.17.x up to (but not including) 6.0.
* Service release. No new features.
Expand Down
17 changes: 17 additions & 0 deletions UnityAds/NSError+UnityAdAdapter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#import <Foundation/Foundation.h>
#import <UnityAds/UnityAds.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSError (UnityAdAdapter)

+ (NSError *)errorWithBannerCode:(UADSBannerErrorCode)code;
+ (NSError *)errorWithDescription:(NSString *)description;
+ (NSError *)errorWithDescription:(NSString *)description reason:(NSString *)reason suggestion:(NSString *)suggestion;
+ (NSError *)errorWithAdAdapterErrorCode:(NSInteger)code description:(NSString *)description;
+ (NSError *)errorWithAdAdapterErrorCode:(NSInteger)code description:(NSString *)description suggestion:(NSString *)suggestion;
+ (NSError *)errorWithAdAdapterErrorCode:(NSInteger)code description:(NSString *)description reason:(NSString *)reason suggestion:(NSString *)suggestion;

@end

NS_ASSUME_NONNULL_END
58 changes: 58 additions & 0 deletions UnityAds/NSError+UnityAdAdapter.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#import "NSError+UnityAdAdapter.h"

static NSString * const kUnityAdAdapterErrorDomain = @"com.mopub.mopub-ios-sdk.mopub-unity-adapters";

@interface NSString (Prefix)
- (NSString *)addUnityPrefix;
@end

@implementation NSString (Prefix)
- (NSString *)addUnityPrefix {
return [NSString stringWithFormat:@"[Unity Ads] %@", self];
}
@end

@implementation NSError (UnityAdAdapter)

+ (NSError *)errorWithBannerCode:(UADSBannerErrorCode)code {
switch (code) {
case UADSBannerErrorCodeUnknown:
return [NSError errorWithDescription:@"Banner returned unknown error"];

case UADSBannerErrorCodeNativeError:
return [NSError errorWithDescription:@"Banner returned native error. Failed to initialize."];

case UADSBannerErrorCodeWebViewError:
return [NSError errorWithDescription:@"Banner returned WebView error. Failed to fetch banner size."];

case UADSBannerErrorCodeNoFillError:
return [NSError errorWithDescription:@"Banner returned no fill"];
}
}

+ (NSError *)errorWithDescription:(NSString *)description {
return [NSError errorWithDescription:description reason:@"" suggestion:@""];
}

+ (NSError *)errorWithDescription:(NSString *)description reason:(NSString *)reason suggestion:(NSString *)suggestion {
return [NSError errorWithAdAdapterErrorCode:0 description:description reason:reason suggestion:suggestion];
}

+ (NSError *)errorWithAdAdapterErrorCode:(NSInteger)code description:(NSString *)description {
return [NSError errorWithAdAdapterErrorCode:code description:description reason:@"" suggestion:@""];
}

+ (NSError *)errorWithAdAdapterErrorCode:(NSInteger)code description:(NSString *)description suggestion:(NSString *)suggestion {
return [NSError errorWithAdAdapterErrorCode:code description:description reason:@"" suggestion:suggestion];
}

+ (NSError *)errorWithAdAdapterErrorCode:(NSInteger)code description:(NSString *)description reason:(NSString *)reason suggestion:(NSString *)suggestion {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: [NSLocalizedString(description, nil) addUnityPrefix],
NSLocalizedFailureReasonErrorKey: NSLocalizedString(reason, nil),
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(suggestion, nil)
};
return [NSError errorWithDomain:kUnityAdAdapterErrorDomain code:code userInfo:userInfo];
}

@end
13 changes: 6 additions & 7 deletions UnityAds/UnityAdsAdapterConfiguration.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// UnityAdsAdapterConfiguration.h
// MoPubSDK
//
// Copyright © 2017 MoPub. All rights reserved.
//

#import <Foundation/Foundation.h>
#if __has_include(<MoPub/MoPub.h>)
#import <MoPub/MoPub.h>
Expand All @@ -29,6 +22,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (void)updateInitializationParameters:(NSDictionary *)parameters;

/**
Initializes UnityAds sdk if it wasn't initialized before.
@param gameId Unique identifier for a game, given by Unity Ads admin tools or Unity editor.
*/
+ (void)initializeIfNeeded:(NSString *)gameId complete:(void(^ _Nullable)(NSError * _Nullable))complete;

// MPAdapterConfiguration
@property (nonatomic, copy, readonly) NSString * adapterVersion;
@property (nonatomic, copy, readonly) NSString * biddingToken;
Expand Down
30 changes: 14 additions & 16 deletions UnityAds/UnityAdsAdapterConfiguration.m
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
//
// UnityAdsAdapterConfiguration.m
// MoPubSDK
//
// Copyright © 2017 MoPub. All rights reserved.
//

#import <UnityAds/UnityAds.h>
#import "UnityAdsAdapterConfiguration.h"
#import "UnityRouter.h"
#import "NSError+UnityAdAdapter.h"
#if __has_include("MoPub.h")
#import "MoPub.h"
#import "MPLogging.h"
#endif

//Adapter version
NSString *const ADAPTER_VERSION = @"3.7.5.1";
NSString *const ADAPTER_VERSION = @"3.7.5.2";

// Initialization configuration keys
static NSString * const kUnityAdsGameId = @"gameId";

// Errors
static NSString * const kAdapterErrorDomain = @"com.mopub.mopub-ios-sdk.mopub-unity-adapters";

typedef NS_ENUM(NSInteger, UnityAdsAdapterErrorCode) {
UnityAdsAdapterErrorCodeMissingGameId,
};
Expand All @@ -41,14 +32,22 @@ + (void)updateInitializationParameters:(NSDictionary *)parameters {
}
}

+ (void)initializeIfNeeded:(NSString *)gameId complete:(void(^ _Nullable)(NSError * _Nullable))complete; {
if (![UnityAds isInitialized]) {
[[UnityRouter sharedRouter] initializeWithGameId:gameId withCompletionHandler:^(NSError * _Nullable error) {
complete(error);
}];
}
}

#pragma mark - MPAdapterConfiguration

- (NSString *)adapterVersion {
return ADAPTER_VERSION;
}

- (NSString *)biddingToken {
return nil;
return [UnityAds getToken];
}

- (NSString *)moPubNetworkName {
Expand All @@ -63,7 +62,9 @@ - (void)initializeNetworkWithConfiguration:(NSDictionary<NSString *, id> *)confi
complete:(void(^)(NSError *))complete {
NSString * gameId = configuration[kUnityAdsGameId];
if (gameId == nil) {
NSError * error = [NSError errorWithDomain:kAdapterErrorDomain code:UnityAdsAdapterErrorCodeMissingGameId userInfo:@{ NSLocalizedDescriptionKey: @"Unity Ads initialization skipped. The gameId is empty. Ensure it is properly configured on the MoPub dashboard." }];
NSError * error = [NSError errorWithAdAdapterErrorCode: UnityAdsAdapterErrorCodeMissingGameId
description: @"Initialization skipped. The gameId is empty."
suggestion: @"Ensure it is properly configured on the MoPub dashboard."];
MPLogEvent([MPLogEvent error:error message:nil]);

if (complete != nil) {
Expand All @@ -75,9 +76,6 @@ - (void)initializeNetworkWithConfiguration:(NSDictionary<NSString *, id> *)confi
[[UnityRouter sharedRouter] initializeWithGameId:gameId withCompletionHandler:^(NSError * _Nullable error) {
complete(error);
}];

BOOL debugModeEnabled = (MPLogging.consoleLogLevel == MPBLogLevelDebug);
[UnityAds setDebugMode:debugModeEnabled];
}

@end
Loading

0 comments on commit edd979c

Please sign in to comment.