This commit is contained in:
2023-12-06 14:51:43 +05:30
parent 133f0413f2
commit 5df6ee8ae5
530 changed files with 26339 additions and 12407 deletions

View File

@@ -0,0 +1,10 @@
#import <Foundation/Foundation.h>
#import <Appodeal/Appodeal.h>
typedef void (*AppodealAdRevenueCallback) ();
@interface AppodealAdRevenueDelegate : NSObject <AppodealAdRevenueDelegate>
@property (assign, nonatomic) AppodealAdRevenueCallback adRevenueReceivedCallback;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: bcd35c0f3c434841a34ee7946a4f5d0c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
#import "AppodealAdRevenueDelegate.h"
@implementation AppodealAdRevenueDelegate
- (void)didReceiveRevenueForAd:(id<AppodealAdRevenue>)ad {
if(self.adRevenueReceivedCallback) {
self.adRevenueReceivedCallback(
[ad.adTypeString UTF8String],
[ad.networkName UTF8String],
[ad.adUnitName UTF8String],
[ad.demandSource UTF8String],
[ad.placement UTF8String],
(double)ad.revenue,
[ad.currency UTF8String],
[ad.revenuePrecision UTF8String]);
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 74079aa2215c4d6ba505e0777647b688
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
#import <Foundation/Foundation.h>
#import <Appodeal/Appodeal.h>
typedef void (*AppodealBannerCallbacks) ();
typedef void (*AppodealBannerDidLoadCallback) (int height, BOOL isPrecache);
@interface AppodealBannerDelegate : NSObject <AppodealBannerDelegate>
@property (assign, nonatomic) AppodealBannerDidLoadCallback bannerDidLoadAdCallback;
@property (assign, nonatomic) AppodealBannerCallbacks bannerDidFailToLoadAdCallback;
@property (assign, nonatomic) AppodealBannerCallbacks bannerDidClickCallback;
@property (assign, nonatomic) AppodealBannerCallbacks bannerDidExpiredCallback;
@property (assign, nonatomic) AppodealBannerCallbacks bannerDidShowCallback;
@property (assign, nonatomic) AppodealBannerCallbacks bannerDidFailToPresentCallback;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 6a99378f41d0e46e4ae93b774a61137c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,90 @@
#import "AppodealBannerDelegate.h"
#import <WebKit/WebKit.h>
@interface UIView (AppodealUnityPlugin)
@property (nonatomic, readonly) NSMutableArray <UIView *> *recursiveSubviews;
@end
@implementation UIView (AppodealUnityPlugin)
- (NSMutableArray<UIView *> *)recursiveSubviews {
NSMutableArray <UIView *> *recursiveSubviews = [NSMutableArray arrayWithObject:self];
for (UIView *view in self.subviews) {
[recursiveSubviews addObjectsFromArray:view.recursiveSubviews];
}
return recursiveSubviews;
}
@end
@interface AppodealBannerDelegate ()
@property (nonatomic, strong) NSHashTable<UIView *> *ignoresTouchViews;
@end
@implementation AppodealBannerDelegate
- (NSHashTable *)ignoresTouchViews {
if (!_ignoresTouchViews) {
_ignoresTouchViews = [NSHashTable weakObjectsHashTable];
}
return _ignoresTouchViews;
}
- (void)bannerDidLoadAdIsPrecache:(BOOL)precache {
int height = (int)(Appodeal.banner.bounds.size.height);
if (self.bannerDidLoadAdCallback) {
self.bannerDidLoadAdCallback(height, precache);
}
}
- (void)bannerDidShow {
[self reattachTouchProcessingSubviews];
if (self.bannerDidShowCallback) {
self.bannerDidShowCallback();
}
}
-(void) bannerDidFailToPresentWithError:(NSError *)error {
if (self.bannerDidFailToPresentCallback) {
self.bannerDidFailToPresentCallback();
}
}
- (void)bannerDidClick {
if (self.bannerDidClickCallback) {
self.bannerDidClickCallback();
}
}
- (void)bannerDidFailToLoadAd {
if (self.bannerDidFailToLoadAdCallback) {
self.bannerDidFailToLoadAdCallback();
}
}
- (void)bannerDidExpired {
if (self.bannerDidExpiredCallback) {
self.bannerDidExpiredCallback();
}
}
- (void)reattachTouchProcessingSubviews {
for (UIView *view in self.ignoresTouchViews) {
UnityDropViewTouchProcessing(view);
}
NSArray <UIView *> *ignoresTouchViews = [Appodeal.banner recursiveSubviews];
for (UIView *view in ignoresTouchViews) {
[self.ignoresTouchViews addObject:view];
UnitySetViewTouchProcessing(view, touchesTransformedToUnityViewCoords);
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: b375153b4f23348ac8c9f77062aabaa5
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
#import <Foundation/Foundation.h>
#import <Appodeal/Appodeal.h>
typedef void (*AppodealBannerViewCallbacks) ();
typedef void (*AppodealBannerViewDidLoadCallback) ();
@interface AppodealBannerViewDelegate : NSObject <APDBannerViewDelegate>
@property (assign, nonatomic) AppodealBannerViewDidLoadCallback bannerViewDidLoadAdCallback;
@property (assign, nonatomic) AppodealBannerViewCallbacks bannerViewDidFailToLoadAdCallback;
@property (assign, nonatomic) AppodealBannerViewCallbacks bannerViewDidClickCallback;
@property (assign, nonatomic) AppodealBannerViewCallbacks bannerViewDidShowCallback;
@property (assign, nonatomic) AppodealBannerViewCallbacks bannerViewDidFailToPresentCallback;
@property (assign, nonatomic) AppodealBannerViewCallbacks bannerViewDidExpiredCallback;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: f9c3834ac46684feda51a1a5d2a350ce
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,63 @@
#import "AppodealBannerViewDelegate.h"
@interface AppodealBannerViewDelegate ()
@property (nonatomic, weak) UIView *touchIgnoresView;
@end
@implementation AppodealBannerViewDelegate
- (void)bannerViewDidLoadAd:(APDBannerView *)bannerView isPrecache:(BOOL)precache {
if (self.bannerViewDidLoadAdCallback) {
self.bannerViewDidLoadAdCallback(precache);
}
}
- (void)bannerViewDidRefresh:(APDBannerView *)bannerView {
[self reattachTouchProcessingView:bannerView];
}
- (void)bannerViewDidInteract:(APDBannerView *)bannerView {
if(self.bannerViewDidClickCallback) {
self.bannerViewDidClickCallback();
}
}
- (void)bannerViewDidShow:(APDBannerView *)bannerView {
if(self.bannerViewDidShowCallback) {
self.bannerViewDidShowCallback();
}
}
- (void)bannerView:(APDBannerView *)bannerView didFailToLoadAdWithError:(NSError *)error {
if (self.bannerViewDidFailToLoadAdCallback) {
self.bannerViewDidFailToLoadAdCallback();
}
}
- (void)bannerView:(APDBannerView *)bannerView didFailToPresentWithError:(NSError *)error {
if (self.bannerViewDidFailToPresentCallback) {
self.bannerViewDidFailToPresentCallback();
}
}
- (void)bannerViewExpired:(APDBannerView *)bannerView{
if (self.bannerViewDidExpiredCallback) {
self.bannerViewDidExpiredCallback();
}
}
- (void)reattachTouchProcessingView:(UIView *)view {
if (self.touchIgnoresView) {
UnityDropViewTouchProcessing(self.touchIgnoresView);
}
if (view) {
self.touchIgnoresView = view;
UnitySetViewTouchProcessing(view, touchesTransformedToUnityViewCoords);
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 757369669b0db40a8a3f6fbabc8399b4
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,2 @@
typedef void (InAppPurchaseValidationSucceededCallback)(const char *data);
typedef void (InAppPurchaseValidationFailedCallback)(const char *error);

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: bafc0b387f4a24679a8b886f88d1f445
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
#import <Foundation/Foundation.h>
#import <Appodeal/Appodeal.h>
typedef void (*AppodealInitializationCallback) ();
@interface AppodealInitializationDelegate : NSObject <AppodealInitializationDelegate>
@property (assign, nonatomic) AppodealInitializationCallback initializationCompletedCallback;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: e94ffe2ab38324b44849e0bc6236554a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
#import "AppodealInitializationDelegate.h"
@implementation AppodealInitializationDelegate
-(void) appodealSDKDidInitialize {
if(self.initializationCompletedCallback) {
self.initializationCompletedCallback();
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 5116e0b5bde9e44f4a8601a205c34597
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
#import <Foundation/Foundation.h>
#import <Appodeal/Appodeal.h>
typedef void (*AppodealInterstitialCallbacks) ();
typedef void (*AppodealInterstitialDidLoadCallback) (BOOL isPrecache);
@interface AppodealInterstitialDelegate : NSObject <AppodealInterstitialDelegate>
@property (assign, nonatomic) AppodealInterstitialDidLoadCallback interstitialDidLoadCallback;
@property (assign, nonatomic) AppodealInterstitialCallbacks interstitialDidFailToLoadAdCallback;
@property (assign, nonatomic) AppodealInterstitialCallbacks interstitialDidFailToPresentCallback;
@property (assign, nonatomic) AppodealInterstitialCallbacks interstitialWillPresentCallback;
@property (assign, nonatomic) AppodealInterstitialCallbacks interstitialDidDismissCallback;
@property (assign, nonatomic) AppodealInterstitialCallbacks interstitialDidClickCallback;
@property (assign, nonatomic) AppodealInterstitialCallbacks interstitialsDidExpiredCallback;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 13599b353182e458992b88b057f67a2e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
#import "AppodealInterstitialDelegate.h"
#import "UnityInterface.h"
@implementation AppodealInterstitialDelegate
-(void) interstitialDidLoadAdIsPrecache:(BOOL)precache {
if(self.interstitialDidLoadCallback) {
self.interstitialDidLoadCallback(precache);
}
}
-(void) interstitialDidFailToLoadAd {
if(self.interstitialDidFailToLoadAdCallback) {
self.interstitialDidFailToLoadAdCallback();
}
}
-(void) interstitialDidFailToPresent {
if(self.interstitialDidFailToPresentCallback){
self.interstitialDidFailToPresentCallback();
}
}
-(void) interstitialWillPresent {
if(self.interstitialWillPresentCallback) {
self.interstitialWillPresentCallback();
}
}
-(void) interstitialDidDismiss {
extern bool _didResignActive;
if(_didResignActive) {
return;
}
if(self.interstitialDidDismissCallback) {
self.interstitialDidDismissCallback();
}
}
-(void) interstitialDidClick {
if(self.interstitialDidClickCallback) {
self.interstitialDidClickCallback();
}
}
-(void) interstitialDidExpired{
if(self.interstitialsDidExpiredCallback){
self.interstitialsDidExpiredCallback();
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 30d780ee2de5344449d3b3b4f213998b
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
#import <Foundation/Foundation.h>
#import <Appodeal/Appodeal.h>
typedef void (*AppodealMrecViewCallbacks) ();
typedef void (*AppodealMrecViewDidLoadCallback) ();
@interface AppodealMrecViewDelegate : NSObject <APDBannerViewDelegate>
@property (assign, nonatomic) AppodealMrecViewDidLoadCallback mrecViewDidLoadAdCallback;
@property (assign, nonatomic) AppodealMrecViewCallbacks mrecViewDidFailToLoadAdCallback;
@property (assign, nonatomic) AppodealMrecViewCallbacks mrecViewDidClickCallback;
@property (assign, nonatomic) AppodealMrecViewCallbacks mrecViewDidShowCallback;
@property (assign, nonatomic) AppodealMrecViewCallbacks mrecViewDidFailToPresentCallback;
@property (assign, nonatomic) AppodealMrecViewCallbacks mrecViewDidExpiredCallback;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: f68595bc7cf234382ae5cae268ab33d2
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,63 @@
#import "AppodealMrecViewDelegate.h"
@interface AppodealMrecViewDelegate ()
@property (nonatomic, weak) UIView *touchIgnoresView;
@end
@implementation AppodealMrecViewDelegate
- (void)bannerViewDidLoadAd:(APDBannerView *)bannerView isPrecache:(BOOL)precache {
if (self.mrecViewDidLoadAdCallback) {
self.mrecViewDidLoadAdCallback(precache);
}
}
- (void)bannerViewDidRefresh:(APDBannerView *)bannerView {
[self reattachTouchProcessingView:bannerView];
}
- (void)bannerViewDidInteract:(APDBannerView *)bannerView {
if (self.mrecViewDidClickCallback) {
self.mrecViewDidClickCallback();
}
}
- (void)bannerViewDidShow:(APDBannerView *)bannerView {
if(self.mrecViewDidShowCallback) {
self.mrecViewDidShowCallback();
}
}
- (void)bannerView:(APDBannerView *)bannerView didFailToLoadAdWithError:(NSError *)error {
if (self.mrecViewDidFailToLoadAdCallback) {
self.mrecViewDidFailToLoadAdCallback();
}
}
- (void)bannerView:(APDBannerView *)bannerView didFailToPresentWithError:(NSError *)error {
if (self.mrecViewDidFailToPresentCallback) {
self.mrecViewDidFailToPresentCallback();
}
}
- (void)bannerViewExpired:(APDBannerView *)bannerView {
if (self.mrecViewDidExpiredCallback) {
self.mrecViewDidExpiredCallback();
}
}
- (void)reattachTouchProcessingView:(UIView *)view {
if (self.touchIgnoresView) {
UnityDropViewTouchProcessing(self.touchIgnoresView);
}
if (view) {
self.touchIgnoresView = view;
UnitySetViewTouchProcessing(view, touchesTransformedToUnityViewCoords);
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 8de96732c543e414b99124a63bd83c8b
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,529 @@
#if defined(__has_include) && __has_include("UnityAppController.h")
#import "UnityAppController.h"
#else
#import "EmptyUnityAppController.h"
#endif
#import <Appodeal/Appodeal.h>
#import <StackConsentManager/StackConsentManager.h>
#import "AppodealUnityMrecView.h"
#import "AppodealUnityBannerView.h"
#import "AppodealBannerDelegate.h"
#import "AppodealMrecViewDelegate.h"
#import "AppodealBannerViewDelegate.h"
#import "AppodealInterstitialDelegate.h"
#import "AppodealRewardedVideoDelegate.h"
#import "AppodealAdRevenueDelegate.h"
#import "AppodealIAPValidationDelegate.h"
#import "AppodealInitializationDelegate.h"
static AppodealUnityMrecView *mrecUnity;
static AppodealUnityBannerView *bannerUnity;
UIViewController *RootViewController() {
return ((UnityAppController *)[UIApplication sharedApplication].delegate).rootViewController;
}
static NSDateFormatter *DateFormatter() {
static dispatch_once_t onceToken;
static NSDateFormatter *formatter;
dispatch_once(&onceToken, ^{
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"dd/MM/yyyy";
});
return formatter;
}
static NSString *NSStringFromUTF8String(const char *bytes) {
return bytes ? @(bytes) : nil;
}
static NSDictionary <NSString *, id> *NSDictionaryFromUTF8String(const char *cString) {
NSString *string = [NSString stringWithUTF8String:cString];
if ([string length] == 0) return nil;
NSArray *pairs = [string componentsSeparatedByString:@","];
NSMutableDictionary <NSString *, id> *outputDict = [NSMutableDictionary dictionaryWithCapacity:pairs.count];
[pairs enumerateObjectsUsingBlock:^(NSString *pair, NSUInteger idx, BOOL *stop) {
NSArray <NSString *> *splited = [pair componentsSeparatedByString:@"="];
NSString *key = splited.firstObject;
NSString *value = splited.lastObject;
NSArray *valueSplitted = [value componentsSeparatedByString:@":"];
if (key) {
if ([valueSplitted.firstObject isEqualToString:@"System.Int32"]) {
outputDict[key] = @([valueSplitted.lastObject intValue]);
}
else if ([valueSplitted.firstObject isEqualToString:@"System.Double"]) {
outputDict[key] = @([valueSplitted.lastObject doubleValue]);
}
else if ([valueSplitted.firstObject isEqualToString:@"System.Boolean"]) {
outputDict[key] = @([valueSplitted.lastObject boolValue]);
}
else if ([valueSplitted.firstObject isEqualToString:@"System.String"]){
outputDict[key] = valueSplitted.lastObject;
}
}
}];
return outputDict;
}
void AppodealInitialize(const char *apiKey, int types, const char *pluginVer, const char *engineVer) {
[Appodeal setFramework:APDFrameworkUnity version: [NSString stringWithUTF8String:engineVer]];
[Appodeal setPluginVersion:[NSString stringWithUTF8String:pluginVer]];
[Appodeal initializeWithApiKey:[NSString stringWithUTF8String:apiKey] types:types];
}
BOOL AppodealIsInitialized(int types) {
return [Appodeal isInitializedForAdType:types];
}
BOOL AppodealShowAd(int style) {
return [Appodeal showAd:style rootViewController: RootViewController()];
}
BOOL AppodealShowAdforPlacement(int style, const char *placement) {
return [Appodeal showAd:style forPlacement:[NSString stringWithUTF8String:placement] rootViewController:RootViewController()];
}
BOOL AppodealShowBannerAdViewforPlacement(int YAxis, int XAxis, const char *placement) {
if (!bannerUnity) {
bannerUnity = [AppodealUnityBannerView sharedInstance];
}
[bannerUnity showBannerView:RootViewController() XAxis:XAxis YAxis:YAxis placement:[NSString stringWithUTF8String:placement]];
return false;
}
BOOL AppodealShowMrecAdViewforPlacement(int YAxis, int XAxis, const char *placement) {
if (!mrecUnity) {
mrecUnity = [AppodealUnityMrecView sharedInstance];
}
[mrecUnity showMrecView:RootViewController() XAxis:XAxis YAxis:YAxis placement:[NSString stringWithUTF8String:placement]];
return false;
}
BOOL AppodealIsReadyWithStyle(int style) {
return [Appodeal isReadyForShowWithStyle:style];
}
void AppodealCacheAd(int types) {
[Appodeal cacheAd:types];
}
void AppodealSetAutocache(BOOL autoCache, int types) {
[Appodeal setAutocache:autoCache types:types];
}
void AppodealHideBanner() {
[Appodeal hideBanner];
}
void AppodealHideBannerView() {
if (bannerUnity) {
[bannerUnity.bannerView removeFromSuperview];
}
}
void AppodealHideMrecView() {
if (mrecUnity) {
[mrecUnity.mrecView removeFromSuperview];
}
}
void AppodealSetSmartBanners(bool value) {
[Appodeal setSmartBannersEnabled:value];
}
BOOL AppodealIsSmartBannersEnabled() {
return [Appodeal isSmartBannersEnabled];
}
void AppodealSetTabletBanners(bool value) {
if (!bannerUnity) {
bannerUnity = [AppodealUnityBannerView sharedInstance];
}
if (value) {
[Appodeal setPreferredBannerAdSize:kAppodealUnitSize_728x90];
} else {
[Appodeal setPreferredBannerAdSize:kAppodealUnitSize_320x50];
}
[bannerUnity setTabletBanner:value];
}
void AppodealSetBannerAnimation(BOOL value) {
[Appodeal setBannerAnimationEnabled:value];
}
void AppodealSetBannerRotation(int leftBannerRotation, int rightBannerRotation) {
[Appodeal setBannerLeftRotationAngleDegrees:leftBannerRotation rightRotationAngleDegrees: rightBannerRotation];
}
void AppodealSetLogLevel(int level) {
switch (level) {
case 1:
[Appodeal setLogLevel:APDLogLevelOff];
break;
case 2:
[Appodeal setLogLevel:APDLogLevelDebug];
break;
case 3:
[Appodeal setLogLevel:APDLogLevelVerbose];
break;
default:
break;
}
}
void AppodealSetTestingEnabled(BOOL testingEnabled) {
[Appodeal setTestingEnabled:testingEnabled];
}
void AppodealSetChildDirectedTreatment(BOOL value) {
[Appodeal setChildDirectedTreatment:value];
}
void AppodealUpdateConsentReport() {
[Appodeal updateConsentReport:STKConsentManager.sharedManager.consent];
}
void AppodealUpdateGdprConsent(int consent) {
switch (consent) {
case 0:
[Appodeal updateUserConsentGDPR:APDGDPRUserConsentUnknown];
break;
case 1:
[Appodeal updateUserConsentGDPR:APDGDPRUserConsentPersonalized];
break;
case 2:
[Appodeal updateUserConsentGDPR:APDGDPRUserConsentNonPersonalized];
break;
default:
break;
}
}
void AppodealUpdateCcpaConsent(int consent) {
switch (consent) {
case 0:
[Appodeal updateUserConsentCCPA:APDCCPAUserConsentUnknown];
break;
case 1:
[Appodeal updateUserConsentCCPA:APDCCPAUserConsentOptIn];
break;
case 2:
[Appodeal updateUserConsentCCPA:APDCCPAUserConsentOptOut];
break;
default:
break;
}
}
char *AppodealGetNetworks(int types) {
NSArray<NSString *> *networksArray = [Appodeal registeredNetworkNamesForAdType:types];
NSString *networks = [[networksArray valueForKey:@"description"] componentsJoinedByString:@","];
const char *output = [networks UTF8String];
char *outputCopy = calloc([networks length]+1, 1);
return strncpy(outputCopy, output, [networks length]);
}
void AppodealDisableNetwork(const char *networkName) {
[Appodeal disableNetwork:[NSString stringWithUTF8String:networkName]];
}
void AppodealDisableNetworkForAdTypes(const char *networkName, int type) {
[Appodeal disableNetworkForAdType:type name:[NSString stringWithUTF8String:networkName]];
}
void AppodealSetLocationTracking(BOOL value) {
[Appodeal setLocationTracking:value];
}
void AppodealDisableLocationPermissionCheck() {
[Appodeal setLocationTracking:NO];
}
void AppodealSetTriggerPrecacheCallbacks(int types, bool value) {
[Appodeal setTriggerPrecacheCallbacks:value types:types];
}
char *AppodealGetVersion() {
const char *cString = [[Appodeal getVersion] UTF8String];
char *cStringCopy = calloc([[Appodeal getVersion] length]+1, 1);
return strncpy(cStringCopy, cString, [[Appodeal getVersion] length]);
}
long AppodealGetSegmentId() {
NSNumber *id = [Appodeal segmentId];
return [id longValue];
}
char *AppodealGetRewardCurrency(const char *placement) {
NSString *rewardCurrencyName = [[Appodeal rewardForPlacement:[NSString stringWithUTF8String:placement]] currencyName];
const char *cString = [rewardCurrencyName UTF8String];
char *cStringCopy = calloc([rewardCurrencyName length]+1, 1);
return strncpy(cStringCopy, cString, [rewardCurrencyName length]);
}
double AppodealGetRewardAmount(const char *placement) {
float rewardAmount = [[Appodeal rewardForPlacement:[NSString stringWithUTF8String:placement]] amount];
return (double)rewardAmount;
}
double AppodealGetPredictedEcpm(int types) {
return [Appodeal predictedEcpmForAdType:types];
}
double AppodealGetPredictedEcpmForPlacement(int adType, const char* placement) {
return [Appodeal predictedEcpmForAdType:adType placement:[NSString stringWithUTF8String:placement]];
}
BOOL AppodealCanShow(int style) {
return [Appodeal canShow:style forPlacement:@"default"];
}
BOOL AppodealCanShowWithPlacement(int style, const char *placement) {
return [Appodeal canShow:style forPlacement:[NSString stringWithUTF8String:placement]];
}
BOOL AppodealIsPrecacheAd(int adType) {
return [Appodeal isPrecacheAd:adType];
}
BOOL AppodealIsAutoCacheEnabled(int adType) {
return [Appodeal isAutocacheEnabled:adType];
}
void AppodealSetCustomFilterBool(const char *name, BOOL value) {
[Appodeal setCustomStateValue:[NSNumber numberWithBool:value] forKey:[NSString stringWithUTF8String:name]];
}
void AppodealSetCustomFilterInt(const char *name, int value) {
[Appodeal setCustomStateValue:[NSNumber numberWithInt:value] forKey:[NSString stringWithUTF8String:name]];
}
void AppodealSetCustomFilterDouble(const char *name, double value) {
[Appodeal setCustomStateValue:[NSNumber numberWithDouble:value] forKey:[NSString stringWithUTF8String:name]];
}
void AppodealSetCustomFilterString(const char *name, const char *value) {
[Appodeal setCustomStateValue:[NSString stringWithUTF8String:value] forKey:[NSString stringWithUTF8String:name]];
}
void AppodealResetCustomFilter(const char *name) {
[Appodeal setCustomStateValue:nil forKey:[NSString stringWithUTF8String:name]];
}
void AppodealSetExtraDataBool(const char *name, BOOL value) {
[Appodeal setExtrasValue:[NSNumber numberWithBool:value] forKey:[NSString stringWithUTF8String:name]];
}
void AppodealSetExtraDataInt(const char *name, int value) {
[Appodeal setExtrasValue:[NSNumber numberWithInt:value] forKey:[NSString stringWithUTF8String:name]];
}
void AppodealSetExtraDataDouble(const char *name, double value) {
[Appodeal setExtrasValue:[NSNumber numberWithDouble:value] forKey:[NSString stringWithUTF8String:name]];
}
void AppodealSetExtraDataString(const char *name, const char *value) {
[Appodeal setExtrasValue:[NSString stringWithUTF8String:value] forKey:[NSString stringWithUTF8String:name]];
}
void AppodealResetExtraData(const char *name) {
[Appodeal setExtrasValue:nil forKey:[NSString stringWithUTF8String:name]];
}
void AppodealTrackInAppPurchase(int amount, const char *currency) {
[[APDSdk sharedSdk] trackInAppPurchase:[NSNumber numberWithInt:amount] currency:[NSString stringWithUTF8String:currency]];
}
void AppodealSetUserId(const char *userid) {
[Appodeal setUserId:[NSString stringWithUTF8String:userid]];
}
char *AppodealGetUserId() {
const char *cString = [[Appodeal userId] UTF8String];
char *cStringCopy = calloc([[Appodeal userId] length]+1, 1);
return strncpy(cStringCopy, cString, [[Appodeal userId] length]);
}
void AppodealLogEvent(const char *eventName, const char *eventParams) {
[Appodeal trackEvent:NSStringFromUTF8String(eventName) customParameters:NSDictionaryFromUTF8String(eventParams)];
}
void AppodealValidateInAppPurchase(const char *productIdentifier,
const char *price,
const char *currency,
const char *transactionId,
const char *additionalParams,
int type,
InAppPurchaseValidationSucceededCallback success,
InAppPurchaseValidationFailedCallback failure) {
NSString *productIdString = NSStringFromUTF8String(productIdentifier);
NSString *priceString = NSStringFromUTF8String(price);
NSString *currencyString = NSStringFromUTF8String(currency);
NSString *transactionIdString = NSStringFromUTF8String(transactionId);
NSDictionary *additionalParamsDict = NSDictionaryFromUTF8String(additionalParams);
[Appodeal validateAndTrackInAppPurchase:productIdString
type:(APDPurchaseType)type
price:priceString
currency:[currencyString substringWithRange:NSMakeRange(0, MIN(5,currencyString.length))]
transactionId:transactionIdString
additionalParameters:additionalParamsDict
success:^(NSDictionary *data) {
NSData *jsonData;
NSError *jsonError;
jsonData = [NSJSONSerialization dataWithJSONObject:data
options:0
error:&jsonError];
if (jsonError) {
failure ? failure("Invalid response") : nil;
} else {
NSString *JSONString = [[NSString alloc] initWithBytes:jsonData.bytes
length:jsonData.length
encoding:NSUTF8StringEncoding];
success ? success(JSONString.UTF8String) : nil;
}
}
failure:^(NSError *error) {
NSString *errorString = (!error) ? @"unknown" : [NSString stringWithFormat:@"error: %@", error.localizedDescription];
failure ? failure(errorString.UTF8String) : nil;
}];
}
static AppodealInitializationDelegate *AppodealInitializationDelegateInstance;
void AppodealSetInitializationDelegate(AppodealInitializationCallback initializationCompleted) {
AppodealInitializationDelegateInstance = [AppodealInitializationDelegate new];
AppodealInitializationDelegateInstance.initializationCompletedCallback = initializationCompleted;
[Appodeal setInitializationDelegate:AppodealInitializationDelegateInstance];
}
static AppodealInterstitialDelegate *AppodealInterstitialDelegateInstance;
void AppodealSetInterstitialDelegate(AppodealInterstitialDidLoadCallback interstitialDidLoadAd,
AppodealInterstitialCallbacks interstitialDidFailToLoadAd,
AppodealInterstitialCallbacks interstitialDidFailToPresent,
AppodealInterstitialCallbacks interstitialWillPresent,
AppodealInterstitialCallbacks interstitialDidDismiss,
AppodealInterstitialCallbacks interstitialDidClick,
AppodealInterstitialCallbacks interstitialDidExpired) {
AppodealInterstitialDelegateInstance = [AppodealInterstitialDelegate new];
AppodealInterstitialDelegateInstance.interstitialDidLoadCallback = interstitialDidLoadAd;
AppodealInterstitialDelegateInstance.interstitialDidFailToLoadAdCallback = interstitialDidFailToLoadAd;
AppodealInterstitialDelegateInstance.interstitialDidFailToPresentCallback = interstitialDidFailToPresent;
AppodealInterstitialDelegateInstance.interstitialWillPresentCallback = interstitialWillPresent;
AppodealInterstitialDelegateInstance.interstitialDidDismissCallback = interstitialDidDismiss;
AppodealInterstitialDelegateInstance.interstitialDidClickCallback = interstitialDidClick;
AppodealInterstitialDelegateInstance.interstitialsDidExpiredCallback = interstitialDidExpired;
[Appodeal setInterstitialDelegate:AppodealInterstitialDelegateInstance];
}
static AppodealBannerDelegate *AppodealBannerDelegateInstance;
void AppodealSetBannerDelegate(AppodealBannerDidLoadCallback bannerDidLoadAd,
AppodealBannerCallbacks bannerDidFailToLoadAd,
AppodealBannerCallbacks bannerDidClick,
AppodealBannerCallbacks bannerDidExpired,
AppodealBannerCallbacks bannerDidShow,
AppodealBannerCallbacks bannerDidFailToPresent) {
AppodealBannerDelegateInstance = [AppodealBannerDelegate new];
AppodealBannerDelegateInstance.bannerDidLoadAdCallback = bannerDidLoadAd;
AppodealBannerDelegateInstance.bannerDidFailToLoadAdCallback = bannerDidFailToLoadAd;
AppodealBannerDelegateInstance.bannerDidClickCallback = bannerDidClick;
AppodealBannerDelegateInstance.bannerDidExpiredCallback = bannerDidExpired;
AppodealBannerDelegateInstance.bannerDidShowCallback = bannerDidShow;
AppodealBannerDelegateInstance.bannerDidFailToPresentCallback = bannerDidFailToPresent;
[Appodeal setBannerDelegate:AppodealBannerDelegateInstance];
}
static AppodealBannerViewDelegate *AppodealBannerViewDelegateInstance;
void AppodealSetBannerViewDelegate(AppodealBannerViewDidLoadCallback bannerViewDidLoadAd,
AppodealBannerViewCallbacks bannerViewDidFailToLoadAd,
AppodealBannerViewCallbacks bannerViewDidClick,
AppodealBannerViewCallbacks bannerViewDidShow,
AppodealBannerViewCallbacks bannerViewDidFailToPresent,
AppodealBannerViewCallbacks bannerViewDidExpired) {
AppodealBannerViewDelegateInstance = [AppodealBannerViewDelegate new];
AppodealBannerViewDelegateInstance.bannerViewDidLoadAdCallback = bannerViewDidLoadAd;
AppodealBannerViewDelegateInstance.bannerViewDidFailToLoadAdCallback = bannerViewDidFailToLoadAd;
AppodealBannerViewDelegateInstance.bannerViewDidClickCallback = bannerViewDidClick;
AppodealBannerViewDelegateInstance.bannerViewDidShowCallback = bannerViewDidShow;
AppodealBannerViewDelegateInstance.bannerViewDidFailToPresentCallback = bannerViewDidFailToPresent;
AppodealBannerViewDelegateInstance.bannerViewDidExpiredCallback = bannerViewDidExpired;
if(!bannerUnity) {
bannerUnity = [AppodealUnityBannerView sharedInstance];
}
[bannerUnity.bannerView setDelegate:AppodealBannerViewDelegateInstance];
}
static AppodealMrecViewDelegate *AppodealMrecViewDelegateInstance;
void AppodealSetMrecViewDelegate(AppodealMrecViewDidLoadCallback mrecViewDidLoadAd,
AppodealMrecViewCallbacks mrecViewDidFailToLoadAd,
AppodealMrecViewCallbacks mrecViewDidClick,
AppodealMrecViewCallbacks mrecViewDidShow,
AppodealMrecViewCallbacks mrecViewDidFailToPresent,
AppodealMrecViewCallbacks mrecViewDidExpired) {
AppodealMrecViewDelegateInstance = [AppodealMrecViewDelegate new];
AppodealMrecViewDelegateInstance.mrecViewDidLoadAdCallback = mrecViewDidLoadAd;
AppodealMrecViewDelegateInstance.mrecViewDidFailToLoadAdCallback = mrecViewDidFailToLoadAd;
AppodealMrecViewDelegateInstance.mrecViewDidClickCallback = mrecViewDidClick;
AppodealMrecViewDelegateInstance.mrecViewDidShowCallback = mrecViewDidShow;
AppodealMrecViewDelegateInstance.mrecViewDidFailToPresentCallback = mrecViewDidFailToPresent;
AppodealMrecViewDelegateInstance.mrecViewDidExpiredCallback = mrecViewDidExpired;
if (!mrecUnity) {
mrecUnity = [AppodealUnityMrecView sharedInstance];
}
[mrecUnity.mrecView setDelegate:AppodealMrecViewDelegateInstance];
}
static AppodealRewardedVideoDelegate *AppodealRewardedVideoDelegateInstance;
void AppodealSetRewardedVideoDelegate(AppodealRewardedVideoDidLoadCallback rewardedVideoDidLoadAd,
AppodealRewardedVideoCallbacks rewardedVideoDidFailToLoadAd,
AppodealRewardedVideoCallbacks rewardedVideoDidFailToPresent,
AppodealRewardedVideoDidDismissCallback rewardedVideoWillDismiss,
AppodealRewardedVideoDidFinishCallback rewardedVideoDidFinish,
AppodealRewardedVideoCallbacks rewardedVideoDidPresent,
AppodealRewardedVideoCallbacks rewardedVideoDidExpired,
AppodealRewardedVideoCallbacks rewardedVideoDidReceiveTap) {
AppodealRewardedVideoDelegateInstance = [AppodealRewardedVideoDelegate new];
AppodealRewardedVideoDelegateInstance.rewardedVideoDidLoadAdCallback = rewardedVideoDidLoadAd;
AppodealRewardedVideoDelegateInstance.rewardedVideoDidFailToLoadAdCallback = rewardedVideoDidFailToLoadAd;
AppodealRewardedVideoDelegateInstance.rewardedVideoDidFailToPresentCallback = rewardedVideoDidFailToPresent;
AppodealRewardedVideoDelegateInstance.rewardedVideoWillDismissCallback = rewardedVideoWillDismiss;
AppodealRewardedVideoDelegateInstance.rewardedVideoDidFinishCallback = rewardedVideoDidFinish;
AppodealRewardedVideoDelegateInstance.rewardedVideoDidPresentCallback = rewardedVideoDidPresent;
AppodealRewardedVideoDelegateInstance.rewardedVideoDidExpireCallback = rewardedVideoDidExpired;
AppodealRewardedVideoDelegateInstance.rewardedVideoDidReceiveTapActionCallback = rewardedVideoDidReceiveTap;
[Appodeal setRewardedVideoDelegate:AppodealRewardedVideoDelegateInstance];
}
static AppodealAdRevenueDelegate *AppodealAdRevenueDelegateInstance;
void AppodealSetAdRevenueDelegate(AppodealAdRevenueCallback adRevenueReceived) {
AppodealAdRevenueDelegateInstance = [AppodealAdRevenueDelegate new];
AppodealAdRevenueDelegateInstance.adRevenueReceivedCallback = adRevenueReceived;
[Appodeal setAdRevenueDelegate:AppodealAdRevenueDelegateInstance];
}

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: c20729274d64d4450b6e70d3908c6dda
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
#import <Foundation/Foundation.h>
#import <Appodeal/Appodeal.h>
typedef void (*AppodealRewardedVideoCallbacks) ();
typedef void (*AppodealRewardedVideoDidLoadCallback) (BOOL isPrecache);
typedef void (*AppodealRewardedVideoDidFinishCallback) (double, const char *);
typedef void (*AppodealRewardedVideoDidDismissCallback) (BOOL isFinished);
@interface AppodealRewardedVideoDelegate : NSObject <AppodealRewardedVideoDelegate>
@property (assign, nonatomic) AppodealRewardedVideoDidLoadCallback rewardedVideoDidLoadAdCallback;
@property (assign, nonatomic) AppodealRewardedVideoCallbacks rewardedVideoDidFailToLoadAdCallback;
@property (assign, nonatomic) AppodealRewardedVideoCallbacks rewardedVideoDidFailToPresentCallback;
@property (assign, nonatomic) AppodealRewardedVideoDidDismissCallback rewardedVideoWillDismissCallback;
@property (assign, nonatomic) AppodealRewardedVideoCallbacks rewardedVideoDidPresentCallback;
@property (assign, nonatomic) AppodealRewardedVideoDidFinishCallback rewardedVideoDidFinishCallback;
@property (assign, nonatomic) AppodealRewardedVideoCallbacks rewardedVideoDidExpireCallback;
@property (assign, nonatomic) AppodealRewardedVideoCallbacks rewardedVideoDidReceiveTapActionCallback;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: c97fff718b39743bfb57e1a2c88b066c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,53 @@
#import "AppodealRewardedVideoDelegate.h"
@implementation AppodealRewardedVideoDelegate
-(void) rewardedVideoDidLoadAdIsPrecache:(BOOL)precache {
if(self.rewardedVideoDidLoadAdCallback) {
self.rewardedVideoDidLoadAdCallback(precache);
}
}
-(void) rewardedVideoDidFailToLoadAd {
if(self.rewardedVideoDidFailToLoadAdCallback) {
self.rewardedVideoDidFailToLoadAdCallback();
}
}
-(void) rewardedVideoDidFailToPresentWithError:(NSError *)error {
if (self.rewardedVideoDidFailToPresentCallback) {
self.rewardedVideoDidFailToPresentCallback();
}
}
-(void) rewardedVideoWillDismissAndWasFullyWatched:(BOOL)wasFullyWatched {
if(self.rewardedVideoWillDismissCallback) {
self.rewardedVideoWillDismissCallback(wasFullyWatched);
}
}
-(void) rewardedVideoDidPresent {
if(self.rewardedVideoDidPresentCallback) {
self.rewardedVideoDidPresentCallback();
}
}
- (void)rewardedVideoDidFinish:(float)rewardAmount name:(NSString *)rewardName {
if (self.rewardedVideoDidFinishCallback) {
self.rewardedVideoDidFinishCallback((double)rewardAmount, [rewardName UTF8String]);
}
}
- (void)rewardedVideoDidExpired{
if(self.rewardedVideoDidExpireCallback){
self.rewardedVideoDidExpireCallback();
}
}
- (void)rewardedVideoDidClick{
if(self.rewardedVideoDidReceiveTapActionCallback){
self.rewardedVideoDidReceiveTapActionCallback();
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 9778d9e4794624447afeafd167196c5e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
#import <Appodeal/Appodeal.h>
@interface AppodealUnityBannerView : NSObject
+ (instancetype)sharedInstance;
UIViewController* RootViewControllerUnityBannerView(void);
- (id)init;
- (void)setSharedBannerFrame:(CGFloat)XAxis YAxis:(CGFloat)YAxis;
- (void)hideBannerView;
- (void)showBannerView:(UIViewController*)rootViewController XAxis:(CGFloat)XAxis YAxis:(CGFloat)YAxis placement:(NSString*)placement;
- (void)reinitAppodealBannerView;
- (void)setTabletBanner: (BOOL) value;
@property(nonatomic, strong) APDBannerView *bannerView;
@property(nonatomic, assign) BOOL onScreen;
@property(nonatomic, assign) BOOL tabletBanner;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: b13fd8e3cd5544255994f702ad91c263
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,153 @@
#if defined(__has_include) && __has_include("UnityAppController.h")
#import "UnityAppController.h"
#else
#import "EmptyUnityAppController.h"
#endif
#import <Foundation/Foundation.h>
#import "AppodealUnityBannerView.h"
#define BANNER_X_POSITION_SMART -1
#define BANNER_X_POSITION_CENTER -2
#define BANNER_X_POSITION_RIGHT -3
#define BANNER_X_POSITION_LEFT -4
#define BANNER_Y_POSITION_BOTTOM 8
#define BANNER_Y_POSITION_TOP 16
@implementation AppodealUnityBannerView
+ (instancetype)sharedInstance {
static AppodealUnityBannerView *sharedInstance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
UIViewController* RootViewControllerUnityBannerView() {
return ((UnityAppController *)[UIApplication sharedApplication].delegate).rootViewController;
}
- (id)init {
self = [super init];
_tabletBanner = YES;
[self reinitAppodealBannerView];
return self;
}
- (void)setTabletBanner:(BOOL)value {
_tabletBanner = value;
[self reinitAppodealBannerView];
}
- (void)reinitAppodealBannerView {
BOOL tabletOrPhoneSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && self.tabletBanner;
CGSize size = tabletOrPhoneSize ? kAPDAdSize728x90 : kAPDAdSize320x50;
self.bannerView = [[APDBannerView alloc] initWithSize:size];
self.onScreen = NO;
}
- (void)setSharedBannerFrame:(CGFloat)XAxis YAxis:(CGFloat)YAxis {
UIViewAutoresizing mask = UIViewAutoresizingNone;
UIView *superView = RootViewControllerUnityBannerView().view;
CGSize superviewSize = RootViewControllerUnityBannerView().view.bounds.size;
CGFloat screenScale = [[UIScreen mainScreen] scale];
CGFloat bannerHeight = self.bannerView.frame.size.height;
CGFloat bannerWidth = self.bannerView.frame.size.width;
CGFloat xOffset = .0f;
CGFloat yOffset = .0f;
// Calculate X offset
if (XAxis == BANNER_X_POSITION_SMART) { //Smart banners
mask |= UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin;
self.bannerView.usesSmartSizing = YES;
bannerWidth = superviewSize.width;
} else if (XAxis == BANNER_X_POSITION_LEFT) { //Left
mask |= UIViewAutoresizingFlexibleRightMargin;
} else if (XAxis == BANNER_X_POSITION_RIGHT) { //Right
mask |= UIViewAutoresizingFlexibleLeftMargin;
xOffset = superviewSize.width - bannerWidth;
} else if (XAxis == BANNER_X_POSITION_CENTER) { //Center
xOffset = (superviewSize.width - bannerWidth) / 2;
mask |= UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
} else if (XAxis / screenScale > superviewSize.width - bannerWidth) { // User defined offset more than screen width
NSLog(@"[Appodeal Banner view][error] Banner view x offset cannot be more than Screen width - actual banner width");
xOffset = superviewSize.width - bannerWidth;
mask |= UIViewAutoresizingFlexibleLeftMargin;
} else if (XAxis < -4) {
NSLog(@"[Appodeal Banner view][error] Banner view x offset cannot be less than 0");
xOffset = 0;
} else {
mask |= UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
xOffset = XAxis / screenScale;
}
// Calculate Y offset
if (YAxis == BANNER_Y_POSITION_TOP) {
mask |= UIViewAutoresizingFlexibleBottomMargin;
if (@available(iOS 11.0, *)) {
yOffset = superView.safeAreaInsets.top;
}
} else if (YAxis == BANNER_Y_POSITION_BOTTOM) {
mask |= UIViewAutoresizingFlexibleTopMargin;
if (@available(iOS 11.0, *)) {
yOffset = superviewSize.height - bannerHeight - superView.safeAreaInsets.bottom;
}
else {
yOffset = superviewSize.height - bannerHeight;
}
} else if (YAxis / screenScale > superviewSize.height - bannerHeight) { // User defined offset more than banner width
NSLog(@"[Appodeal Banner view][error] Banner view y offset cannot be more than Screen height - actual banner height");
yOffset = superviewSize.height - bannerHeight;
mask |= UIViewAutoresizingFlexibleTopMargin;
} else if (YAxis < -2) {
NSLog(@"[Appodeal Banner view][error] Banner view y offset cannot be less than 0");
yOffset = 0;
} else if (YAxis == .0f) { // All good
mask |= UIViewAutoresizingFlexibleBottomMargin;
} else {
yOffset = YAxis / screenScale;
mask |= UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
}
NSLog(@"Creating banner frame with parameters: xOffset = %f, yOffset = %f", xOffset, yOffset);
CGRect bannerRect = CGRectMake(xOffset, yOffset, bannerWidth, bannerHeight);
[self.bannerView setAutoresizingMask:mask];
[self.bannerView setFrame:bannerRect];
[self.bannerView layoutSubviews];
}
- (void)showBannerView:(UIViewController*)rootViewController
XAxis:(CGFloat)XAxis
YAxis:(CGFloat)YAxis
placement:(NSString*)placement {
[self.bannerView removeFromSuperview];
self.bannerView.rootViewController = rootViewController;
self.bannerView.placement = placement;
[rootViewController.view addSubview:self.bannerView];
[rootViewController.view bringSubviewToFront:self.bannerView];
[self setSharedBannerFrame:XAxis YAxis:YAxis];
self.onScreen = YES;
[self.bannerView loadAd];
}
- (void)hideBannerView {
if(self.bannerView) {
[self.bannerView removeFromSuperview];
self.onScreen = NO;
}
}
- (void)setupTouchProcessing {
if (self.bannerView) {
UnityDropViewTouchProcessing(self.bannerView);
UnitySetViewTouchProcessing(self.bannerView, touchesTransformedToUnityViewCoords);
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: f7999b0094f224ddba97e06948f21334
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#import <Appodeal/Appodeal.h>
@interface AppodealUnityMrecView : NSObject
+ (instancetype)sharedInstance;
UIViewController* RootViewControllerUnityMrec(void);
- (id)init;
- (void)setSharedMrecFrame:(CGFloat)XAxis YAxis:(CGFloat)YAxis;
- (void)hideMrecView;
- (void)showMrecView:(UIViewController*)rootViewController XAxis:(CGFloat)XAxis YAxis:(CGFloat)YAxis placement:(NSString*)placement;
@property(nonatomic, strong) APDMRECView *mrecView;
@property (nonatomic, assign) BOOL onScreen;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: ffeec9b2c161f4507b0424e03715923c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,140 @@
#if defined(__has_include) && __has_include("UnityAppController.h")
#import "UnityAppController.h"
#else
#import "EmptyUnityAppController.h"
#endif
#import <Foundation/Foundation.h>
#import "AppodealUnityMrecView.h"
#define BANNER_X_POSITION_SMART -1
#define BANNER_X_POSITION_CENTER -2
#define BANNER_X_POSITION_RIGHT -3
#define BANNER_X_POSITION_LEFT -4
#define BANNER_Y_POSITION_BOTTOM 8
#define BANNER_Y_POSITION_TOP 16
@implementation AppodealUnityMrecView
+ (instancetype)sharedInstance {
static AppodealUnityMrecView *sharedInstance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
UIViewController* RootViewControllerUnityMrec() {
return ((UnityAppController *)[UIApplication sharedApplication].delegate).rootViewController;
}
- (id)init {
self = [super init];
if(self) {
self.mrecView = [[APDMRECView alloc] init];
self.mrecView.frame = CGRectMake(0, 0, 300, 250);
self.mrecView.usesSmartSizing = NO;
self.onScreen = NO;
}
return self;
}
- (void)setSharedMrecFrame:(CGFloat)XAxis YAxis:(CGFloat)YAxis {
UIViewAutoresizing mask = UIViewAutoresizingNone;
UIView *superView = RootViewControllerUnityMrec().view;
CGSize superviewSize = RootViewControllerUnityMrec().view.bounds.size;
CGFloat screenScale = [[UIScreen mainScreen] scale];
CGFloat mrecHeight = self.mrecView.frame.size.height;
CGFloat mrecWidth = self.mrecView.frame.size.width;
CGFloat xOffset = .0f;
CGFloat yOffset = .0f;
// Calculate X offset
if (XAxis == BANNER_X_POSITION_LEFT) { // Left
mask |= UIViewAutoresizingFlexibleRightMargin;
} else if (XAxis == BANNER_X_POSITION_RIGHT) { // Right
mask |= UIViewAutoresizingFlexibleLeftMargin;
xOffset = superviewSize.width - mrecWidth;
} else if (XAxis == BANNER_X_POSITION_CENTER) { // Center
xOffset = (superviewSize.width - mrecWidth) / 2;
mask |= UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
} else if (XAxis / screenScale > superviewSize.width - mrecWidth) { // User defined offset more than screen width
NSLog(@"[Appodeal Banner view][error] Banner view x offset cannot be more than Screen width - actual banner width");
xOffset = superviewSize.width - mrecWidth;
mask |= UIViewAutoresizingFlexibleLeftMargin;
} else if (XAxis < -4) {
NSLog(@"[Appodeal Banner view][error] Banner view x offset cannot be less than 0");
xOffset = 0;
} else {
mask |= UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
xOffset = XAxis / screenScale;
}
//Calculate Y offset
if (YAxis == BANNER_Y_POSITION_TOP) {
mask |= UIViewAutoresizingFlexibleBottomMargin;
if (@available(iOS 11.0, *)) {
yOffset = superView.safeAreaInsets.top;
}
} else if (YAxis == BANNER_Y_POSITION_BOTTOM) {
mask |= UIViewAutoresizingFlexibleTopMargin;
if (@available(iOS 11.0, *)) {
yOffset = superviewSize.height - mrecHeight - superView.safeAreaInsets.bottom;
}
else {
yOffset = superviewSize.height - mrecHeight;
}
} else if (YAxis / screenScale > superviewSize.height - mrecHeight) { // User defined offset more than banner width
NSLog(@"[Appodeal Banner view][error] Banner view y offset cannot be more than Screen height - actual banner height");
yOffset = superviewSize.height - mrecHeight;
mask |= UIViewAutoresizingFlexibleTopMargin;
} else if (YAxis < -2) {
NSLog(@"[Appodeal Banner view][error] Banner view y offset cannot be less than 0");
yOffset = 0;
} else if (YAxis == .0f) { // All good
mask |= UIViewAutoresizingFlexibleBottomMargin;
} else {
yOffset = YAxis / screenScale;
mask |= UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
}
NSLog(@"Creating banner frame with parameters: xOffset = %f, yOffset = %f", xOffset, yOffset);
CGRect mrecRect = CGRectMake(xOffset, yOffset, mrecWidth, mrecHeight);
[self.mrecView setAutoresizingMask:mask];
[self.mrecView setFrame:mrecRect];
[self.mrecView layoutSubviews];
}
- (void)showMrecView:(UIViewController*)rootViewController
XAxis:(CGFloat)XAxis
YAxis:(CGFloat)YAxis
placement:(NSString*)placement {
[self.mrecView removeFromSuperview];
self.mrecView.rootViewController = rootViewController;
self.mrecView.placement = placement;
[rootViewController.view addSubview:self.mrecView];
[rootViewController.view bringSubviewToFront:self.mrecView];
[self setSharedMrecFrame:XAxis YAxis:YAxis];
[self setupTouchProcessing];
self.onScreen = YES;
[self.mrecView loadAd];
}
- (void)hideMrecView {
if (self.mrecView) {
[self.mrecView removeFromSuperview];
self.onScreen = NO;
}
}
- (void)setupTouchProcessing {
if (self.mrecView) {
UnityDropViewTouchProcessing(self.mrecView);
UnitySetViewTouchProcessing(self.mrecView, touchesTransformedToUnityViewCoords);
}
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: ebbc189d54102415daf3a35376044a81
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant: