forked from fyber-engineering/mopub-ios-mediation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Fyber-adapter-fix
- Loading branch information
Showing
35 changed files
with
411 additions
and
511 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.podspec | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.