升级topon sdk版本2.1.5, 升级平台插件版本至最新

This commit is contained in:
2025-03-13 17:49:41 +08:00
parent edaa47d69a
commit c67ac9b851
75 changed files with 814 additions and 181 deletions

2
.gitignore vendored
View File

@@ -55,3 +55,5 @@ sysinfo.txt
# Crashlytics generated file # Crashlytics generated file
crashlytics-build.properties crashlytics-build.properties
.DS_Store .DS_Store
.vscode/

View File

@@ -40,6 +40,16 @@ namespace AnyThinkAds.Api
public readonly int abtest_id; public readonly int abtest_id;
public readonly string reward_custom_data; public readonly string reward_custom_data;
public readonly int placement_type;
public readonly string shared_placement_id;
public readonly string bid_floor;
public readonly int dismiss_type;
public readonly int ad_source_type;
public readonly string ad_source_custom_ext;
public readonly string network_name;
public readonly string show_custom_ext;
public readonly string e_c;
public readonly int s_id;
private string callbackJson; private string callbackJson;
@@ -94,6 +104,16 @@ namespace AnyThinkAds.Api
reward_custom_data = jsonData.ContainsKey("reward_custom_data") ? (string)jsonData["reward_custom_data"] : ""; reward_custom_data = jsonData.ContainsKey("reward_custom_data") ? (string)jsonData["reward_custom_data"] : "";
placement_type = int.Parse(jsonData.ContainsKey("placement_type") ? jsonData["placement_type"].ToString() : "0");
shared_placement_id = jsonData.ContainsKey("shared_placement_id") ? jsonData["shared_placement_id"].ToString() : "";
bid_floor = jsonData.ContainsKey("bid_floor") ? jsonData["bid_floor"].ToString() : "";
dismiss_type = int.Parse(jsonData.ContainsKey("dismiss_type") ? jsonData["dismiss_type"].ToString() : "0");
ad_source_type = int.Parse(jsonData.ContainsKey("ad_source_type") ? jsonData["ad_source_type"].ToString() : "0");
ad_source_custom_ext = jsonData.ContainsKey("ad_source_custom_ext") ? jsonData["ad_source_custom_ext"].ToString() : "";
network_name = jsonData.ContainsKey("network_name") ? jsonData["network_name"].ToString() : "";
show_custom_ext = jsonData.ContainsKey("show_custom_ext") ? jsonData["show_custom_ext"].ToString() : "";
e_c = jsonData.ContainsKey("e_c") ? jsonData["e_c"].ToString() : "";
s_id = int.Parse(jsonData.ContainsKey("s_id") ? jsonData["s_id"].ToString() : "0");
} }
catch (System.Exception e) { catch (System.Exception e) {
System.Console.WriteLine("Exception caught: {0}", e); System.Console.WriteLine("Exception caught: {0}", e);
@@ -150,6 +170,16 @@ namespace AnyThinkAds.Api
dataDictionary.Add("custom_rule", custom_rule); dataDictionary.Add("custom_rule", custom_rule);
dataDictionary.Add("ext_info", ext_info); dataDictionary.Add("ext_info", ext_info);
dataDictionary.Add("reward_custom_data", reward_custom_data); dataDictionary.Add("reward_custom_data", reward_custom_data);
dataDictionary.Add("placement_type", placement_type);
dataDictionary.Add("shared_placement_id", shared_placement_id);
dataDictionary.Add("bid_floor", bid_floor);
dataDictionary.Add("dismiss_type", dismiss_type);
dataDictionary.Add("ad_source_type", ad_source_type);
dataDictionary.Add("ad_source_custom_ext", ad_source_custom_ext);
dataDictionary.Add("network_name", network_name);
dataDictionary.Add("show_custom_ext", show_custom_ext);
dataDictionary.Add("e_c", e_c);
dataDictionary.Add("s_id", s_id);
return dataDictionary; return dataDictionary;
} }

View File

@@ -198,12 +198,13 @@ namespace AnyThinkAds.iOS {
public void showDebuggerUI() public void showDebuggerUI()
{ {
Debug.Log("Unity:ATSDKAPIClient::showDebuggerUI()"); Debug.Log("Unity:ATSDKAPIClient::showDebuggerUI()");
ATManager.showDebuggerUI(); ATManager.showDebuggerUI("");
} }
public void showDebuggerUI(string debugKey) public void showDebuggerUI(string debugKey)
{ {
//TODO 待iOS支持线上测试的SDK版本上线 Debug.Log("Unity:ATSDKAPIClient::showDebuggerUI(debugKey)");
ATManager.showDebuggerUI(debugKey);
} }
} }
} }

View File

