You've already forked Commercialization.topon
升级topon sdk版本2.1.5, 升级平台插件版本至最新
This commit is contained in:
@@ -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]];
|
||||
} else if ([selector isEqualToString:@"subjectToGDPR"]) {
|
||||
return [NSNumber numberWithBool:[self subjectToGDPR]];
|
||||
} else if ([selector isEqualToString:@"presentDataConsentDialog"]) {
|
||||
[self presentDataConsentDialog];
|
||||
} else if ([selector isEqualToString:@"showGDPRConsentDialog:"]) {
|
||||
}else if ([selector isEqualToString:@"showGDPRConsentDialog:"]) {
|
||||
[self showGDPRConsentDialog:callback];
|
||||
} else if ([selector isEqualToString:@"getUserLocation:"]) {
|
||||
[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:"]) {
|
||||
[self getArea:callback];
|
||||
} else if ([selector isEqualToString:@"setWXStatus:"]) {
|
||||
[self setWXStatus:firstObject];
|
||||
[self setWXStatus:[NSNumber numberWithDouble:firstObject.boolValue]];
|
||||
} else if ([selector isEqualToString:@"setLocationLongitude:dimension:"]) {
|
||||
[self setLocationLongitude:[NSNumber numberWithDouble:firstObject.doubleValue] dimension:[NSNumber numberWithDouble:lastObject.doubleValue]];
|
||||
} else if ([selector isEqualToString:@"showDebuggerUI"]) {
|
||||
[self showDebuggerUI];
|
||||
}else if ([selector isEqualToString:@"showDebuggerUI:"]) {
|
||||
[self showDebuggerUI:firstObject];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(BOOL) startSDKWithAppID:(NSString*)appID appKey:(NSString*)appKey {
|
||||
[[ATAPI sharedInstance]setSystemPlatformType:ATSystemPlatformTypeUnity];
|
||||
[[ATSDKGlobalSetting sharedManager] setSystemPlatformType:ATSystemPlatformTypeUnity];
|
||||
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] : @""];
|
||||
}
|
||||
|
||||
-(void) presentDataConsentDialog {
|
||||
[[ATAPI sharedInstance] presentDataConsentDialogInViewController:[UIApplication sharedApplication].delegate.window.rootViewController dismissalCallback:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void) showGDPRConsentDialog:(void(*)(const char*))callback {
|
||||
[[ATAPI sharedInstance] showGDPRConsentDialogInViewController:[UIApplication sharedApplication].delegate.window.rootViewController dismissalCallback:^{
|
||||
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 {
|
||||
[[ATAPI sharedInstance] setChannel:channel];
|
||||
[[ATSDKGlobalSetting sharedManager] setChannel:channel];
|
||||
}
|
||||
|
||||
-(void) setSubChannel:(NSString*)subChannel {
|
||||
[[ATAPI sharedInstance] setSubchannel:subChannel];
|
||||
[[ATSDKGlobalSetting sharedManager] setSubchannel:subChannel];
|
||||
}
|
||||
|
||||
-(void) setCustomData:(NSString*)customDataStr {
|
||||
if ([customDataStr isKindOfClass:[NSString class]] && [customDataStr length] > 0) {
|
||||
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 {
|
||||
if ([customDataStr isKindOfClass:[NSString class]] && [customDataStr length] > 0) {
|
||||
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 {
|
||||
[[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 {
|
||||
@@ -230,7 +222,7 @@ char * at_get_string_message_for_unity(const char *msg, void(*callback)(const ch
|
||||
NSLog(@"ATUnityManager::deniedUploadDeviceInfo = %@", deniedInfo);
|
||||
if (![ATUnityUtilities isEmpty:deniedInfo]) {
|
||||
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);
|
||||
if (![ATUnityUtilities isEmpty:bundleIds]) {
|
||||
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 {
|
||||
NSLog(@"ATUnityManager::setWXStatus=%@",statusStr);
|
||||
[[ATAPI sharedInstance] setWXStatus:[statusStr boolValue]];
|
||||
-(void) setWXStatus:(NSNumber *)flag {
|
||||
NSLog(@"ATUnityManager::setWXStatus=%d",flag.boolValue);
|
||||
[ATSDKGlobalSetting sharedManager].isInstallWX = flag.boolValue;
|
||||
}
|
||||
|
||||
-(void) setLocationLongitude:(NSNumber*)longitude dimension:(NSNumber*)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
|
||||
{
|
||||
// 此处用反射方式调用,发布时可以不用导入AnyThinkDebuggerUISDK库
|
||||
NSLog(@"ATUnityManager::showDebuggerUI");
|
||||
|
||||
- (void)showDebuggerUI:(NSString *)debugKey {
|
||||
NSLog(@"ATUnityManager::showDebuggerUI with key: %@", debugKey);
|
||||
NSString *classStr = @"ATDebuggerAPI";
|
||||
Class debuggerAPIClass = NSClassFromString(classStr);
|
||||
if(!debuggerAPIClass) {
|
||||
NSLog(@"ATUnityManager::showDebuggerUI- NO %@",classStr);
|
||||
NSLog(@"ATUnityManager::showDebuggerUI - NO %@", classStr);
|
||||
return;
|
||||
} else {
|
||||
NSObject *debuger = [debuggerAPIClass performSelector:@selector(sharedInstance)];
|
||||
NSString *fuctionStr = @"showDebuggerInViewController:showType:";
|
||||
SEL sel = NSSelectorFromString(fuctionStr);
|
||||
if(!debuger || ![debuger respondsToSelector:sel]) {
|
||||
NSLog(@"ATUnityManager::showDebuggerUI- NO %@",fuctionStr);
|
||||
return;
|
||||
} else {
|
||||
UIWindow *win = [UIApplication sharedApplication].keyWindow;
|
||||
[debuger performSelector:sel withObject:win.rootViewController withObject:@1];
|
||||
}
|
||||
|
||||
SEL sharedInstanceSel = @selector(sharedInstance);
|
||||
if (![debuggerAPIClass respondsToSelector:sharedInstanceSel]) {
|
||||
NSLog(@"ATUnityManager::showDebuggerUI - NO sharedInstance selector");
|
||||
return;
|
||||
}
|
||||
|
||||
// 通过sharedInstanceSel获取单例对象
|
||||
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]; // 注意:参数索引从2开始,0和1被target和selector占用
|
||||
[invocation setArgument:&showType atIndex:3];
|
||||
[invocation setArgument:&debugKey atIndex:4];
|
||||
|
||||
// 调用方法
|
||||
[invocation invoke];
|
||||
}
|
||||
} else {
|
||||
NSLog(@"ATUnityManager::showDebuggerUI - NO %@", functionStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user