Firstborn/Library/PackageCache/com.unity.ads@4.4.2/Plugins/iOS/UnityAnalyticsWrapper.m

32 lines
888 B
Mathematica
Raw Normal View History

2023-03-28 13:24:16 -04:00
#import <UnityAds/UANAApiAnalytics.h>
#import "UnityAdsUtilities.h"
typedef void (*UANAEngineTriggerAddExtras)(const char *payload);
static UANAEngineTriggerAddExtras triggerAddExtras = NULL;
void UANAEngineDelegateSetTriggerAddExtras(UANAEngineTriggerAddExtras trigger) {
triggerAddExtras = trigger;
}
@interface UANAEngineWrapper : NSObject <UANAEngineDelegate>
@end
@implementation UANAEngineWrapper
- (void)addExtras:(NSString *)extras {
if (triggerAddExtras) {
const char * rawExtrasString = UnityAdsCopyString([extras UTF8String]);
triggerAddExtras(rawExtrasString);
free((void *)rawExtrasString);
}
}
@end
void InitializeUANAEngineWrapper() {
static id<UANAEngineDelegate> delegate = nil;
if (delegate == nil) {
delegate = [[UANAEngineWrapper alloc] init];
[UANAApiAnalytics setAnalyticsDelegate:delegate];
}
}