@@ -8,9 +8,9 @@
#import "ATBaseUnityWrapper.h" #import "ATBaseUnityWrapper.h"
#import "ATUnityUtilities.h" #import "ATUnityUtilities.h"
#import "ATUnitySafeThreadDictionary.h"
@interface ATBaseUnityWrapper() @interface ATBaseUnityWrapper()
@property(nonatomic, readonly) NSMutableDictionary<NSString*, NSValue*> *callbacks; @property(nonatomic, strong) ATUnitySafeThreadDictionary<NSString*, NSValue*> *callbacks;
@property(nonatomic, readonly) dispatch_queue_t callbackAccessQueue;
@end @end
@implementation ATBaseUnityWrapper @implementation ATBaseUnityWrapper
+(instancetype) sharedInstance { +(instancetype) sharedInstance {
@@ -20,35 +20,29 @@
-(instancetype) init { -(instancetype) init {
self = [super init]; self = [super init];
if (self != nil) { if (self != nil) {
_callbacks = [NSMutableDictionary<NSString*, NSValue*> dictionary]; _callbacks = [ATUnitySafeThreadDictionary<NSString*, NSValue*> dictionary];
_callbackAccessQueue = dispatch_queue_create("com.anythink.UnityPackage", DISPATCH_QUEUE_CONCURRENT);
} }
return self; return self;
} }
-(void) setCallBack:(void (*)(const char *, const char *))callback forKey:(NSString *)key { -(void) setCallBack:(void (*)(const char *, const char *))callback forKey:(NSString *)key {
__weak ATBaseUnityWrapper* weakSelf = self; __weak ATBaseUnityWrapper* weakSelf = self;
if (callback != NULL && [key length] > 0) if (callback != NULL && [key length] > 0) {
dispatch_barrier_async(_callbackAccessQueue, ^{ [self.callbacks setValue:[NSValue valueWithPointer:(void*)callback] forKey:key];
weakSelf.callbacks[key] = [NSValue valueWithPointer:(void*)callback]; }
});
} }
-(void) removeCallbackForKey:(NSString *)key { -(void) removeCallbackForKey:(NSString *)key {
__weak ATBaseUnityWrapper* weakSelf = self; if ([key length] > 0) {
if ([key length] > 0) [self.callbacks removeObjectForKey:key];
dispatch_barrier_async(_callbackAccessQueue, ^{ }
[weakSelf.callbacks removeObjectForKey:key];
});
} }
-(void(*)(const char*, const char *)) callbackForKey:(NSString*)key { -(void(*)(const char*, const char *)) callbackForKey:(NSString*)key {
__block void(*callback)(const char*, const char *) = NULL; __block void(*callback)(const char*, const char *) = NULL;
if ([key length] > 0) { if ([key length] > 0) {
__weak ATBaseUnityWrapper* weakSelf = self; callback = (void(*)(const char*, const char *))[self.callbacks[key] pointerValue];
dispatch_barrier_sync(_callbackAccessQueue, ^{
callback = (void(*)(const char*, const char *))[weakSelf.callbacks[key] pointerValue];
});
} }
return callback; return callback;
} }
@@ -61,68 +55,79 @@
return nil; return nil;
} }
-(void) invokeCallback:(NSString*)callback placementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary*)extra { -(void) invokeCallback:(NSString*)callback placementID:(NSString*)placementID error:(NSError*)error extra:(NSDictionary*)extraParams {
if ([self callbackForKey:placementID] != NULL) {
if ([callback isKindOfClass:[NSString class]] && [callback length] > 0) {
NSMutableDictionary *paraDict = [NSMutableDictionary dictionaryWithObject:callback forKey:@"callback"]; __block NSDictionary* extra = extraParams;
NSMutableDictionary *msgDict = [NSMutableDictionary dictionary]; dispatch_async(dispatch_get_main_queue(), ^{
@try {
if (![ATUnityUtilities isEmpty:extra]) { if ([self callbackForKey:placementID] != NULL) {
if ([callback isKindOfClass:[NSString class]] && [callback length] > 0) {
// SDK user_load_extra_data NSMutableDictionary *paraDict = [NSMutableDictionary dictionaryWithObject:callback forKey:@"callback"];
if (extra[kATUnityUserExtraDataKey] != nil) {
NSMutableDictionary *extraDictM = [NSMutableDictionary dictionaryWithDictionary:extra]; NSMutableDictionary *msgDict = [NSMutableDictionary dictionary];
NSMutableDictionary *extraDataTemp = [NSMutableDictionary dictionary];
NSMutableDictionary *extraDataDictM = [NSMutableDictionary dictionaryWithDictionary:extra[kATUnityUserExtraDataKey]]; if (![ATUnityUtilities isEmpty:extra]) {
for (NSString *key in extraDataDictM.allKeys) {
if ([extraDataDictM[key] isKindOfClass:[NSString class]] || [extraDataDictM[key] isKindOfClass:[NSNumber class]]) { // SDK user_load_extra_data
[extraDataTemp setValue:extraDataDictM[key] forKey:key]; if (extra[kATUnityUserExtraDataKey] != nil) {
NSMutableDictionary *extraDictM = [NSMutableDictionary dictionaryWithDictionary:extra];
NSMutableDictionary *extraDataTemp = [NSMutableDictionary dictionary];
NSMutableDictionary *extraDataDictM = [NSMutableDictionary dictionaryWithDictionary:extra[kATUnityUserExtraDataKey]];
for (NSString *key in extraDataDictM.allKeys) {
if ([extraDataDictM[key] isKindOfClass:[NSString class]] || [extraDataDictM[key] isKindOfClass:[NSNumber class]]) {
[extraDataTemp setValue:extraDataDictM[key] forKey:key];
}
}
if ([extraDataTemp count]) {
[extraDictM setValue:extraDataTemp forKey:kATUnityUserExtraDataKey];
} else {
[extraDictM removeObjectForKey:kATUnityUserExtraDataKey];
}
extra = extraDictM;
}
if (extra[@"extra"] != nil) {
msgDict[@"extra"] = extra[@"extra"];
msgDict[@"rewarded"] = extra[@"rewarded"];
} else {
msgDict[@"extra"] = extra;
} }
} }
if ([extraDataTemp count]) {
[extraDictM setValue:extraDataTemp forKey:kATUnityUserExtraDataKey]; paraDict[@"msg"] = msgDict;
} else {
[extraDictM removeObjectForKey:kATUnityUserExtraDataKey]; if ([placementID isKindOfClass:[NSString class]] && ![ATUnityUtilities isEmpty:placementID]) {
msgDict[@"placement_id"] = placementID;
};
if ([error isKindOfClass:[NSError class]]) {
NSMutableDictionary *errorDict = [NSMutableDictionary dictionaryWithObject:[NSString stringWithFormat:@"%ld", error.code] forKey:@"code"];
if (![ATUnityUtilities isEmpty:error.userInfo[NSLocalizedDescriptionKey]]) {
errorDict[@"desc"] = [NSString stringWithFormat:@"%@",error.userInfo[NSLocalizedDescriptionKey]];
} else {
errorDict[@"desc"] = @"";
}
if (![ATUnityUtilities isEmpty:error.userInfo[NSLocalizedFailureReasonErrorKey]]) {
errorDict[@"reason"] = [NSString stringWithFormat:@"%@",error.userInfo[NSLocalizedFailureReasonErrorKey]];
} else {
errorDict[@"reason"] = @"";
}
msgDict[@"error"] = errorDict;
} }
extra = extraDictM;
}
if (extra[@"extra"] != nil) { [self callbackForKey:placementID]([self scriptWrapperClass].UTF8String, paraDict.jsonString.UTF8String);
msgDict[@"extra"] = extra[@"extra"];
msgDict[@"rewarded"] = extra[@"rewarded"];
} else {
msgDict[@"extra"] = extra;
} }
} }
} @catch (NSException *exception) {
paraDict[@"msg"] = msgDict; } @finally {}
if ([placementID isKindOfClass:[NSString class]] && ![ATUnityUtilities isEmpty:placementID]) { });
msgDict[@"placement_id"] = placementID;
};
if ([error isKindOfClass:[NSError class]]) {
NSMutableDictionary *errorDict = [NSMutableDictionary dictionaryWithObject:[NSString stringWithFormat:@"%ld", error.code] forKey:@"code"];
if (![ATUnityUtilities isEmpty:error.userInfo[NSLocalizedDescriptionKey]]) {
errorDict[@"desc"] = [NSString stringWithFormat:@"%@",error.userInfo[NSLocalizedDescriptionKey]];
} else {
errorDict[@"desc"] = @"";
}
if (![ATUnityUtilities isEmpty:error.userInfo[NSLocalizedFailureReasonErrorKey]]) {
errorDict[@"reason"] = [NSString stringWithFormat:@"%@",error.userInfo[NSLocalizedFailureReasonErrorKey]];
} else {
errorDict[@"reason"] = @"";
}
msgDict[@"error"] = errorDict;
}
[self callbackForKey:placementID]([self scriptWrapperClass].UTF8String, paraDict.jsonString.UTF8String);
}
}
} }
- (NSArray *)jsonStrToArray:(NSString *)jsonString{ - (NSArray *)jsonStrToArray:(NSString *)jsonString{
@@ -135,8 +140,8 @@
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
array = [NSJSONSerialization JSONObjectWithData:jsonData array = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONReadingMutableContainers options:NSJSONReadingMutableContainers
error:&error]; error:&error];
if(error){ if(error){
return [NSArray array]; return [NSArray array];
} }

View File

@@ -186,9 +186,12 @@ UIEdgeInsets SafeAreaInsets_ATUnityNative() {
CGRect adViewFrame = CGRectFromString(at_parseUnityProperties(metrics[@"parent"])[kParsedPropertiesFrameKey]); CGRect adViewFrame = CGRectFromString(at_parseUnityProperties(metrics[@"parent"])[kParsedPropertiesFrameKey]);
CGRect mediaViewFrame = CGRectFromString(parsedMetrics[kNativeAssetMainImage][kParsedPropertiesFrameKey]); CGRect mediaViewFrame = CGRectFromString(parsedMetrics[kNativeAssetMainImage][kParsedPropertiesFrameKey]);
CGRect logoFrame = CGRectFromString(parsedMetrics[kNativeAssetSponsorImage][kParsedPropertiesFrameKey]);
ATNativeADConfiguration *configuration = [ATNativeADConfiguration new]; ATNativeADConfiguration *configuration = [ATNativeADConfiguration new];
configuration.ADFrame = CGRectMake(0, 0, CGRectGetWidth(adViewFrame), CGRectGetHeight(adViewFrame)); configuration.ADFrame = CGRectMake(0, 0, CGRectGetWidth(adViewFrame), CGRectGetHeight(adViewFrame));
configuration.mediaViewFrame = mediaViewFrame; configuration.mediaViewFrame = mediaViewFrame;
configuration.logoViewFrame = logoFrame;
configuration.delegate = self; configuration.delegate = self;
if (extraDict[kATNativeAdAdaptiveHeightKey] != nil) { if (extraDict[kATNativeAdAdaptiveHeightKey] != nil) {
configuration.sizeToFit = [extraDict[kATNativeAdAdaptiveHeightKey] boolValue]; configuration.sizeToFit = [extraDict[kATNativeAdAdaptiveHeightKey] boolValue];
@@ -206,13 +209,13 @@ UIEdgeInsets SafeAreaInsets_ATUnityNative() {
selfRenderView.backgroundColor = [UIColor colorWithHexString:parsedMetrics[kNativeAssetMainImage][@"background_color"]]; selfRenderView.backgroundColor = [UIColor colorWithHexString:parsedMetrics[kNativeAssetMainImage][@"background_color"]];
NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"AnyThinkSDK" ofType:@"bundle"]];
UIImage * img = [UIImage imageNamed:@"icon_webview_close" inBundle:bundle compatibleWithTraitCollection:nil];
[selfRenderView.dislikeButton setImage:img forState:0];
ATNativeADView *adview = [self getNativeADView:configuration offer:offer selfRenderView:selfRenderView withPlacementId:placementID]; ATNativeADView *adview = [self getNativeADView:configuration offer:offer selfRenderView:selfRenderView withPlacementId:placementID];
[self prepareWithNativePrepareInfo:selfRenderView nativeADView:adview]; [self prepareWithNativePrepareInfo:selfRenderView nativeADView:adview];
[offer rendererWithConfiguration:configuration selfRenderView:selfRenderView nativeADView:adview];
// logoView
if (logoFrame.size.width == 0 || logoFrame.size.height == 0) {
adview.logoImageView.hidden = YES;
}
adview.ctaLabel.hidden = [adview.nativeAd.ctaText length] == 0; adview.ctaLabel.hidden = [adview.nativeAd.ctaText length] == 0;
if (adview != nil) { if (adview != nil) {
[self removeNativeAdViewWithPlacementID:placementID]; [self removeNativeAdViewWithPlacementID:placementID];
@@ -251,7 +254,6 @@ UIEdgeInsets SafeAreaInsets_ATUnityNative() {
prepareInfo.ratingLabel = selfRenderView.ratingLabel; prepareInfo.ratingLabel = selfRenderView.ratingLabel;
prepareInfo.iconImageView = selfRenderView.iconImageView; prepareInfo.iconImageView = selfRenderView.iconImageView;
prepareInfo.mainImageView = selfRenderView.mainImageView; prepareInfo.mainImageView = selfRenderView.mainImageView;
prepareInfo.logoImageView = selfRenderView.logoImageView;
prepareInfo.dislikeButton = selfRenderView.dislikeButton; prepareInfo.dislikeButton = selfRenderView.dislikeButton;
prepareInfo.ctaLabel = selfRenderView.ctaLabel; prepareInfo.ctaLabel = selfRenderView.ctaLabel;
prepareInfo.mediaView = selfRenderView.mediaView; prepareInfo.mediaView = selfRenderView.mediaView;
@@ -290,8 +292,6 @@ UIEdgeInsets SafeAreaInsets_ATUnityNative() {
selfRenderView.mediaView = mediaView; selfRenderView.mediaView = mediaView;
[selfRenderView addSubview:mediaView]; [selfRenderView addSubview:mediaView];
//
[selfRenderView bringSubviewToFront:selfRenderView.logoImageView];
} }
[nativeADView registerClickableViewArray:array]; [nativeADView registerClickableViewArray:array];

View File

@@ -21,7 +21,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, strong) UILabel *ratingLabel; @property(nonatomic, strong) UILabel *ratingLabel;
@property(nonatomic, strong) UIImageView *iconImageView; @property(nonatomic, strong) UIImageView *iconImageView;
@property(nonatomic, strong) UIImageView *mainImageView; @property(nonatomic, strong) UIImageView *mainImageView;
@property(nonatomic, strong) UIImageView *logoImageView;
@property(nonatomic, strong) UIImageView *sponsorImageView; @property(nonatomic, strong) UIImageView *sponsorImageView;
@property(nonatomic, strong) UIButton *dislikeButton; @property(nonatomic, strong) UIButton *dislikeButton;

View File

@@ -97,24 +97,25 @@
self.mainImageView.translatesAutoresizingMaskIntoConstraints = false; self.mainImageView.translatesAutoresizingMaskIntoConstraints = false;
[self addSubview:self.mainImageView]; [self addSubview:self.mainImageView];
self.logoImageView = [[UIImageView alloc]init];
self.logoImageView.contentMode = UIViewContentModeScaleAspectFit;
self.logoImageView.userInteractionEnabled = YES;
self.logoImageView.translatesAutoresizingMaskIntoConstraints = false;
[self addSubview:self.logoImageView];
self.dislikeButton = [UIButton buttonWithType:UIButtonTypeCustom]; self.dislikeButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.dislikeButton.translatesAutoresizingMaskIntoConstraints = false; self.dislikeButton.translatesAutoresizingMaskIntoConstraints = false;
UIImage *closeImg = [UIImage imageNamed:@"icon_webview_close" inBundle:[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"AnyThinkSDK" ofType:@"bundle"]] compatibleWithTraitCollection:nil];
self.dislikeButton.backgroundColor = [UIColor whiteColor]; self.dislikeButton.backgroundColor = [UIColor whiteColor];
[self.dislikeButton setImage:closeImg forState:0]; [self.dislikeButton setImage:[self getCloseImage] forState:0];
[self addSubview:self.dislikeButton]; [self addSubview:self.dislikeButton];
} }
- (void)setupUI{ - (UIImage *)getCloseImage {
NSString *imageBase64String = @"iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAEigAwAEAAAAAQAAAEgAAAAAYwsr7AAAAAlwSFlzAAALEwAACxMBAJqcGAAAABxpRE9UAAAAAgAAAAAAAAAkAAAAKAAAACQAAAAkAAACiSuooU0AAAJVSURBVHgB5JqhbsMwEECLisqGhldYNNaxqlJRP2CoY8Wjo/ub4UllI5VGy8f6ASMBA0XbvWiuXKtpnOQcO+lJJ8eRY989351dqYNBuzKU5W5EJ6IPogvRx39dS2ureb+U94zlm1vR3glQcA5Hn0RtCHWfmetOdCTaSbGh1IXg+52B1QlQgLkX1YoUX0iMIyVZO8moignGhWhACas0hMKJUa6hsfvYRJ2KJkTNVDQ2iLL1sRFbWxXyPMWoKYKFra3VJlIqRhEuct73PTYHT7mJLOJrUKrj8CGIcISm6nRVu/BFVfoQOS5EtUgib93J+9KnnjaSkXzdxYLsu4H4ho+1ZChfdeko94XijsNHfK0sXbgEus7W7eNrJelz3SmCWKkeXUNquaC8U61P9x0XQlm/9H5ERb/G6DHgONWGl4qRSvRsNpv3/X7/tdvtPufz+YssaAxQb99ElNe6GEWNowc4v5ZkWfYdCtK5tRQ2ozCKVE4udtPikz+GgOTCMWvOZjONiD37M2SpQH+93W4/jLF2qwmpCA5raPggc8DiREbSU6kP4/H4GUNtOOZZA1IRnMPh8LNarV61/JB5Toq1SnoZ46g5ISC1CIdgmYgehZBSiSAzjzakluHA4iTNVOFoQ4oABx7H04zfIEEAMW/TSIoEx/DgfwR5rpkXQdq6kCLDgUVeh6bsdGitCikBODCBTV6MggNiA3whJQIHJgsANf55gfO+Wgap6KIZ4J7jYzNs2gUEyEuQzKXSbiPBAWAOyIek+hhfSBHhGJ/904Pd19QySAnAWf8BAAD///Z/hqsAAAJUSURBVOWaoVLDQBCGT6HqUGgqq3CVnc5U9QFQwVVja3mMGjSamTpMXwBbXB8AU4Gogv1DfyYtuSS929xd2p25WSYkd/992d3bMBhjzCzmWK1Wb98W2263n+PxeB5Tn6wdD9ByuXy1sPm7nAAkcx8DUhM4pBQREtiEB2SDs9vtvgCDYIo+EqQpAE1kBKtDVXCyLHtCzUkIUg5oGApQHRzqSAgS2JgBhbXpm8KhhkQggY25pqi2/KlwqCMBSDeixVzJeKAobe8KhzoiQxIZv4ZipF6ofeFQUyRIeYHe89GvQ1pwIkK6JRx4pJlaBGnDobbAkdQDmKKppNlisXguNnj8GU0g+hxZ0OtFVEHabDYfvvPvnz9IL0IaaEwOkYRCrwWH+qogjUajOe/z8AfpJfPkhjTzPs3W6/U7wcBrwxGNeQTaIPX7/Ufe4+jz7y95ttTu5KpaCrQFhxqLkLDWixh/5+HBwGoqUSSzzxDqCm+z0ctSXAvR8684H9PyjiIA6uiojB6CQhRF+RtRZKiVtYdw6PEN0tUocNVdenIRSJkfXhAk7PVku5RUQ2phr06Giu7dG8kcrmHf9nPYW+2pVUfunOvRyXXHBkvlMySxSMKeVO2c+qNG/Y4LvXOIJPXIOQaJvO1i4YZm1NMg1pNVutRtQys0BzX0Dl1oJqHRuc/RIIqUSzGaoClYSjUBiZMhBVCoNdASNWpswJDnsUAlDaYMGFJvKqPtzwWsMZCRZMSIrlpDVGnCQqR0HkoVNRROvHGcLtgo6lZZ7eL1yf5ePIP/IwgaKT805vxmzF7SHAAAAABJRU5ErkJggg==";
UIImage *closeImage = [UIImage imageWithData:[[NSData alloc] initWithBase64EncodedString:imageBase64String options:NSDataBase64DecodingIgnoreUnknownCharacters]];
NSLog(@"getCloseImage--%@",closeImage);
return closeImage;
}
- (void)setupUI{
if (self.nativeAdOffer.nativeAd.icon) { if (self.nativeAdOffer.nativeAd.icon) {
self.iconImageView.image = self.nativeAdOffer.nativeAd.icon; self.iconImageView.image = self.nativeAdOffer.nativeAd.icon;
@@ -125,8 +126,6 @@
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.iconImageView setImage:image]; [self.iconImageView setImage:image];
}); });
} }
}]; }];
@@ -139,28 +138,12 @@
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.mainImageView setImage:image]; [self.mainImageView setImage:image];
}); });
} }
}]; }];
NSLog(@"🔥----imageUrl:%@",self.nativeAdOffer.nativeAd.imageUrl); NSLog(@"🔥----imageUrl:%@",self.nativeAdOffer.nativeAd.imageUrl);
[[ATImageLoader shareLoader]loadImageWithURL:[NSURL URLWithString:self.nativeAdOffer.nativeAd.logoUrl] completion:^(UIImage *image, NSError *error) {
if (!error) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.logoImageView setImage:image];
});
}
}];
NSLog(@"🔥----logoUrl:%@",self.nativeAdOffer.nativeAd.logoUrl);
self.advertiserLabel.text = self.nativeAdOffer.nativeAd.advertiser; self.advertiserLabel.text = self.nativeAdOffer.nativeAd.advertiser;
@@ -182,7 +165,8 @@
self.textLabel.backgroundColor = [UIColor clearColor]; self.textLabel.backgroundColor = [UIColor clearColor];
} }
-(void) configureMetrics:(NSDictionary *)metrics { -(void) configureMetrics:(NSDictionary *)metrics {
NSDictionary<NSString*, UIView*> *views = @{kNativeAssetTitle:_titleLabel, kNativeAssetText:_textLabel, kNativeAssetCta:_ctaLabel, kNativeAssetRating:_ratingLabel, kNativeAssetAdvertiser:_advertiserLabel, kNativeAssetIcon:_iconImageView, kNativeAssetMainImage:_mainImageView, kNativeAssetSponsorImage:_logoImageView, kNativeAssetDislike:_dislikeButton};
NSDictionary<NSString*, UIView*> *views = @{kNativeAssetTitle:_titleLabel, kNativeAssetText:_textLabel, kNativeAssetCta:_ctaLabel, kNativeAssetRating:_ratingLabel, kNativeAssetAdvertiser:_advertiserLabel, kNativeAssetIcon:_iconImageView, kNativeAssetMainImage:_mainImageView, kNativeAssetDislike:_dislikeButton};
[views enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { [views enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
CGRect frame = CGRectFromString(metrics[key][kParsedPropertiesFrameKey]); CGRect frame = CGRectFromString(metrics[key][kParsedPropertiesFrameKey]);
[self addConstraintsWithVisualFormat:[NSString stringWithFormat:@"|-x-[%@(w)]", key] options:0 metrics:@{@"x":@(frame.origin.x), @"w":@(frame.size.width)} views:views]; [self addConstraintsWithVisualFormat:[NSString stringWithFormat:@"|-x-[%@(w)]", key] options:0 metrics:@{@"x":@(frame.origin.x), @"w":@(frame.size.width)} views:views];

View File

@@ -69,11 +69,7 @@
} }
NSString *defaultAdSourceConfig = extra[@"default_adSource_config"]; NSString *defaultAdSourceConfig = extra[@"default_adSource_config"];
NSLog(@"ATSplashAdWrapper::extra = %@", extra); NSLog(@"ATSplashAdWrapper::extra = %@", extra);
[[ATAdManager sharedManager] loadADWithPlacementID:placementID [[ATAdManager sharedManager] loadADWithPlacementID:placementID extra:extra delegate:self containerView:nil];
extra:extra
delegate:self
containerView:nil
defaultAdSourceConfig:defaultAdSourceConfig];
} }

View File

@@ -99,9 +99,7 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
return [NSNumber numberWithBool:[self startSDKWithAppID:firstObject appKey:lastObject]]; return [NSNumber numberWithBool:[self startSDKWithAppID:firstObject appKey:lastObject]];
} else if ([selector isEqualToString:@"subjectToGDPR"]) { } else if ([selector isEqualToString:@"subjectToGDPR"]) {
return [NSNumber numberWithBool:[self subjectToGDPR]]; return [NSNumber numberWithBool:[self subjectToGDPR]];
} else if ([selector isEqualToString:@"presentDataConsentDialog"]) { }else if ([selector isEqualToString:@"showGDPRConsentDialog:"]) {
[self presentDataConsentDialog];
} else if ([selector isEqualToString:@"showGDPRConsentDialog:"]) {
[self showGDPRConsentDialog:callback]; [self showGDPRConsentDialog:callback];
} else if ([selector isEqualToString:@"getUserLocation:"]) { } else if ([selector isEqualToString:@"getUserLocation:"]) {
[self getUserLocation:callback]; [self getUserLocation:callback];
@@ -140,17 +138,17 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
} else if ([selector isEqualToString:@"getArea:"]) { } else if ([selector isEqualToString:@"getArea:"]) {
[self getArea:callback]; [self getArea:callback];
} else if ([selector isEqualToString:@"setWXStatus:"]) { } else if ([selector isEqualToString:@"setWXStatus:"]) {
[self setWXStatus:firstObject]; [self setWXStatus:[NSNumber numberWithDouble:firstObject.boolValue]];
} else if ([selector isEqualToString:@"setLocationLongitude:dimension:"]) { } else if ([selector isEqualToString:@"setLocationLongitude:dimension:"]) {
[self setLocationLongitude:[NSNumber numberWithDouble:firstObject.doubleValue] dimension:[NSNumber numberWithDouble:lastObject.doubleValue]]; [self setLocationLongitude:[NSNumber numberWithDouble:firstObject.doubleValue] dimension:[NSNumber numberWithDouble:lastObject.doubleValue]];
} else if ([selector isEqualToString:@"showDebuggerUI"]) { }else if ([selector isEqualToString:@"showDebuggerUI:"]) {
[self showDebuggerUI]; [self showDebuggerUI:firstObject];
} }
return nil; return nil;
} }
-(BOOL) startSDKWithAppID:(NSString*)appID appKey:(NSString*)appKey { -(BOOL) startSDKWithAppID:(NSString*)appID appKey:(NSString*)appKey {
[[ATAPI sharedInstance]setSystemPlatformType:ATSystemPlatformTypeUnity]; [[ATSDKGlobalSetting sharedManager] setSystemPlatformType:ATSystemPlatformTypeUnity];
return [[ATAPI sharedInstance] startWithAppID:appID appKey:appKey error:nil]; return [[ATAPI sharedInstance] startWithAppID:appID appKey:appKey error:nil];
} }
@@ -158,12 +156,6 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
return [@[@"AT", @"BE", @"BG", @"HR", @"CY", @"CZ", @"DK", @"EE", @"FI", @"FR", @"DE", @"GR", @"HU", @"IS", @"IE", @"IT", @"LV", @"LI", @"LT", @"LU", @"MT", @"NL", @"NO", @"PL", @"PT", @"RO", @"SK", @"SI", @"ES", @"SE", @"GB", @"UK"] containsObject:[[CTTelephonyNetworkInfo new].subscriberCellularProvider.isoCountryCode length] > 0 ? [[CTTelephonyNetworkInfo new].subscriberCellularProvider.isoCountryCode uppercaseString] : @""]; return [@[@"AT", @"BE", @"BG", @"HR", @"CY", @"CZ", @"DK", @"EE", @"FI", @"FR", @"DE", @"GR", @"HU", @"IS", @"IE", @"IT", @"LV", @"LI", @"LT", @"LU", @"MT", @"NL", @"NO", @"PL", @"PT", @"RO", @"SK", @"SI", @"ES", @"SE", @"GB", @"UK"] containsObject:[[CTTelephonyNetworkInfo new].subscriberCellularProvider.isoCountryCode length] > 0 ? [[CTTelephonyNetworkInfo new].subscriberCellularProvider.isoCountryCode uppercaseString] : @""];
} }
-(void) presentDataConsentDialog {
[[ATAPI sharedInstance] presentDataConsentDialogInViewController:[UIApplication sharedApplication].delegate.window.rootViewController dismissalCallback:^{
}];
}
-(void) showGDPRConsentDialog:(void(*)(const char*))callback { -(void) showGDPRConsentDialog:(void(*)(const char*))callback {
[[ATAPI sharedInstance] showGDPRConsentDialogInViewController:[UIApplication sharedApplication].delegate.window.rootViewController dismissalCallback:^{ [[ATAPI sharedInstance] showGDPRConsentDialogInViewController:[UIApplication sharedApplication].delegate.window.rootViewController dismissalCallback:^{
if (callback != NULL) { callback(@"".UTF8String); } if (callback != NULL) { callback(@"".UTF8String); }
@@ -189,24 +181,24 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
} }
-(void) setChannel:(NSString*)channel { -(void) setChannel:(NSString*)channel {
[[ATAPI sharedInstance] setChannel:channel]; [[ATSDKGlobalSetting sharedManager] setChannel:channel];
} }
-(void) setSubChannel:(NSString*)subChannel { -(void) setSubChannel:(NSString*)subChannel {
[[ATAPI sharedInstance] setSubchannel:subChannel]; [[ATSDKGlobalSetting sharedManager] setSubchannel:subChannel];
} }
-(void) setCustomData:(NSString*)customDataStr { -(void) setCustomData:(NSString*)customDataStr {
if ([customDataStr isKindOfClass:[NSString class]] && [customDataStr length] > 0) { if ([customDataStr isKindOfClass:[NSString class]] && [customDataStr length] > 0) {
NSDictionary *customData = [NSJSONSerialization JSONObjectWithData:[customDataStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; NSDictionary *customData = [NSJSONSerialization JSONObjectWithData:[customDataStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil];
[[ATAPI sharedInstance] setCustomData:customData]; [[ATSDKGlobalSetting sharedManager] setCustomData:customData];
} }
} }
-(void) setCustomData:(NSString*)customDataStr forPlacementID:(NSString*)placementID { -(void) setCustomData:(NSString*)customDataStr forPlacementID:(NSString*)placementID {
if ([customDataStr isKindOfClass:[NSString class]] && [customDataStr length] > 0) { if ([customDataStr isKindOfClass:[NSString class]] && [customDataStr length] > 0) {
NSDictionary *customData = [NSJSONSerialization JSONObjectWithData:[customDataStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; NSDictionary *customData = [NSJSONSerialization JSONObjectWithData:[customDataStr dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil];
[[ATAPI sharedInstance] setCustomData:customData forPlacementID:placementID]; [[ATSDKGlobalSetting sharedManager] setCustomData:customData forPlacementID:placementID];
} }
} }
@@ -219,7 +211,7 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
} }
-(void) setDataConsent:(NSNumber*)dataConsent { -(void) setDataConsent:(NSNumber*)dataConsent {
[[ATAPI sharedInstance] setDataConsentSet:[@{@0:@(ATDataConsentSetPersonalized), @1:@(ATDataConsentSetNonpersonalized), @2:@(ATDataConsentSetUnknown)}[dataConsent] integerValue] consentString:nil]; [[ATAPI sharedInstance] setDataConsentSet:[@{@0:@(ATDataConsentSetPersonalized), @1:@(ATDataConsentSetNonpersonalized), @2:@(ATDataConsentSetUnknown)}[dataConsent] integerValue] consentString:@{}];
} }
-(BOOL) inDataProtectionArea { -(BOOL) inDataProtectionArea {
@@ -230,7 +222,7 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
NSLog(@"ATUnityManager::deniedUploadDeviceInfo = %@", deniedInfo); NSLog(@"ATUnityManager::deniedUploadDeviceInfo = %@", deniedInfo);
if (![ATUnityUtilities isEmpty:deniedInfo]) { if (![ATUnityUtilities isEmpty:deniedInfo]) {
NSArray *deniedInfoArray = [NSJSONSerialization JSONObjectWithData:[deniedInfo dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; NSArray *deniedInfoArray = [NSJSONSerialization JSONObjectWithData:[deniedInfo dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil];
[[ATAPI sharedInstance] setDeniedUploadInfoArray:deniedInfoArray]; [[ATSDKGlobalSetting sharedManager] setDeniedUploadInfoArray:deniedInfoArray];
} }
} }
@@ -266,7 +258,7 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
NSLog(@"ATUnityManager::setExcludeBundleIdArray = %@", bundleIds); NSLog(@"ATUnityManager::setExcludeBundleIdArray = %@", bundleIds);
if (![ATUnityUtilities isEmpty:bundleIds]) { if (![ATUnityUtilities isEmpty:bundleIds]) {
NSArray *bundleIdArray = [NSJSONSerialization JSONObjectWithData:[bundleIds dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; NSArray *bundleIdArray = [NSJSONSerialization JSONObjectWithData:[bundleIds dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil];
[[ATAPI sharedInstance] setExludeAppleIdArray:bundleIdArray]; [[ATSDKGlobalSetting sharedManager] setExludeAppleIdArray:bundleIdArray];
} }
} }
@@ -301,38 +293,60 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
}]; }];
} }
-(void) setWXStatus:(NSString *)statusStr { -(void) setWXStatus:(NSNumber *)flag {
NSLog(@"ATUnityManager::setWXStatus=%@",statusStr); NSLog(@"ATUnityManager::setWXStatus=%d",flag.boolValue);
[[ATAPI sharedInstance] setWXStatus:[statusStr boolValue]]; [ATSDKGlobalSetting sharedManager].isInstallWX = flag.boolValue;
} }
-(void) setLocationLongitude:(NSNumber*)longitude dimension:(NSNumber*)latitude { -(void) setLocationLongitude:(NSNumber*)longitude dimension:(NSNumber*)latitude {
NSLog(@"ATUnityManager::setLocationLongitude=%@ dimension=%@",longitude,latitude); NSLog(@"ATUnityManager::setLocationLongitude=%@ dimension=%@",longitude,latitude);
[[ATAPI sharedInstance] setLocationLongitude:longitude.doubleValue dimension:latitude.doubleValue]; [[ATSDKGlobalSetting sharedManager] setLocationLongitude:longitude.doubleValue dimension:latitude.doubleValue];
} }
-(void) showDebuggerUI - (void)showDebuggerUI:(NSString *)debugKey {
{ NSLog(@"ATUnityManager::showDebuggerUI with key: %@", debugKey);
// AnyThinkDebuggerUISDK
NSLog(@"ATUnityManager::showDebuggerUI");
NSString *classStr = @"ATDebuggerAPI"; NSString *classStr = @"ATDebuggerAPI";
Class debuggerAPIClass = NSClassFromString(classStr); Class debuggerAPIClass = NSClassFromString(classStr);
if(!debuggerAPIClass) { if(!debuggerAPIClass) {
NSLog(@"ATUnityManager::showDebuggerUI- NO %@",classStr); NSLog(@"ATUnityManager::showDebuggerUI - NO %@", classStr);
return; return;
} else { }
NSObject *debuger = [debuggerAPIClass performSelector:@selector(sharedInstance)];
NSString *fuctionStr = @"showDebuggerInViewController:showType:"; SEL sharedInstanceSel = @selector(sharedInstance);
SEL sel = NSSelectorFromString(fuctionStr); if (![debuggerAPIClass respondsToSelector:sharedInstanceSel]) {
if(!debuger || ![debuger respondsToSelector:sel]) { NSLog(@"ATUnityManager::showDebuggerUI - NO sharedInstance selector");
NSLog(@"ATUnityManager::showDebuggerUI- NO %@",fuctionStr); return;
return; }
} else {
UIWindow *win = [UIApplication sharedApplication].keyWindow; // sharedInstanceSel
[debuger performSelector:sel withObject:win.rootViewController withObject:@1]; id debugger = [debuggerAPIClass performSelector:sharedInstanceSel];
NSString *functionStr = @"showDebuggerInViewController:showType:debugkey:";
SEL sel = NSSelectorFromString(functionStr);
if ([debugger respondsToSelector:sel]) {
NSMethodSignature *signature = [debugger methodSignatureForSelector:sel];
if (signature) {
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:debugger];
[invocation setSelector:sel];
//
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIViewController *rootViewController = keyWindow.rootViewController;
NSNumber *showType = @1; // showType 1
[invocation setArgument:&rootViewController atIndex:2]; // 201targetselector
[invocation setArgument:&showType atIndex:3];
[invocation setArgument:&debugKey atIndex:4];
//
[invocation invoke];
} }
} else {
NSLog(@"ATUnityManager::showDebuggerUI - NO %@", functionStr);
} }
} }
@end @end

View File

@@ -0,0 +1,22 @@
// ATSafeThreadDictionary.h
// ATSDK
//
// Created by topon on 2020/9/21.
// Copyright © 2020 AnyThink. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
A simple implementation of thread safe mutable dictionary.
@discussion Generally, access performance is lower than NSMutableDictionary,
but higher than using @synchronized, NSLock, or pthread_mutex_t.
@warning Fast enumerate(for...in) and enumerator is not thread safe,
use enumerate using block instead. When enumerate or sort with block/callback,
do *NOT* send message to the dictionary inside the block/callback.
*/
@interface ATUnitySafeThreadDictionary<KeyType, ObjectType> : NSMutableDictionary
@end

View File

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

View File

@@ -0,0 +1,261 @@
// ATSafeThreadDictionary.h
// ATSDK
//
// Created by topon on 2020/9/21.
// Copyright © 2020 AnyThink. All rights reserved.
//
#import "ATUnitySafeThreadDictionary.h"
#import <pthread.h>
#define INIT(...) self = super.init; \
if (!self) return nil; \
__VA_ARGS__; \
if (!_dic) return nil; \
[self __initMutex:&_mutex_lock];\
return self;
#define LOCK(...) pthread_mutex_lock(&_mutex_lock); \
__VA_ARGS__; \
pthread_mutex_unlock(&_mutex_lock);
@implementation ATUnitySafeThreadDictionary {
NSMutableDictionary *_dic; //Subclass a class cluster...
pthread_mutex_t _mutex_lock;
pthread_mutexattr_t _attr;
}
#pragma mark - init
- (void)__initMutex:(pthread_mutex_t *)mutex {
// 线
//
pthread_mutexattr_init(&_attr);
pthread_mutexattr_settype(&_attr, PTHREAD_MUTEX_RECURSIVE);
//
pthread_mutex_init(mutex, &_attr);
}
- (instancetype)init {
INIT(_dic = [[NSMutableDictionary alloc] init]);
}
- (instancetype)initWithObjects:(NSArray *)objects forKeys:(NSArray *)keys {
INIT(_dic = [[NSMutableDictionary alloc] initWithObjects:objects forKeys:keys]);
}
- (instancetype)initWithCapacity:(NSUInteger)capacity {
INIT(_dic = [[NSMutableDictionary alloc] initWithCapacity:capacity]);
}
- (instancetype)initWithObjects:(const id[])objects forKeys:(const id <NSCopying>[])keys count:(NSUInteger)cnt {
INIT(_dic = [[NSMutableDictionary alloc] initWithObjects:objects forKeys:keys count:cnt]);
}
- (instancetype)initWithDictionary:(NSDictionary *)otherDictionary {
INIT(_dic = [[NSMutableDictionary alloc] initWithDictionary:otherDictionary]);
}
- (instancetype)initWithDictionary:(NSDictionary *)otherDictionary copyItems:(BOOL)flag {
INIT(_dic = [[NSMutableDictionary alloc] initWithDictionary:otherDictionary copyItems:flag]);
}
#pragma mark - method
- (NSUInteger)count {
LOCK(NSUInteger c = _dic.count); return c;
}
- (id)objectForKey:(id)aKey {
LOCK(id o = [_dic objectForKey:aKey]); return o;
}
- (NSEnumerator *)keyEnumerator {
LOCK(NSEnumerator * e = [_dic keyEnumerator]); return e;
}
- (NSArray *)allKeys {
LOCK(NSArray * a = [_dic allKeys]); return a;
}
- (NSArray *)allKeysForObject:(id)anObject {
LOCK(NSArray * a = [_dic allKeysForObject:anObject]); return a;
}
- (NSArray *)allValues {
LOCK(NSArray * a = [_dic allValues]); return a;
}
- (NSString *)description {
LOCK(NSString * d = [_dic description]); return d;
}
- (NSString *)descriptionInStringsFileFormat {
LOCK(NSString * d = [_dic descriptionInStringsFileFormat]); return d;
}
- (NSString *)descriptionWithLocale:(id)locale {
LOCK(NSString * d = [_dic descriptionWithLocale:locale]); return d;
}
- (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level {
LOCK(NSString * d = [_dic descriptionWithLocale:locale indent:level]); return d;
}
- (BOOL)isEqualToDictionary:(NSDictionary *)otherDictionary {
if (otherDictionary == self) return YES;
if ([otherDictionary isKindOfClass:ATUnitySafeThreadDictionary.class]) {
ATUnitySafeThreadDictionary *other = (id)otherDictionary;
BOOL isEqual;
pthread_mutex_lock(&_mutex_lock);
pthread_mutex_lock(&(other->_mutex_lock));
isEqual = [_dic isEqual:other->_dic];
pthread_mutex_unlock(&_mutex_lock);
pthread_mutex_unlock(&(other->_mutex_lock));
return isEqual;
}
return NO;
}
- (NSEnumerator *)objectEnumerator {
LOCK(NSEnumerator * e = [_dic objectEnumerator]); return e;
}
- (NSArray *)objectsForKeys:(NSArray *)keys notFoundMarker:(id)marker {
LOCK(NSArray * a = [_dic objectsForKeys:keys notFoundMarker:marker]); return a;
}
- (NSArray *)keysSortedByValueUsingSelector:(SEL)comparator {
LOCK(NSArray * a = [_dic keysSortedByValueUsingSelector:comparator]); return a;
}
- (void)getObjects:(id __unsafe_unretained[])objects andKeys:(id __unsafe_unretained[])keys {
LOCK([_dic getObjects:objects andKeys:keys]);
}
- (id)objectForKeyedSubscript:(id)key {
LOCK(id o = [_dic objectForKeyedSubscript:key]); return o;
}
- (void)enumerateKeysAndObjectsUsingBlock:(__attribute__((noescape)) void (^)(id key, id obj, BOOL *stop))block {
LOCK([_dic enumerateKeysAndObjectsUsingBlock:block]);
}
- (void)enumerateKeysAndObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(__attribute__((noescape)) void (^)(id key, id obj, BOOL *stop))block {
LOCK([_dic enumerateKeysAndObjectsWithOptions:opts usingBlock:block]);
}
- (NSArray *)keysSortedByValueUsingComparator:(__attribute__((noescape)) NSComparator)cmptr {
LOCK(NSArray * a = [_dic keysSortedByValueUsingComparator:cmptr]); return a;
}
- (NSArray *)keysSortedByValueWithOptions:(NSSortOptions)opts usingComparator:(__attribute__((noescape)) NSComparator)cmptr {
LOCK(NSArray * a = [_dic keysSortedByValueWithOptions:opts usingComparator:cmptr]); return a;
}
- (NSSet *)keysOfEntriesPassingTest:(__attribute__((noescape)) BOOL (^)(id key, id obj, BOOL *stop))predicate {
LOCK(NSSet * a = [_dic keysOfEntriesPassingTest:predicate]); return a;
}
- (NSSet *)keysOfEntriesWithOptions:(NSEnumerationOptions)opts passingTest:(__attribute__((noescape)) BOOL (^)(id key, id obj, BOOL *stop))predicate {
LOCK(NSSet * a = [_dic keysOfEntriesWithOptions:opts passingTest:predicate]); return a;
}
#pragma mark - mutable
- (void)removeObjectForKey:(id)aKey {
LOCK(
if (aKey) {
[_dic removeObjectForKey:aKey];
});
}
- (void)setObject:(id)anObject forKey:(id <NSCopying> )aKey {
LOCK(
if (anObject && aKey) {
[_dic setObject:anObject forKey:aKey];
});
}
- (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary {
LOCK(
if (otherDictionary) {
[_dic addEntriesFromDictionary:otherDictionary];
});
}
- (void)removeAllObjects {
LOCK([_dic removeAllObjects]);
}
- (void)removeObjectsForKeys:(NSArray *)keyArray {
LOCK([_dic removeObjectsForKeys:keyArray]);
}
- (void)setDictionary:(NSDictionary *)otherDictionary {
LOCK(
if (otherDictionary) {
[_dic setDictionary:otherDictionary];
});
}
- (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying> )key {
LOCK(
if (obj && key) {
[_dic setObject:obj forKeyedSubscript:key];
});
}
#pragma mark - protocol
- (id)copyWithZone:(NSZone *)zone {
return [self mutableCopyWithZone:zone];
}
- (id)mutableCopyWithZone:(NSZone *)zone {
LOCK(id copiedDictionary = [[self.class allocWithZone:zone] initWithDictionary:_dic]);
return copiedDictionary;
}
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id __unsafe_unretained[])stackbuf
count:(NSUInteger)len {
LOCK(NSUInteger count = [_dic countByEnumeratingWithState:state objects:stackbuf count:len]);
return count;
}
- (BOOL)isEqual:(id)object {
if (object == self) return YES;
if ([object isKindOfClass:ATUnitySafeThreadDictionary.class]) {
ATUnitySafeThreadDictionary *other = object;
BOOL isEqual;
pthread_mutex_lock(&_mutex_lock);
pthread_mutex_lock(&(other->_mutex_lock));
isEqual = [_dic isEqual:other->_dic];
pthread_mutex_unlock(&_mutex_lock);
pthread_mutex_unlock(&(other->_mutex_lock));
return isEqual;
}
return NO;
}
- (NSUInteger)hash {
LOCK(NSUInteger hash = [_dic hash]);
return hash;
}
- (void)dealloc {
pthread_mutex_destroy(&_mutex_lock);
pthread_mutexattr_destroy(&_attr);
}
@end

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e50d797179f3d284ab428f94ea344342 guid: 3062b0f1e56a64e7ea4d843dde2aa0c2
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
@@ -11,11 +11,6 @@ PluginImporter:
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first: - first:
Any: Any:
second: second:
@@ -27,6 +22,16 @@ PluginImporter:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@@ -23,6 +23,16 @@ NSString *const kATUnityCheckLoadModelAdInfoKey = @"adInfo";
@end @end
@implementation NSDictionary (KAKit) @implementation NSDictionary (KAKit)
-(NSString*) jsonString { -(NSString*) jsonString {
@try {
// can not serialization, return a value is null array string
if (![NSJSONSerialization isValidJSONObject:self]) {
return @"[]";
}
} @catch (NSException *exception) {
return @"[]";
} @finally {}
NSError *error; NSError *error;
NSData *jsonData; NSData *jsonData;
@try { @try {

View File

@@ -121,10 +121,10 @@ public class ATManager {
ATUnityCBridge.SendMessageToC("ATUnityManager", "setLocationLongitude:dimension:", new object[] {longitude, latitude}); ATUnityCBridge.SendMessageToC("ATUnityManager", "setLocationLongitude:dimension:", new object[] {longitude, latitude});
} }
public static void showDebuggerUI() public static void showDebuggerUI(string debugKey)
{ {
Debug.Log("Unity:ATManager::showDebuggerUI()"); Debug.Log("Unity:ATManager::showDebuggerUI()");
ATUnityCBridge.SendMessageToC("ATUnityManager", "showDebuggerUI", null); ATUnityCBridge.SendMessageToC("ATUnityManager", "showDebuggerUI:", new object[] {debugKey});
} }
public static void showGDPRConsentDialog(Func<string, int> callback) public static void showGDPRConsentDialog(Func<string, int> callback)

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0f4a0fb45277676429a81bc79f9252f1 guid: d1114d7069dbda64c88d1e55a8139d2a
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 79e7d078a28b97e4aa88261277efdc65
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f4a837cf60e40c84690ece85b75c748e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c711e887715a14f16b1f1c51b0b51cb6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a2bc97553ae314289a9a2013322cd4a9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<iosPods>
<iosPod name="AnyThinkBaiduSDKAdapter" version="6.4.42" />
</iosPods>
</dependencies>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6675c71972048453abf7c20a06967d5b
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
{"name":"baidu","version":"5.373","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/iOS/China/baidu"}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: aa4ff5b557e70ce45bfe14aa9dad7b09
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e7707ce5f0d545658dfd9b8fe6e52ff
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 552357a8d145344c69eb52e710b96576
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<iosPods>
<iosPod name="AnyThinkBigoSDKAdapter" version="6.4.42" />
</iosPods>
</dependencies>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b55087d78ea64405396da6d5bdbc5767
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
{"name":"bigo","version":"4.6.0","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/iOS/China/bigo"}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4b4abb456bd407f42afab46733e791c7
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c8ce81554dbcd4e9896ee0f1cb782685
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: faf88f547152a4fa0b48ea5d4e233b85
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<iosPods>
<iosPod name="AnyThinkiOS" version="" />
</iosPods>
</dependencies>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4fc1bcc62310548f4a6bddd58180eef9
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f014b4b54a4c14658bb414d8bab45881
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e9c9c9037adb147c6a23506e8d09da1d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<iosPods>
<iosPod name="AnyThinkGDTSDKAdapter" version="6.4.42.1" />
</iosPods>
</dependencies>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 776c604368e524ec1979fdc2145dc4a9
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
{"name":"gdt","version":"4.15.22","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/iOS/China/gdt"}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c070344429af04b47b4acb3ee8301e55
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 22ed74d747c3a4e8d9be02f0655ec916
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e73b56682c38e413aac2484a4523d197
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<iosPods>
<iosPod name="AnyThinkKuaiShouSDKAdapter" version="6.4.42" />
</iosPods>
</dependencies>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3d70d9e3e50ca41cf8ed11587a469d3c
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
{"name":"kuaishou","version":"3.3.74","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/iOS/China/kuaishou"}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d1ec7085a1737ec45b6dcbc106fb9f21
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 21b36bafe93f54b118240a3c32373f2a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a3ee56d73942543dd82e64f770cfe8fe
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<iosPods>
<iosPod name="AnyThinkSigmobSDKAdapter" version="6.4.42" />
</iosPods>
</dependencies>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ea0d12cb31c714f42b27f4815033c999
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
{"name":"sigmob","version":"4.12.3","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/iOS/China/sigmob"}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cc814e4fd257faa46b5f9d2ca03dddc4
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ba33ef28b434a4f8c84894b7dffe183d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9ff4698e0cb23484080a1f1024c0d7bb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<iosPods>
<iosPod name="AnyThinkTapjoySDKAdapter" version="6.4.42" />
</iosPods>
</dependencies>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 003d4a29535ae4c15a11b3fb837f4460
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
{"name":"tapjoy","version":"12.11.0","country":1,"path":"Assets/AnyThinkPlugin/AnyThinkAds\\Plugins/iOS/China/tapjoy"}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 63decd1f920a3854183396647471bd3a
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +1 @@
{ {"plugin_version":"2.1.3","hot_fix_version":"1.0.2","download_url":"https://topon-sdk-release.oss-cn-hangzhou.aliyuncs.com/Unity_Release/plugin/2.1.3/hotfix/1.0.2/AnyThinkHotFixPlugin_1.0.2.unitypackage","status":1,"file_name":"AnyThinkHotFixPlugin_1.0.2.unitypackage"}
"status": 1,
"file_name": "AnyThinkHotFixPlugin_1.0.1.unitypackage",
"hot_fix_version": "1.0.1",
"download_url": "https://topon-sdk-release.oss-cn-hangzhou.aliyuncs.com/Unity_Release/plugin/2.1.3/hotfix/1.0.1/AnyThinkHotFixPlugin_1.0.1.unitypackage",
"plugin_version": "2.1.3"
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d3befc5627f3ea041b413f77cf102af7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
{"curCountry":1,"china":{"android_version":"6.4.56","ios_version":"6.4.42","androidXSetting":0,"country":1,"android_admob_app_id":"","ios_admob_app_id":""},"nonchina":{"android_version":"","ios_version":"","androidXSetting":0,"country":2,"android_admob_app_id":"","ios_admob_app_id":""}}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 34f8d733fac6bf94380c73b27d423133
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -16,7 +16,7 @@ namespace AnyThink.Scripts.IntegrationManager.Editor
public class ATConfig public class ATConfig
{ {
public static string PLUGIN_VERSION = "2.1.3"; public static string PLUGIN_VERSION = "2.1.5";
public static bool isDebug = false; public static bool isDebug = false;
public static int PLUGIN_TYPE = 1; public static int PLUGIN_TYPE = 1;