diff --git a/.DS_Store b/.DS_Store index a361c30..cb639bd 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift b/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift deleted file mode 100644 index e44f781..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift +++ /dev/null @@ -1,79 +0,0 @@ -import Foundation -import StoreKit - -#if canImport(PurchaseConnector) -import PurchaseConnector - -@available(iOS 15.0, *) -@objc -public class AFUnityStoreKit2Bridge: NSObject { - @objc - public static func fetchAFSDKTransactionSK2(withTransactionId transactionId: String, completion: @escaping (AFSDKTransactionSK2?) -> Void) { - guard let transactionIdUInt64 = UInt64(transactionId) else { - print("Invalid transaction ID format.") - completion(nil) - return - } - Task { - for await result in StoreKit.Transaction.all { - if case .verified(let transaction) = result, transaction.id == transactionIdUInt64 { - let afTransaction = AFSDKTransactionSK2(transaction: transaction) - DispatchQueue.main.async { - completion(afTransaction) - } - return - } - } - DispatchQueue.main.async { - completion(nil) - } - } - } - - @objc - public static func extractSK2ProductInfo(_ products: [AFSDKProductSK2]) -> NSArray { - var result: [[String: Any]] = [] - - for product in products { - if let swiftProduct = Mirror(reflecting: product).children.first(where: { $0.label == "product" })?.value { - let productId = (swiftProduct as? NSObject)?.value(forKey: "id") as? String ?? "" - let title = (swiftProduct as? NSObject)?.value(forKey: "displayName") as? String ?? "" - let desc = (swiftProduct as? NSObject)?.value(forKey: "description") as? String ?? "" - let price = (swiftProduct as? NSObject)?.value(forKey: "price") as? NSDecimalNumber ?? 0 - - result.append([ - "productIdentifier": productId, - "localizedTitle": title, - "localizedDescription": desc, - "price": price - ]) - } - } - - return result as NSArray - } - - @objc - public static func extractSK2TransactionInfo(_ transactions: [AFSDKTransactionSK2]) -> NSArray { - var result: [[String: Any]] = [] - - for txn in transactions { - guard let mirrorChild = Mirror(reflecting: txn).children.first(where: { $0.label == "transaction" }), - let swiftTxn = mirrorChild.value as? StoreKit.Transaction else { - continue - } - - let transactionId = "\(swiftTxn.id)" - let date = NSNumber(value: swiftTxn.purchaseDate.timeIntervalSince1970) - - result.append([ - "transactionIdentifier": transactionId, - "transactionState": "verified", // or skip this line - "transactionDate": date - ]) - } - - return result as NSArray - } -} -#endif diff --git a/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift.meta b/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift.meta deleted file mode 100644 index f269096..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AFUnityStoreKit2Bridge.swift.meta +++ /dev/null @@ -1,42 +0,0 @@ -fileFormatVersion: 2 -guid: 5652805602a6b4273a6e527b00aea272 -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: - VisionOS: VisionOS - second: - enabled: 1 - settings: {} - - first: - iPhone: iOS - second: - enabled: 1 - settings: {} - - first: - tvOS: tvOS - second: - enabled: 1 - settings: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.h b/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.h deleted file mode 100644 index d3fec43..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// AFUnityUtils.h -// -// Created by Andrii H. and Dmitry O. on 16 Oct 2023 -// - -#if __has_include() -#import -#else -#import "AppsFlyerLib.h" -#endif - -static NSString* stringFromChar(const char *str); -static NSDictionary* dictionaryFromJson(const char *jsonString); -static const char* stringFromdictionary(NSDictionary* dictionary); -static NSArray *NSArrayFromCArray(int length, const char **arr); -static char* getCString(const char* string); -static AppsFlyerLinkGenerator* generatorFromDictionary(NSDictionary* dictionary, AppsFlyerLinkGenerator* generator); -static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt); -static AppsFlyerAdRevenueMediationNetworkType mediationNetworkTypeFromInt(int mediationNetwork); -static NSNumber *intFromNullableBool(const char *cStr); -static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult); -static NSString* stringFromDeepLinkResultError(AppsFlyerDeepLinkResult *result); - diff --git a/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.mm b/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.mm deleted file mode 100644 index e2c0cf3..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.mm +++ /dev/null @@ -1,219 +0,0 @@ -// -// AFUnityUtils.mm -// Unity-iPhone -// -// Created by Jonathan Wesfield on 24/07/2019. -// - -#import "AFUnityUtils.h" - -static NSString* stringFromChar(const char *str) { - return str ? [NSString stringWithUTF8String:str] : nil; -} - -static NSDictionary* dictionaryFromJson(const char *jsonString) { - if(jsonString){ - NSData *jsonData = [[NSData alloc] initWithBytes:jsonString length:strlen(jsonString)]; - NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; - return dictionary; - } - - return nil; -} - -static const char* stringFromdictionary(NSDictionary* dictionary) { - if(dictionary){ - NSError * err; - NSData * jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:&err]; - NSString * myString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - return [myString UTF8String]; - } - - return nil; -} - -static NSDictionary* dictionaryFromNSError(NSError* error) { - if(error){ - NSMutableDictionary *errorDictionary = [NSMutableDictionary dictionary]; - errorDictionary[@"code"] = @(error.code); - errorDictionary[@"localizedDescription"] = error.localizedDescription ?: @""; - - // Include userInfo fields for enhanced error reporting (iOS SDK 6.17.8+) - if (error.userInfo[@"error_code"]) { - errorDictionary[@"error_code"] = error.userInfo[@"error_code"]; - } - if (error.userInfo[@"error_message"]) { - errorDictionary[@"error_message"] = error.userInfo[@"error_message"]; - } - if (error.userInfo[@"invalid_fields"]) { - errorDictionary[@"invalid_fields"] = error.userInfo[@"invalid_fields"]; - } - - return errorDictionary; - } - - return nil; -} - - -static NSArray *NSArrayFromCArray(int length, const char **arr) { - NSMutableArray *res = [[NSMutableArray alloc] init]; - for(int i = 0; i < length; i++) { - if (arr[i]) { - [res addObject:[NSString stringWithUTF8String:arr[i]]]; - } - } - - return res; -} - -static char* getCString(const char* string){ - if (string == NULL){ - return NULL; - } - - char* res = (char*)malloc(strlen(string) + 1); - strcpy(res, string); - - return res; -} - -static AppsFlyerLinkGenerator* generatorFromDictionary(NSDictionary* dictionary, AppsFlyerLinkGenerator* generator) { - - NSArray* generatorKeys = @[@"channel", @"customerID", @"campaign", @"referrerName", @"referrerImageUrl", @"deeplinkPath", @"baseDeeplink", @"brandDomain"]; - - NSMutableDictionary* mutableDictionary = [dictionary mutableCopy]; - - [generator setChannel:[dictionary objectForKey: @"channel"]]; - [generator setReferrerCustomerId:[dictionary objectForKey: @"customerID"]]; - [generator setCampaign:[dictionary objectForKey: @"campaign"]]; - [generator setReferrerName:[dictionary objectForKey: @"referrerName"]]; - [generator setReferrerImageURL:[dictionary objectForKey: @"referrerImageUrl"]]; - [generator setDeeplinkPath:[dictionary objectForKey: @"deeplinkPath"]]; - [generator setBaseDeeplink:[dictionary objectForKey: @"baseDeeplink"]]; - [generator setBrandDomain:[dictionary objectForKey: @"brandDomain"]]; - - - [mutableDictionary removeObjectsForKeys:generatorKeys]; - - [generator addParameters:mutableDictionary]; - - return generator; -} - -static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt){ - - EmailCryptType emailCryptType; - switch (emailCryptTypeInt){ - case 1: - emailCryptType = EmailCryptTypeSHA256; - break; - default: - emailCryptType = EmailCryptTypeNone; - break; - } - - return emailCryptType; -} - -static NSNumber *intFromNullableBool(const char *cStr) { - if (!cStr) return nil; - NSString *str = [NSString stringWithUTF8String:cStr]; - - if ([str caseInsensitiveCompare:@"true"] == NSOrderedSame) { - return @YES; - } else if ([str caseInsensitiveCompare:@"false"] == NSOrderedSame) { - return @NO; - } - return nil; -} - -static AppsFlyerAdRevenueMediationNetworkType mediationNetworkTypeFromInt(int mediationNetworkInt){ - - AppsFlyerAdRevenueMediationNetworkType mediationNetworkType; - switch (mediationNetworkInt){ - case 1: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob; - break; - case 2: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeIronSource; - break; - case 3: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeApplovinMax; - break; - case 4: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeFyber; - break; - case 5: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeAppodeal; - break; - case 6: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeAdmost; - break; - case 7: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeTopon; - break; - case 8: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeTradplus; - break; - case 9: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeYandex; - break; - case 10: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeChartBoost; - break; - case 11: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeUnity; - break; - case 12: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeToponPte; - break; - case 13: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeCustom; - break; - case 14: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeDirectMonetization; - break; - default: - mediationNetworkType = AppsFlyerAdRevenueMediationNetworkTypeCustom; - break; - } - - return mediationNetworkType; -} - -static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult){ - NSString* result; - switch (deepLinkResult){ - case AFSDKDeepLinkResultStatusFound: - result = @"FOUND"; - break; - case AFSDKDeepLinkResultStatusFailure: - result = @"ERROR"; - break; - case AFSDKDeepLinkResultStatusNotFound: - result = @"NOT_FOUND"; - break; - default: - result = @"ERROR"; - break; - } - - return result; -} - -static NSString* stringFromDeepLinkResultError(AppsFlyerDeepLinkResult *result){ - NSString* res; - - if (result && result.error){ - if ([[result.error userInfo][NSUnderlyingErrorKey] code] == -1001) { - res = @"TIMEOUT"; - } else if ([[result.error userInfo][NSUnderlyingErrorKey] code] == -1009) { - res = @"NETWORK"; - } - } - - res = @"UNKNOWN"; - - return res; -} diff --git a/Assets/AppsFlyer/Plugins/iOS/AppsFlyer+AppController.m b/Assets/AppsFlyer/Plugins/iOS/AppsFlyer+AppController.m deleted file mode 100644 index f877576..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AppsFlyer+AppController.m +++ /dev/null @@ -1,164 +0,0 @@ -// -// AppsFlyer+AppController.m -// Unity-iPhone -// -// Created by Jonathan Wesfield on 24/07/2019. -// - -#import -#import "UnityAppController.h" -#import "AppsFlyeriOSWrapper.h" -#if __has_include() -#import -#else -#import "AppsFlyerLib.h" -#endif - - -@implementation UnityAppController (AppsFlyerSwizzledAppController) - -static BOOL didEnteredBackGround __unused; -static IMP __original_applicationDidBecomeActive_Imp __unused; -static IMP __original_applicationDidEnterBackground_Imp __unused; -static IMP __original_didReceiveRemoteNotification_Imp __unused; -static IMP __original_continueUserActivity_Imp __unused; -static IMP __original_openUrl_Imp __unused; - - -+ (void)load { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - -#if !AFSDK_SHOULD_SWIZZLE - - id swizzleFlag = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AppsFlyerShouldSwizzle"]; - BOOL shouldSwizzle = swizzleFlag ? [swizzleFlag boolValue] : NO; - - if(shouldSwizzle){ - - Method method1 = class_getInstanceMethod([self class], @selector(applicationDidBecomeActive:)); - __original_applicationDidBecomeActive_Imp = method_setImplementation(method1, (IMP)__swizzled_applicationDidBecomeActive); - - Method method2 = class_getInstanceMethod([self class], @selector(applicationDidEnterBackground:)); - __original_applicationDidEnterBackground_Imp = method_setImplementation(method2, (IMP)__swizzled_applicationDidEnterBackground); - - - Method method3 = class_getInstanceMethod([self class], @selector(didReceiveRemoteNotification:)); - __original_didReceiveRemoteNotification_Imp = method_setImplementation(method3, (IMP)__swizzled_didReceiveRemoteNotification); - - - Method method4 = class_getInstanceMethod([self class], @selector(application:openURL:options:)); - __original_openUrl_Imp = method_setImplementation(method4, (IMP)__swizzled_openURL); - - if (_AppsFlyerdelegate == nil) { - _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; - } - - [self swizzleContinueUserActivity:[self class]]; - } -#elif AFSDK_SHOULD_SWIZZLE - Method method1 = class_getInstanceMethod([self class], @selector(applicationDidBecomeActive:)); - __original_applicationDidBecomeActive_Imp = method_setImplementation(method1, (IMP)__swizzled_applicationDidBecomeActive); - - Method method2 = class_getInstanceMethod([self class], @selector(applicationDidEnterBackground:)); - __original_applicationDidEnterBackground_Imp = method_setImplementation(method2, (IMP)__swizzled_applicationDidEnterBackground); - - - Method method3 = class_getInstanceMethod([self class], @selector(didReceiveRemoteNotification:)); - __original_didReceiveRemoteNotification_Imp = method_setImplementation(method3, (IMP)__swizzled_didReceiveRemoteNotification); - - - Method method4 = class_getInstanceMethod([self class], @selector(application:openURL:options:)); - __original_openUrl_Imp = method_setImplementation(method4, (IMP)__swizzled_openURL); - - if (_AppsFlyerdelegate == nil) { - _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; - } - - [self swizzleContinueUserActivity:[self class]]; - -#endif - - - }); -} - -+(void)swizzleContinueUserActivity:(Class)class { - - SEL originalSelector = @selector(application:continueUserActivity:restorationHandler:); - - Method defaultMethod = class_getInstanceMethod(class, originalSelector); - Method swizzledMethod = class_getInstanceMethod(class, @selector(__swizzled_continueUserActivity)); - - BOOL isMethodExists = !class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)); - - if (isMethodExists) { - __original_continueUserActivity_Imp = method_setImplementation(defaultMethod, (IMP)__swizzled_continueUserActivity); - } else { - class_replaceMethod(class, originalSelector, (IMP)__swizzled_continueUserActivity, method_getTypeEncoding(swizzledMethod)); - } -} - -BOOL __swizzled_continueUserActivity(id self, SEL _cmd, UIApplication* application, NSUserActivity* userActivity, void (^restorationHandler)(NSArray*)) { - NSLog(@"swizzled continueUserActivity"); - [[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler]; - - if(__original_continueUserActivity_Imp){ - return ((BOOL(*)(id, SEL, UIApplication*, NSUserActivity*, void (^)(NSArray*)))__original_continueUserActivity_Imp)(self, _cmd, application, userActivity, NULL); - } - - return YES; -} - - - -void __swizzled_applicationDidBecomeActive(id self, SEL _cmd, UIApplication* launchOptions) { - NSLog(@"swizzled applicationDidBecomeActive"); - [[AppsFlyerLib shared] setDelegate:_AppsFlyerdelegate]; - - if(didEnteredBackGround && AppsFlyeriOSWarpper.didCallStart == YES){ - [[AppsFlyerLib shared] start]; - } - - if(__original_applicationDidBecomeActive_Imp){ - ((void(*)(id,SEL, UIApplication*))__original_applicationDidBecomeActive_Imp)(self, _cmd, launchOptions); - } -} - - -void __swizzled_applicationDidEnterBackground(id self, SEL _cmd, UIApplication* application) { - NSLog(@"swizzled applicationDidEnterBackground"); - didEnteredBackGround = YES; - if(__original_applicationDidEnterBackground_Imp){ - ((void(*)(id,SEL, UIApplication*))__original_applicationDidEnterBackground_Imp)(self, _cmd, application); - } -} - - -BOOL __swizzled_didReceiveRemoteNotification(id self, SEL _cmd, UIApplication* application, NSDictionary* userInfo,void (^UIBackgroundFetchResult)(void) ) { - NSLog(@"swizzled didReceiveRemoteNotification"); - - [[AppsFlyerLib shared] handlePushNotification:userInfo]; - - if(__original_didReceiveRemoteNotification_Imp){ - return ((BOOL(*)(id, SEL, UIApplication*, NSDictionary*, int(UIBackgroundFetchResult)))__original_didReceiveRemoteNotification_Imp)(self, _cmd, application, userInfo, nil); - } - return YES; -} - - - -BOOL __swizzled_openURL(id self, SEL _cmd, UIApplication* application, NSURL* url, NSDictionary * options) { - NSLog(@"swizzled openURL"); - [[AppsFlyerAttribution shared] handleOpenUrl:url options:options]; - if(__original_openUrl_Imp){ - return ((BOOL(*)(id, SEL, UIApplication*, NSURL*, NSDictionary*))__original_openUrl_Imp)(self, _cmd, application, url, options); - } - return NO; -} - - -@end - - - diff --git a/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAppController.mm b/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAppController.mm deleted file mode 100644 index 3e492c0..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAppController.mm +++ /dev/null @@ -1,131 +0,0 @@ -// -// AppsFlyerAppController.mm -// Unity-iPhone -// -// Created by Jonathan Wesfield on 30/07/2019. -// - -#import -#import "UnityAppController.h" -#import "AppDelegateListener.h" -#import "AppsFlyeriOSWrapper.h" -#if __has_include() -#import -#else -#import "AppsFlyerLib.h" -#endif -#import - -/** - Note if you would like to use method swizzeling see AppsFlyer+AppController.m - If you are using swizzeling then comment out the method that is being swizzeled in AppsFlyerAppController.mm - Only use swizzeling if there are conflicts with other plugins that needs to be resolved. -*/ - - -@interface AppsFlyerAppController : UnityAppController -{ - BOOL didEnteredBackGround; -} -@end - -@implementation AppsFlyerAppController - -- (instancetype)init -{ - self = [super init]; - if (self) { - - id swizzleFlag = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AppsFlyerShouldSwizzle"]; - BOOL shouldSwizzle = swizzleFlag ? [swizzleFlag boolValue] : NO; - - if(!shouldSwizzle){ - UnityRegisterAppDelegateListener(self); - } - } - return self; -} - -- (void)didFinishLaunching:(NSNotification*)notification { - NSLog(@"got didFinishLaunching = %@",notification.userInfo); - - - if (_AppsFlyerdelegate == nil) { - _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; - } - [[AppsFlyerLib shared] setDelegate:_AppsFlyerdelegate]; - - if (notification.userInfo[@"url"]) { - [self onOpenURL:notification]; - } -} - --(void)didBecomeActive:(NSNotification*)notification { - NSLog(@"got didBecomeActive(out) = %@", notification.userInfo); - if (didEnteredBackGround == YES && AppsFlyeriOSWarpper.didCallStart == YES) { - [[AppsFlyerLib shared] start]; - didEnteredBackGround = NO; - } -} - -- (void)didEnterBackground:(NSNotification*)notification { - NSLog(@"got didEnterBackground = %@", notification.userInfo); - didEnteredBackGround = YES; -} - -- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler { - [[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler]; - return YES; -} - - -- (void)onOpenURL:(NSNotification*)notification { - NSLog(@"got onOpenURL = %@", notification.userInfo); - NSURL *url = notification.userInfo[@"url"]; - NSString *sourceApplication = notification.userInfo[@"sourceApplication"]; - - if (sourceApplication == nil) { - sourceApplication = @""; - } - - if (url != nil) { - [[AppsFlyerAttribution shared] handleOpenUrl:url sourceApplication:sourceApplication annotation:nil]; - } - -} - -- (void)didReceiveRemoteNotification:(NSNotification*)notification { - NSLog(@"got didReceiveRemoteNotification = %@", notification.userInfo); - [[AppsFlyerLib shared] handlePushNotification:notification.userInfo]; -} - -@end - -#if !(AFSDK_SHOULD_SWIZZLE) - -IMPL_APP_CONTROLLER_SUBCLASS(AppsFlyerAppController) - -#endif -/** -Note if you would not like to use IMPL_APP_CONTROLLER_SUBCLASS you can replace it with the code below. - - +(void)load - { - [AppsFlyerAppController plugin]; - } - - // Singleton accessor. - + (AppsFlyerAppController *)plugin - { - static AppsFlyerAppController *sharedInstance = nil; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - - sharedInstance = [[AppsFlyerAppController alloc] init]; - }); - - return sharedInstance; - } - - **/ diff --git a/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAttribution.h b/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAttribution.h deleted file mode 100644 index c79fec4..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAttribution.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// AppsFlyerAttribution.h -// UnityFramework -// -// Created by Margot Guetta on 11/04/2021. -// - -#ifndef AppsFlyerAttribution_h -#define AppsFlyerAttribution_h -#endif /* AppsFlyerAttribution_h */ -#if __has_include() -#import -#else -#import "AppsFlyerLib.h" -#endif - - -@interface AppsFlyerAttribution : NSObject -@property NSUserActivity*_Nullable userActivity; -@property (nonatomic, copy) void (^ _Nullable restorationHandler)(NSArray *_Nullable ); -@property NSURL * _Nullable url; -@property NSDictionary * _Nullable options; -@property NSString* _Nullable sourceApplication; -@property id _Nullable annotation; -@property BOOL isBridgeReady; - -+ (AppsFlyerAttribution *_Nullable)shared; -- (void) continueUserActivity: (NSUserActivity*_Nullable) userActivity restorationHandler: (void (^_Nullable)(NSArray * _Nullable))restorationHandler; -- (void) handleOpenUrl:(NSURL*_Nullable)url options:(NSDictionary*_Nullable) options; -- (void) handleOpenUrl: (NSURL *_Nonnull)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation; - -@end - -static NSString * _Nullable const AF_BRIDGE_SET = @"bridge is set"; diff --git a/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAttribution.m b/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAttribution.m deleted file mode 100644 index c4e7278..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AppsFlyerAttribution.m +++ /dev/null @@ -1,86 +0,0 @@ -// -// NSObject+AppsFlyerAttribution.m -// UnityFramework -// -// Created by Margot Guetta on 11/04/2021. -// - -#import -#import "AppsFlyerAttribution.h" - -@implementation AppsFlyerAttribution - -+ (id)shared { - static AppsFlyerAttribution *shared = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - shared = [[self alloc] init]; - }); - return shared; -} - -- (id)init { - if (self = [super init]) { - self.options = nil; - self.restorationHandler = nil; - self.url = nil; - self.userActivity = nil; - self.annotation = nil; - self.sourceApplication = nil; - self.isBridgeReady = NO; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(receiveBridgeReadyNotification:) - name:AF_BRIDGE_SET - object:nil]; - } - return self; -} - -- (void) continueUserActivity: (NSUserActivity*_Nullable) userActivity restorationHandler: (void (^_Nullable)(NSArray * _Nullable))restorationHandler{ - if(self.isBridgeReady == YES){ - [[AppsFlyerLib shared] continueUserActivity:userActivity restorationHandler:restorationHandler]; - }else{ - [AppsFlyerAttribution shared].userActivity = userActivity; - [AppsFlyerAttribution shared].restorationHandler = restorationHandler; - } -} - -- (void) handleOpenUrl:(NSURL *)url options:(NSDictionary *)options{ - if(self.isBridgeReady == YES){ - [[AppsFlyerLib shared] handleOpenUrl:url options:options]; - }else{ - [AppsFlyerAttribution shared].url = url; - [AppsFlyerAttribution shared].options = options; - } -} - -- (void) handleOpenUrl:(NSURL *)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation{ - if(self.isBridgeReady == YES){ - [[AppsFlyerLib shared] handleOpenURL:url sourceApplication:sourceApplication withAnnotation:annotation]; - }else{ - [AppsFlyerAttribution shared].url = url; - [AppsFlyerAttribution shared].sourceApplication = sourceApplication; - [AppsFlyerAttribution shared].annotation = annotation; - } - -} - -- (void) receiveBridgeReadyNotification:(NSNotification *) notification -{ - NSLog (@"AppsFlyer Debug: handle deep link"); - if(self.url && self.sourceApplication){ - [[AppsFlyerLib shared] handleOpenURL:self.url sourceApplication:self.sourceApplication withAnnotation:self.annotation]; - self.url = nil; - self.sourceApplication = nil; - self.annotation = nil; - }else if(self.options && self.url){ - [[AppsFlyerLib shared] handleOpenUrl:self.url options:self.options]; - self.options = nil; - self.url = nil; - }else if(self.userActivity){ - [[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:nil]; - self.userActivity = nil; - self.restorationHandler = nil; - } -} -@end diff --git a/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.h b/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.h deleted file mode 100644 index cf73afe..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.h +++ /dev/null @@ -1,71 +0,0 @@ -// -// AppsFlyeriOSWarpper.h -// Unity-iPhone -// -// Created by Jonathan Wesfield on 24/07/2019. -// - -#import "AFUnityUtils.mm" -#import "UnityAppController.h" -#import "AppsFlyerAttribution.h" -#if __has_include() -#import -#else -#import "AppsFlyerLib.h" -#endif -#if __has_include() -#import -#else -#import "PurchaseConnector.h" -#endif -#import - -// Add StoreKit 2 support -#if __has_include() -#import -#endif - -@interface AppsFlyeriOSWarpper : NSObject - -+ (BOOL) didCallStart; -+ (void) setDidCallStart:(BOOL)val; - -// Add StoreKit 2 methods -- (void)setStoreKitVersion:(int)storeKitVersion; -- (void)logConsumableTransaction:(id)transaction; - -@end - - -static AppsFlyeriOSWarpper *_AppsFlyerdelegate; -static const int kPushNotificationSize = 32; - -static NSString* ConversionDataCallbackObject = @"AppsFlyerObject"; - -static const char* VALIDATE_CALLBACK = "didFinishValidateReceipt"; -static const char* VALIDATE_ERROR_CALLBACK = "didFinishValidateReceiptWithError"; -static const char* GCD_CALLBACK = "onConversionDataSuccess"; -static const char* GCD_ERROR_CALLBACK = "onConversionDataFail"; -static const char* OAOA_CALLBACK = "onAppOpenAttribution"; -static const char* OAOA_ERROR_CALLBACK = "onAppOpenAttributionFailure"; -static const char* GENERATE_LINK_CALLBACK = "onInviteLinkGenerated"; -static const char* OPEN_STORE_LINK_CALLBACK = "onOpenStoreLinkGenerated"; -static const char* START_REQUEST_CALLBACK = "requestResponseReceived"; -static const char* IN_APP_RESPONSE_CALLBACK = "inAppResponseReceived"; -static const char* ON_DEEPLINKING = "onDeepLinking"; -static const char* VALIDATE_AND_LOG_V2_CALLBACK = "onValidateAndLogComplete"; -static const char* VALIDATE_AND_LOG_V2_ERROR_CALLBACK = "onValidateAndLogFailure"; - - -static NSString* validateObjectName = @""; -static NSString* openStoreObjectName = @""; -static NSString* generateInviteObjectName = @""; -static NSString* validateAndLogObjectName = @""; -static NSString* startRequestObjectName = @""; -static NSString* inAppRequestObjectName = @""; -static NSString* onDeeplinkingObjectName = @""; - -static const char* PURCHASE_REVENUE_VALIDATION_CALLBACK = "didReceivePurchaseRevenueValidationInfo"; -static const char* PURCHASE_REVENUE_ERROR_CALLBACK = "didReceivePurchaseRevenueError"; - -static NSString* onPurchaseValidationObjectName = @""; diff --git a/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm b/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm deleted file mode 100644 index 34153d2..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm +++ /dev/null @@ -1,601 +0,0 @@ -// -// AppsFlyeriOSWarpper.mm -// Unity-iPhone -// -// Created by Jonathan Wesfield on 24/07/2019. -// - -#import "AppsFlyeriOSWrapper.h" -#import - -#import -#import "UnityFramework/UnityFramework-Swift.h" - -#if __has_include() -#import -#elif __has_include("PurchaseConnector-Swift.h") -#import "PurchaseConnector-Swift.h" -#endif - -#if __has_include() -#import -#elif __has_include("UnityFramework-Swift.h") -#import "UnityFramework-Swift.h" -#endif - -static void unityCallBack(NSString* objectName, const char* method, const char* msg) { - if(objectName){ - UnitySendMessage([objectName UTF8String], method, msg); - } -} - -extern "C" { - - const void _startSDK(bool shouldCallback, const char* objectName) { - [[AppsFlyerLib shared] setPluginInfoWith: AFSDKPluginUnity - pluginVersion:@"6.17.91" - additionalParams:nil]; - startRequestObjectName = stringFromChar(objectName); - AppsFlyeriOSWarpper.didCallStart = YES; - [AppsFlyerAttribution shared].isBridgeReady = YES; - [[NSNotificationCenter defaultCenter] postNotificationName:AF_BRIDGE_SET object: [AppsFlyerAttribution shared]]; - [[AppsFlyerLib shared] startWithCompletionHandler:^(NSDictionary *dictionary, NSError *error) { - if(shouldCallback){ - if (error) { - NSDictionary *callbackDictionary = @{@"statusCode":[NSNumber numberWithLong:[error code]]}; - unityCallBack(startRequestObjectName, START_REQUEST_CALLBACK, stringFromdictionary(callbackDictionary)); - return; - } - if (dictionary) { - unityCallBack(startRequestObjectName, START_REQUEST_CALLBACK, stringFromdictionary(dictionary)); - return; - } - } - }]; - } - - const void _setCustomerUserID (const char* customerUserID) { - [[AppsFlyerLib shared] setCustomerUserID:stringFromChar(customerUserID)]; - } - - const void _setAdditionalData (const char* customData) { - [[AppsFlyerLib shared] setAdditionalData:dictionaryFromJson(customData)]; - } - - const void _setAppsFlyerDevKey (const char* appsFlyerDevKey) { - [AppsFlyerLib shared].appsFlyerDevKey = stringFromChar(appsFlyerDevKey); - } - - const void _setAppleAppID (const char* appleAppID) { - [AppsFlyerLib shared].appleAppID = stringFromChar(appleAppID); - } - - const void _setCurrencyCode (const char* currencyCode) { - [[AppsFlyerLib shared] setCurrencyCode:stringFromChar(currencyCode)]; - } - - const void _setDisableCollectAppleAdSupport (bool disableAdvertisingIdentifier) { - [AppsFlyerLib shared].disableAdvertisingIdentifier = disableAdvertisingIdentifier; - } - - const void _setIsDebug (bool isDebug) { - [AppsFlyerLib shared].isDebug = isDebug; - } - - const void _setShouldCollectDeviceName (bool shouldCollectDeviceName) { - [AppsFlyerLib shared].shouldCollectDeviceName = shouldCollectDeviceName; - } - - const void _setAppInviteOneLinkID (const char* appInviteOneLinkID) { - [[AppsFlyerLib shared] setAppInviteOneLink:stringFromChar(appInviteOneLinkID)]; - } - - const void _setDeepLinkTimeout (long deepLinkTimeout) { - [AppsFlyerLib shared].deepLinkTimeout = deepLinkTimeout; - } - - const void _anonymizeUser (bool anonymizeUser) { - [AppsFlyerLib shared].anonymizeUser = anonymizeUser; - } - - const void _enableTCFDataCollection (bool shouldCollectTcfData) { - [[AppsFlyerLib shared] enableTCFDataCollection:shouldCollectTcfData]; - } - - const void _setConsentData(const char* isUserSubjectToGDPR, const char* hasConsentForDataUsage, const char* hasConsentForAdsPersonalization, const char* hasConsentForAdStorage) { - - NSNumber *gdpr = intFromNullableBool(isUserSubjectToGDPR); - NSNumber *dataUsage = intFromNullableBool(hasConsentForDataUsage); - NSNumber *adsPersonalization = intFromNullableBool(hasConsentForAdsPersonalization); - NSNumber *adStorage = intFromNullableBool(hasConsentForAdStorage); - - AppsFlyerConsent *consentData = [[AppsFlyerConsent alloc] initWithIsUserSubjectToGDPR:gdpr - hasConsentForDataUsage:dataUsage - hasConsentForAdsPersonalization:adsPersonalization - hasConsentForAdStorage:adStorage]; - - [[AppsFlyerLib shared] setConsentData:consentData]; - } - - const void _logAdRevenue(const char* monetizationNetwork, int mediationNetworkInt, const char* currencyIso4217Code, double eventRevenue, const char* additionalParameters) { - AppsFlyerAdRevenueMediationNetworkType mediationNetwork = mediationNetworkTypeFromInt(mediationNetworkInt); - NSNumber *number = [NSNumber numberWithDouble:eventRevenue]; - AFAdRevenueData *adRevenue = [[AFAdRevenueData alloc] initWithMonetizationNetwork:stringFromChar(monetizationNetwork) mediationNetwork:mediationNetwork currencyIso4217Code:stringFromChar(currencyIso4217Code) eventRevenue:number]; - [[AppsFlyerLib shared] logAdRevenue: adRevenue additionalParameters:dictionaryFromJson(additionalParameters)]; - } - - const void _setDisableCollectIAd (bool disableCollectASA) { - [AppsFlyerLib shared].disableCollectASA = disableCollectASA; - } - - const void _setUseReceiptValidationSandbox (bool useReceiptValidationSandbox) { - [AppsFlyerLib shared].useReceiptValidationSandbox = useReceiptValidationSandbox; - } - - const void _setUseUninstallSandbox (bool useUninstallSandbox) { - [AppsFlyerLib shared].useUninstallSandbox = useUninstallSandbox; - } - - const void _setResolveDeepLinkURLs (int length, const char **resolveDeepLinkURLs) { - if(length > 0 && resolveDeepLinkURLs) { - [[AppsFlyerLib shared] setResolveDeepLinkURLs:NSArrayFromCArray(length, resolveDeepLinkURLs)]; - } - } - - const void _setOneLinkCustomDomains (int length, const char **oneLinkCustomDomains) { - if(length > 0 && oneLinkCustomDomains) { - [[AppsFlyerLib shared] setOneLinkCustomDomains:NSArrayFromCArray(length, oneLinkCustomDomains)]; - } - } - - const void _afSendEvent (const char* eventName, const char* eventValues, bool shouldCallback, const char* objectName) { - inAppRequestObjectName = stringFromChar(objectName); - [[AppsFlyerLib shared] logEventWithEventName:stringFromChar(eventName) eventValues:dictionaryFromJson(eventValues) completionHandler:^(NSDictionary *dictionary, NSError *error) { - if(shouldCallback){ - if (error) { - NSDictionary *callbackDictionary = @{@"statusCode":[NSNumber numberWithLong:[error code]]}; - unityCallBack(inAppRequestObjectName, IN_APP_RESPONSE_CALLBACK, stringFromdictionary(callbackDictionary)); - return; - } - if (dictionary) { - unityCallBack(inAppRequestObjectName, IN_APP_RESPONSE_CALLBACK, stringFromdictionary(dictionary)); - return; - } - } - }]; - } - - const void _recordLocation (double longitude, double latitude) { - [[AppsFlyerLib shared] logLocation:longitude latitude:latitude]; - } - - const char* _getAppsFlyerId () { - return getCString([[[AppsFlyerLib shared] getAppsFlyerUID] UTF8String]); - } - - const void _registerUninstall (unsigned char* deviceToken) { - if(deviceToken){ - NSData* tokenData = [NSData dataWithBytes:(const void *)deviceToken length:sizeof(unsigned char)*kPushNotificationSize]; - [[AppsFlyerLib shared] registerUninstall:tokenData]; - } - } - - const void _handlePushNotification (const char* pushPayload) { - [[AppsFlyerLib shared] handlePushNotification:dictionaryFromJson(pushPayload)]; - } - - const char* _getSDKVersion () { - return getCString([[[AppsFlyerLib shared] getSDKVersion] UTF8String]); - } - - const void _setHost (const char* host, const char* hostPrefix) { - [[AppsFlyerLib shared] setHost:stringFromChar(host) withHostPrefix:stringFromChar(hostPrefix)]; - } - - const void _setMinTimeBetweenSessions (int minTimeBetweenSessions) { - [AppsFlyerLib shared].minTimeBetweenSessions = minTimeBetweenSessions; - } - - const void _stopSDK (bool isStopped) { - [AppsFlyerLib shared].isStopped = isStopped; - } - - const BOOL _isSDKStopped () { - return [AppsFlyerLib shared].isStopped; - } - - const void _handleOpenUrl(const char *url, const char *sourceApplication, const char *annotation) { - [[AppsFlyerLib shared] handleOpenURL:[NSURL URLWithString:stringFromChar(url)] sourceApplication:stringFromChar(sourceApplication) withAnnotation:stringFromChar(annotation)]; } - - const void _recordCrossPromoteImpression (const char* appID, const char* campaign, const char* parameters) { - [AppsFlyerCrossPromotionHelper logCrossPromoteImpression:stringFromChar(appID) campaign:stringFromChar(campaign) parameters:dictionaryFromJson(parameters)]; } - - const void _attributeAndOpenStore (const char* appID, const char* campaign, const char* parameters, const char* objectName) { - - openStoreObjectName = stringFromChar(objectName); - - [AppsFlyerCrossPromotionHelper - logAndOpenStore:stringFromChar(appID) - campaign:stringFromChar(campaign) - parameters:dictionaryFromJson(parameters) - openStore:^(NSURLSession * _Nonnull urlSession, NSURL * _Nonnull clickURL) { - unityCallBack(openStoreObjectName, OPEN_STORE_LINK_CALLBACK, [clickURL.absoluteString UTF8String]); - }]; - } - - const void _generateUserInviteLink (const char* parameters, const char* objectName) { - - generateInviteObjectName = stringFromChar(objectName); - - [AppsFlyerShareInviteHelper generateInviteUrlWithLinkGenerator:^AppsFlyerLinkGenerator * _Nonnull(AppsFlyerLinkGenerator * _Nonnull generator) { - return generatorFromDictionary(dictionaryFromJson(parameters), generator); - } completionHandler:^(NSURL * _Nullable url) { - unityCallBack(generateInviteObjectName, GENERATE_LINK_CALLBACK, [url.absoluteString UTF8String]); - }]; - } - - const void _recordInvite (const char* channel, const char* parameters) { - [AppsFlyerShareInviteHelper logInvite:stringFromChar(channel) parameters:dictionaryFromJson(parameters)]; - } - - const void _setUserEmails (int emailCryptTypeInt , int length, const char **userEmails) { - if(length > 0 && userEmails) { - [[AppsFlyerLib shared] setUserEmails:NSArrayFromCArray(length, userEmails) withCryptType:emailCryptTypeFromInt(emailCryptTypeInt)]; - } - } - - const void _setPhoneNumber (const char* phoneNumber) { - [[AppsFlyerLib shared] setPhoneNumber:stringFromChar(phoneNumber)]; - } - - const void _setSharingFilterForAllPartners () { - [[AppsFlyerLib shared] setSharingFilterForAllPartners]; - } - - const void _setSharingFilter (int length, const char **partners) { - if(length > 0 && partners) { - [[AppsFlyerLib shared] setSharingFilter:NSArrayFromCArray(length, partners)]; - } - } - - const void _setSharingFilterForPartners (int length, const char **partners) { - if(length > 0 && partners) { - [[AppsFlyerLib shared] setSharingFilterForPartners:NSArrayFromCArray(length, partners)]; - } else { - [[AppsFlyerLib shared] setSharingFilterForPartners:nil]; - } - } - - const void _validateAndSendInAppPurchase (const char* productIdentifier, const char* price, const char* currency, const char* transactionId, const char* additionalParameters, const char* objectName) { - - validateObjectName = stringFromChar(objectName); - - [[AppsFlyerLib shared] - validateAndLogInAppPurchase:stringFromChar(productIdentifier) - price:stringFromChar(price) - currency:stringFromChar(currency) - transactionId:stringFromChar(transactionId) - additionalParameters:dictionaryFromJson(additionalParameters) - success:^(NSDictionary *result){ - unityCallBack(validateObjectName, VALIDATE_CALLBACK, stringFromdictionary(result)); - } failure:^(NSError *error, id response) { - if(response && [response isKindOfClass:[NSDictionary class]]) { - NSDictionary* value = (NSDictionary*)response; - unityCallBack(validateObjectName, VALIDATE_ERROR_CALLBACK, stringFromdictionary(value)); - } else { - unityCallBack(validateObjectName, VALIDATE_ERROR_CALLBACK, error ? [[error localizedDescription] UTF8String] : "error"); - } - }]; - } - - const void _validateAndSendInAppPurchaseV2 (const char* product, const char* transactionId, int purchaseType, const char* purchaseAdditionalDetails, const char* objectName) { - - validateAndLogObjectName = stringFromChar(objectName); - AFSDKPurchaseDetails *details = [[AFSDKPurchaseDetails alloc] initWithProductId:stringFromChar(product) transactionId:stringFromChar(transactionId) purchaseType:(AFSDKPurchaseType)purchaseType]; - - [[AppsFlyerLib shared] - validateAndLogInAppPurchase:details - purchaseAdditionalDetails:dictionaryFromJson(purchaseAdditionalDetails) - completion:^(NSDictionary * _Nullable response, NSError * _Nullable error) { - if (error) { - unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_ERROR_CALLBACK, stringFromdictionary(dictionaryFromNSError(error))); - } else { - unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_CALLBACK, stringFromdictionary(response)); - } - }]; - - } - - const void _getConversionData(const char* objectName) { - if (_AppsFlyerdelegate == nil) { - _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; - } - ConversionDataCallbackObject = stringFromChar(objectName); - [[AppsFlyerLib shared] setDelegate:_AppsFlyerdelegate]; - } - - const void _waitForATTUserAuthorizationWithTimeoutInterval (int timeoutInterval) { - [[AppsFlyerLib shared] waitForATTUserAuthorizationWithTimeoutInterval:timeoutInterval]; - } - - const void _disableSKAdNetwork (bool isDisabled) { - [AppsFlyerLib shared].disableSKAdNetwork = isDisabled; - } - - const void _addPushNotificationDeepLinkPath (int length, const char **paths) { - if(length > 0 && paths) { - [[AppsFlyerLib shared] addPushNotificationDeepLinkPath:NSArrayFromCArray(length, paths)]; - } - } - - const void _subscribeForDeepLink (const char* objectName) { - - onDeeplinkingObjectName = stringFromChar(objectName); - - if (_AppsFlyerdelegate == nil) { - _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; - } - [[AppsFlyerLib shared] setDeepLinkDelegate:_AppsFlyerdelegate]; - } - - const void _setCurrentDeviceLanguage(const char* language) { - [[AppsFlyerLib shared] setCurrentDeviceLanguage:stringFromChar(language)]; - } - - const void _setPartnerData(const char* partnerId, const char* partnerInfo) { - [[AppsFlyerLib shared] setPartnerDataWithPartnerId: stringFromChar(partnerId) partnerInfo:dictionaryFromJson(partnerInfo)]; - } - - const void _disableIDFVCollection(bool isDisabled) { - [AppsFlyerLib shared].disableIDFVCollection = isDisabled; - } - - // Purchase connector - const void _startObservingTransactions() { - [[PurchaseConnector shared] startObservingTransactions]; - } - - const void _stopObservingTransactions() { - [[PurchaseConnector shared] stopObservingTransactions]; - } - - const void _setIsSandbox(bool isSandBox) { - [[PurchaseConnector shared] setIsSandbox:isSandBox]; - } - - const void _setPurchaseRevenueDelegate() { - if (_AppsFlyerdelegate== nil) { - _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; - } - [[PurchaseConnector shared] setPurchaseRevenueDelegate:_AppsFlyerdelegate]; - } - - const void _setAutoLogPurchaseRevenue(int option) { - [[PurchaseConnector shared] setAutoLogPurchaseRevenue:option]; - - } - - const void _initPurchaseConnector(const char* objectName) { - if (_AppsFlyerdelegate == nil) { - _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; - } - onPurchaseValidationObjectName = stringFromChar(objectName); - } - - const void _setPurchaseRevenueDataSource(const char* objectName) { - if (_AppsFlyerdelegate == nil) { - _AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init]; - } - - if (strstr(objectName, "StoreKit2") != NULL) { - - // Force protocol conformance - Protocol *sk2Protocol = @protocol(AppsFlyerPurchaseRevenueDataSourceStoreKit2); - class_addProtocol([_AppsFlyerdelegate class], sk2Protocol); - - if (![_AppsFlyerdelegate conformsToProtocol:@protocol(AppsFlyerPurchaseRevenueDataSourceStoreKit2)]) { - NSLog(@"[AppsFlyer] Warning: SK2 protocol not conformed!"); - } - } - - [PurchaseConnector shared].purchaseRevenueDataSource = _AppsFlyerdelegate; - } - - const void _setStoreKitVersion(int storeKitVersion) { - [[PurchaseConnector shared] setStoreKitVersion:(AFSDKStoreKitVersion)storeKitVersion]; - } - - const void _logConsumableTransaction(const char* transactionId) { - if (@available(iOS 15.0, *)) { - NSString *transactionIdStr = [NSString stringWithUTF8String:transactionId]; - [AFUnityStoreKit2Bridge fetchAFSDKTransactionSK2WithTransactionId:transactionIdStr completion:^(AFSDKTransactionSK2 *afTransaction) { - if (afTransaction) { - [[PurchaseConnector shared] logConsumableTransaction:afTransaction]; - } else { - NSLog(@"No AFSDKTransactionSK2 found for id %@", transactionIdStr); - } - }]; - } - } - - #ifdef __cplusplus - extern "C" { - #endif - - typedef const char *(*UnityPurchaseCallback)(const char *, const char *); - - UnityPurchaseCallback UnityPurchasesGetAdditionalParamsCallback = NULL; - UnityPurchaseCallback UnityPurchasesGetAdditionalParamsCallbackSK2 = NULL; - - __attribute__((visibility("default"))) - void RegisterUnityPurchaseRevenueParamsCallback(UnityPurchaseCallback callback) { - UnityPurchasesGetAdditionalParamsCallback = callback; - } - - __attribute__((visibility("default"))) - void RegisterUnityPurchaseRevenueParamsCallbackSK2(UnityPurchaseCallback callback) { - UnityPurchasesGetAdditionalParamsCallbackSK2 = callback; - } - - - #ifdef __cplusplus - } - #endif -} - -@implementation AppsFlyeriOSWarpper - -static BOOL didCallStart; -+ (BOOL) didCallStart -{ @synchronized(self) { return didCallStart; } } -+ (void) setDidCallStart:(BOOL)val -{ @synchronized(self) { didCallStart = val; } } - -- (void)onConversionDataSuccess:(NSDictionary *)installData { - unityCallBack(ConversionDataCallbackObject, GCD_CALLBACK, stringFromdictionary(installData)); -} - -- (void)onConversionDataFail:(NSError *)error { - unityCallBack(ConversionDataCallbackObject, GCD_ERROR_CALLBACK, [[error localizedDescription] UTF8String]); -} - -- (void)onAppOpenAttribution:(NSDictionary *)attributionData { - unityCallBack(ConversionDataCallbackObject, OAOA_CALLBACK, stringFromdictionary(attributionData)); -} - -- (void)onAppOpenAttributionFailure:(NSError *)error { - unityCallBack(ConversionDataCallbackObject, OAOA_ERROR_CALLBACK, [[error localizedDescription] UTF8String]); -} - -- (void)didResolveDeepLink:(AppsFlyerDeepLinkResult *)result{ - - NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; - - [dict setValue:stringFromDeepLinkResultError(result) forKey:@"error"]; - [dict setValue:stringFromDeepLinkResultStatus(result.status) forKey:@"status"]; - - if(result && result.deepLink){ - [dict setValue:result.deepLink.description forKey:@"deepLink"]; - [dict setValue:@(result.deepLink.isDeferred) forKey:@"is_deferred"]; - } - - unityCallBack(onDeeplinkingObjectName, ON_DEEPLINKING, stringFromdictionary(dict)); -} - -// Purchase Connector -- (void)didReceivePurchaseRevenueValidationInfo:(NSDictionary *)validationInfo error:(NSError *)error { - if (error != nil) { - unityCallBack(onPurchaseValidationObjectName, PURCHASE_REVENUE_ERROR_CALLBACK, [[error localizedDescription] UTF8String]); - } else { - unityCallBack(onPurchaseValidationObjectName, PURCHASE_REVENUE_VALIDATION_CALLBACK, stringFromdictionary(validationInfo)); - } -} - -- (NSDictionary *)purchaseRevenueAdditionalParametersForProducts:(NSSet *)products - transactions:(NSSet *)transactions { - - NSMutableArray *productsArray = [NSMutableArray array]; - for (SKProduct *product in products) { - [productsArray addObject:@{ - @"productIdentifier": product.productIdentifier ?: @"", - @"localizedTitle": product.localizedTitle ?: @"", - @"localizedDescription": product.localizedDescription ?: @"", - @"price": [product.price stringValue] ?: @"" - }]; - } - - NSMutableArray *transactionsArray = [NSMutableArray array]; - for (SKPaymentTransaction *txn in transactions) { - [transactionsArray addObject:@{ - @"transactionIdentifier": txn.transactionIdentifier ?: @"", - @"transactionState": @(txn.transactionState), - @"transactionDate": txn.transactionDate ? [@(txn.transactionDate.timeIntervalSince1970) stringValue] : @"" - }]; - } - - NSDictionary *input = @{ - @"products": productsArray, - @"transactions": transactionsArray - }; - - NSError *error = nil; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:input options:0 error:&error]; - if (error || !jsonData) { - NSLog(@"[AppsFlyer] Failed to serialize Unity purchase data: %@", error); - return @{}; - } - - NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - if (!jsonString || !UnityPurchasesGetAdditionalParamsCallback) { - NSLog(@"[AppsFlyer] Unity callback not registered"); - return @{}; - } - - const char *resultCStr = UnityPurchasesGetAdditionalParamsCallback([jsonString UTF8String], ""); - if (!resultCStr) { - NSLog(@"[AppsFlyer] Unity callback returned null"); - return @{}; - } - - NSString *resultJson = [NSString stringWithUTF8String:resultCStr]; - NSData *resultData = [resultJson dataUsingEncoding:NSUTF8StringEncoding]; - NSDictionary *parsedResult = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&error]; - - if (error || ![parsedResult isKindOfClass:[NSDictionary class]]) { - NSLog(@"[AppsFlyer] Failed to parse Unity response: %@", error); - return @{}; - } - - return parsedResult; -} - -#pragma mark - AppsFlyerPurchaseRevenueDataSourceStoreKit2 -- (NSDictionary *)purchaseRevenueAdditionalParametersStoreKit2ForProducts:(NSSet *)products transactions:(NSSet *)transactions { - if (@available(iOS 15.0, *)) { - NSArray *productInfoArray = [AFUnityStoreKit2Bridge extractSK2ProductInfo:[products allObjects]]; - NSArray *transactionInfoArray = [AFUnityStoreKit2Bridge extractSK2TransactionInfo:[transactions allObjects]]; - - NSDictionary *input = @{ - @"products": productInfoArray, - @"transactions": transactionInfoArray - }; - - if (UnityPurchasesGetAdditionalParamsCallbackSK2) { - NSError *error = nil; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:input options:0 error:&error]; - if (error || !jsonData) { - NSLog(@"[AppsFlyer] Failed to serialize Unity purchase data: %@", error); - return @{}; - } - - NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - - const char *resultCStr = UnityPurchasesGetAdditionalParamsCallbackSK2([jsonString UTF8String], ""); - if (!resultCStr) { - NSLog(@"[AppsFlyer] Unity callback returned null"); - return @{}; - } - - NSString *resultJson = [NSString stringWithUTF8String:resultCStr]; - - NSData *resultData = [resultJson dataUsingEncoding:NSUTF8StringEncoding]; - NSDictionary *parsedResult = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&error]; - - if (error || ![parsedResult isKindOfClass:[NSDictionary class]]) { - NSLog(@"[AppsFlyer] Failed to parse Unity response: %@", error); - return @{}; - } - - return parsedResult; - } else { - NSLog(@"[AppsFlyer] SK2 - Unity callback is NOT registered"); - } - } else { - NSLog(@"[AppsFlyer] SK2 - iOS version not supported"); - } - return @{}; -} - -@end - - diff --git a/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm.meta b/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm.meta deleted file mode 100644 index 3799161..0000000 --- a/Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm.meta +++ /dev/null @@ -1,37 +0,0 @@ -fileFormatVersion: 2 -guid: 2bff3788f3d8747fe9679bd3818e1d76 -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: {} - - first: - tvOS: tvOS - second: - enabled: 1 - settings: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AppsFlyer/Windows/AppsFlyerWindows.cs b/Assets/AppsFlyer/Windows/AppsFlyerWindows.cs old mode 100644 new mode 100755 index a44fea4..8fd696f --- a/Assets/AppsFlyer/Windows/AppsFlyerWindows.cs +++ b/Assets/AppsFlyer/Windows/AppsFlyerWindows.cs @@ -1,145 +1,145 @@ -//#define AFSDK_WIN_DEBUG -//#define UNITY_WSA_10_0 -//#define ENABLE_WINMD_SUPPORT - -#if UNITY_WSA_10_0 -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using System.ComponentModel; -using UnityEngine; -using System.Threading.Tasks; - -#if ENABLE_WINMD_SUPPORT -using AppsFlyerLib; -#endif - -namespace AppsFlyerSDK -{ - public class AppsFlyerWindows - { -#if ENABLE_WINMD_SUPPORT - static private MonoBehaviour _gameObject = null; -#endif - - public static void InitSDK(string devKey, string appId, MonoBehaviour gameObject) - { -#if ENABLE_WINMD_SUPPORT - -#if AFSDK_WIN_DEBUG - // Remove callstack - Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None); -#endif - Log("[InitSDK]: devKey: {0}, appId: {1}, gameObject: {2}", devKey, appId, gameObject == null ? "null" : gameObject.ToString()); - AppsFlyerTracker tracker = AppsFlyerTracker.GetAppsFlyerTracker(); - tracker.devKey = devKey; - tracker.appId = appId; - // Interface - _gameObject = gameObject; -#endif - } - - public static string GetAppsFlyerId() - { -#if ENABLE_WINMD_SUPPORT - Log("[GetAppsFlyerId]"); - return AppsFlyerTracker.GetAppsFlyerTracker().GetAppsFlyerUID(); -#else - return ""; -#endif - } - - public static void SetCustomerUserId(string customerUserId) - { -#if ENABLE_WINMD_SUPPORT - Log("[SetCustomerUserId] customerUserId: {0}", customerUserId); - if (customerUserId.Contains("test_device:")) - { - string testDeviceId = customerUserId.Substring(12); - AppsFlyerTracker.GetAppsFlyerTracker().testDeviceId = testDeviceId; - } - AppsFlyerTracker.GetAppsFlyerTracker().customerUserId = customerUserId; -#endif - } - - public static void Start() - { -#if ENABLE_WINMD_SUPPORT - Log("[Start]"); - AppsFlyerTracker.GetAppsFlyerTracker().TrackAppLaunchAsync(Callback); -#endif - } - -#if ENABLE_WINMD_SUPPORT - public static void Callback(AppsFlyerLib.ServerStatusCode code) - { - Log("[Callback]: {0}", code.ToString()); - - AppsFlyerRequestEventArgs eventArgs = new AppsFlyerRequestEventArgs((int)code, code.ToString()); - if (_gameObject != null) { - var method = _gameObject.GetType().GetMethod("AppsFlyerOnRequestResponse"); - if (method != null) { - method.Invoke(_gameObject, new object[] { AppsFlyerTracker.GetAppsFlyerTracker(), eventArgs }); - } - } - } -#endif - - public static void LogEvent(string eventName, Dictionary eventValues) - { -#if ENABLE_WINMD_SUPPORT - if (eventValues == null) - { - eventValues = new Dictionary(); - } - IDictionary result = new Dictionary(); - foreach (KeyValuePair kvp in eventValues) - { - result.Add(kvp.Key.ToString(), kvp.Value); - } - - Log("[LogEvent]: eventName: {0} result: {1}", eventName, result.ToString()); - - AppsFlyerTracker tracker = AppsFlyerTracker.GetAppsFlyerTracker(); - tracker.TrackEvent(eventName, result); - -#endif - } - - - public static void GetConversionData(string _reserved) - { -#if ENABLE_WINMD_SUPPORT - Task.Run(async () => - { - AppsFlyerLib.AppsFlyerTracker tracker = AppsFlyerLib.AppsFlyerTracker.GetAppsFlyerTracker(); - string conversionData = await tracker.GetConversionDataAsync(); - - IAppsFlyerConversionData conversionDataHandler = _gameObject as IAppsFlyerConversionData; - - if (conversionDataHandler != null) - { - Log("[GetConversionData] Will call `onConversionDataSuccess` with: {0}", conversionData); - conversionDataHandler.onConversionDataSuccess(conversionData); - } else { - Log("[GetConversionData] Object with `IAppsFlyerConversionData` interface not found! Check `InitSDK` implementation"); - } - // _gameObject.GetType().GetMethod("onConversionDataSuccess").Invoke(_gameObject, new[] { conversionData }); - }); -#endif - } - - private static void Log(string format, params string[] args) - { -#if AFSDK_WIN_DEBUG -#if ENABLE_WINMD_SUPPORT - Debug.Log("AF_UNITY_WSA_10_0" + String.Format(format, args)); -#endif -#endif - } - - } - -} -#endif +//#define AFSDK_WIN_DEBUG +//#define UNITY_WSA_10_0 +//#define ENABLE_WINMD_SUPPORT + +#if UNITY_WSA_10_0 +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using System.ComponentModel; +using UnityEngine; +using System.Threading.Tasks; + +#if ENABLE_WINMD_SUPPORT +using AppsFlyerLib; +#endif + +namespace AppsFlyerSDK +{ + public class AppsFlyerWindows + { +#if ENABLE_WINMD_SUPPORT + static private MonoBehaviour _gameObject = null; +#endif + + public static void InitSDK(string devKey, string appId, MonoBehaviour gameObject) + { +#if ENABLE_WINMD_SUPPORT + +#if AFSDK_WIN_DEBUG + // Remove callstack + Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None); +#endif + Log("[InitSDK]: devKey: {0}, appId: {1}, gameObject: {2}", devKey, appId, gameObject == null ? "null" : gameObject.ToString()); + AppsFlyerTracker tracker = AppsFlyerTracker.GetAppsFlyerTracker(); + tracker.devKey = devKey; + tracker.appId = appId; + // Interface + _gameObject = gameObject; +#endif + } + + public static string GetAppsFlyerId() + { +#if ENABLE_WINMD_SUPPORT + Log("[GetAppsFlyerId]"); + return AppsFlyerTracker.GetAppsFlyerTracker().GetAppsFlyerUID(); +#else + return ""; +#endif + } + + public static void SetCustomerUserId(string customerUserId) + { +#if ENABLE_WINMD_SUPPORT + Log("[SetCustomerUserId] customerUserId: {0}", customerUserId); + if (customerUserId.Contains("test_device:")) + { + string testDeviceId = customerUserId.Substring(12); + AppsFlyerTracker.GetAppsFlyerTracker().testDeviceId = testDeviceId; + } + AppsFlyerTracker.GetAppsFlyerTracker().customerUserId = customerUserId; +#endif + } + + public static void Start() + { +#if ENABLE_WINMD_SUPPORT + Log("[Start]"); + AppsFlyerTracker.GetAppsFlyerTracker().TrackAppLaunchAsync(Callback); +#endif + } + +#if ENABLE_WINMD_SUPPORT + public static void Callback(AppsFlyerLib.ServerStatusCode code) + { + Log("[Callback]: {0}", code.ToString()); + + AppsFlyerRequestEventArgs eventArgs = new AppsFlyerRequestEventArgs((int)code, code.ToString()); + if (_gameObject != null) { + var method = _gameObject.GetType().GetMethod("AppsFlyerOnRequestResponse"); + if (method != null) { + method.Invoke(_gameObject, new object[] { AppsFlyerTracker.GetAppsFlyerTracker(), eventArgs }); + } + } + } +#endif + + public static void LogEvent(string eventName, Dictionary eventValues) + { +#if ENABLE_WINMD_SUPPORT + if (eventValues == null) + { + eventValues = new Dictionary(); + } + IDictionary result = new Dictionary(); + foreach (KeyValuePair kvp in eventValues) + { + result.Add(kvp.Key.ToString(), kvp.Value); + } + + Log("[LogEvent]: eventName: {0} result: {1}", eventName, result.ToString()); + + AppsFlyerTracker tracker = AppsFlyerTracker.GetAppsFlyerTracker(); + tracker.TrackEvent(eventName, result); + +#endif + } + + + public static void GetConversionData(string _reserved) + { +#if ENABLE_WINMD_SUPPORT + Task.Run(async () => + { + AppsFlyerLib.AppsFlyerTracker tracker = AppsFlyerLib.AppsFlyerTracker.GetAppsFlyerTracker(); + string conversionData = await tracker.GetConversionDataAsync(); + + IAppsFlyerConversionData conversionDataHandler = _gameObject as IAppsFlyerConversionData; + + if (conversionDataHandler != null) + { + Log("[GetConversionData] Will call `onConversionDataSuccess` with: {0}", conversionData); + conversionDataHandler.onConversionDataSuccess(conversionData); + } else { + Log("[GetConversionData] Object with `IAppsFlyerConversionData` interface not found! Check `InitSDK` implementation"); + } + // _gameObject.GetType().GetMethod("onConversionDataSuccess").Invoke(_gameObject, new[] { conversionData }); + }); +#endif + } + + private static void Log(string format, params string[] args) + { +#if AFSDK_WIN_DEBUG +#if ENABLE_WINMD_SUPPORT + Debug.Log("AF_UNITY_WSA_10_0" + String.Format(format, args)); +#endif +#endif + } + + } + +} +#endif diff --git a/Assets/AppsFlyer/Windows/AppsFlyerWindows.cs.meta b/Assets/AppsFlyer/Windows/AppsFlyerWindows.cs.meta old mode 100644 new mode 100755 diff --git a/Assets/BingoSun/Scripts/AppsFlyerObjectScript1.cs b/Assets/BingoSun/Scripts/AppsFlyerObjectScript1.cs index df2d228..a10bcb3 100644 --- a/Assets/BingoSun/Scripts/AppsFlyerObjectScript1.cs +++ b/Assets/BingoSun/Scripts/AppsFlyerObjectScript1.cs @@ -2,7 +2,6 @@ using System.Collections; using UnityEngine; using AppsFlyerSDK; using System.Collections.Generic; -using Unity.Advertisement.IosSupport; using BingoBrain; using BingoBrain.Core; using System; diff --git a/Assets/Editor/PostProcessBuild.cs b/Assets/Editor/PostProcessBuild.cs index 4a77bb1..07222ce 100644 --- a/Assets/Editor/PostProcessBuild.cs +++ b/Assets/Editor/PostProcessBuild.cs @@ -3,24 +3,32 @@ using UnityEditor.Callbacks; using UnityEditor.iOS.Xcode; using System.IO; using UnityEditor.Build; +using UnityEditor.Build.Reporting; using UnityEngine; public class PostProcessBuild : IPostprocessBuildWithReport { public int callbackOrder => 1; - public void OnPostprocessBuild(UnityEditor.Build.Reporting.BuildReport report) + public void OnPostprocessBuild(BuildReport report) { - //检查是否为 iOS 平台构建 + // 检查是否为 iOS 平台构建 if (report.summary.platform == BuildTarget.iOS) { string projectPath = report.summary.outputPath; - string customControllerPath = "Assets/Editor/UnityAppController.mm"; // 自定义文件的路径 + string projFilePath = PBXProject.GetPBXProjectPath(projectPath); + + PBXProject proj = new PBXProject(); + proj.ReadFromFile(projFilePath); + + string targetGuid = proj.GetUnityFrameworkTargetGuid(); + + // 示例:复制自定义 UnityAppController.mm + string customControllerPath = "Assets/Editor/UnityAppController.mm"; string destinationPath = Path.Combine(projectPath, "Classes/UnityAppController.mm"); if (File.Exists(customControllerPath)) { - // 复制文件到 Xcode 项目中 File.Copy(customControllerPath, destinationPath, overwrite: true); Debug.Log("Custom UnityAppController.mm has been copied to Xcode project."); } @@ -28,6 +36,21 @@ public class PostProcessBuild : IPostprocessBuildWithReport { Debug.LogError("Custom UnityAppController.mm file not found at " + customControllerPath); } + + // 示例:添加插件文件时避免重复 + string pluginPath = Path.Combine(projectPath, "Libraries/Plugins/iOS/pluginIOs.mm"); + if (!proj.ContainsFileByRealPath(pluginPath)) + { + string fileGuid = proj.AddFile(pluginPath, "Libraries/Plugins/iOS/pluginIOs.mm", PBXSourceTree.Source); + proj.AddFileToBuild(targetGuid, fileGuid); + Debug.Log("pluginIOs.mm added to UnityFramework target."); + } + else + { + Debug.Log("pluginIOs.mm already exists, skip adding."); + } + + File.WriteAllText(projFilePath, proj.WriteToString()); } } -} \ No newline at end of file +} diff --git a/Assets/Editor/com.unity.mobile.notifications/NotificationSettings.asset b/Assets/Editor/com.unity.mobile.notifications/NotificationSettings.asset deleted file mode 100644 index 655d006..0000000 --- a/Assets/Editor/com.unity.mobile.notifications/NotificationSettings.asset +++ /dev/null @@ -1,42 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0863bf92b4fcc45b0b9267325249bf0f, type: 3} - m_Name: NotificationSettings - m_EditorClassIdentifier: - toolbarInt: 0 - iOSNotificationEditorSettingsValues: - keys: - - UnityNotificationRequestAuthorizationOnAppLaunch - - UnityNotificationDefaultAuthorizationOptions - - UnityAddRemoteNotificationCapability - - UnityNotificationRequestAuthorizationForRemoteNotificationsOnAppLaunch - - UnityRemoteNotificationForegroundPresentationOptions - - UnityUseAPSReleaseEnvironment - - UnityUseLocationNotificationTrigger - values: - - True - - 7 - - False - - False - - -1 - - False - - False - AndroidNotificationEditorSettingsValues: - keys: - - UnityNotificationAndroidRescheduleOnDeviceRestart - - UnityNotificationAndroidUseCustomActivity - - UnityNotificationAndroidCustomActivityString - values: - - False - - False - - com.unity3d.player.UnityPlayerActivity - TrackedResourceAssets: [] diff --git a/Assets/Firebase/Editor/AnalyticsDependencies.xml b/Assets/Firebase/Editor/AnalyticsDependencies.xml old mode 100644 new mode 100755 index 0c07abe..1cccffe --- a/Assets/Firebase/Editor/AnalyticsDependencies.xml +++ b/Assets/Firebase/Editor/AnalyticsDependencies.xml @@ -1,20 +1,20 @@ - - - - - - - - - - - - - Assets/Firebase/m2repository - - - - + + + + + + + + + + + + + Assets/Firebase/m2repository + + + + diff --git a/Assets/Firebase/Editor/AnalyticsDependencies.xml.meta b/Assets/Firebase/Editor/AnalyticsDependencies.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Editor/AppDependencies.xml b/Assets/Firebase/Editor/AppDependencies.xml old mode 100644 new mode 100755 index ec1d231..61e899d --- a/Assets/Firebase/Editor/AppDependencies.xml +++ b/Assets/Firebase/Editor/AppDependencies.xml @@ -1,24 +1,24 @@ - - - - - - - - - - - - - - - - - Assets/Firebase/m2repository - - - - + + + + + + + + + + + + + + + + + Assets/Firebase/m2repository + + + + diff --git a/Assets/Firebase/Editor/AppDependencies.xml.meta b/Assets/Firebase/Editor/AppDependencies.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Editor/CrashlyticsDependencies.xml b/Assets/Firebase/Editor/CrashlyticsDependencies.xml old mode 100644 new mode 100755 index 1b6b722..6fccc35 --- a/Assets/Firebase/Editor/CrashlyticsDependencies.xml +++ b/Assets/Firebase/Editor/CrashlyticsDependencies.xml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - Assets/Firebase/m2repository - - - - + + + + + + + + + + + + + + + Assets/Firebase/m2repository + + + + diff --git a/Assets/Firebase/Editor/CrashlyticsDependencies.xml.meta b/Assets/Firebase/Editor/CrashlyticsDependencies.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Editor/MessagingDependencies.xml b/Assets/Firebase/Editor/MessagingDependencies.xml old mode 100644 new mode 100755 index 86d19d0..418788a --- a/Assets/Firebase/Editor/MessagingDependencies.xml +++ b/Assets/Firebase/Editor/MessagingDependencies.xml @@ -1,26 +1,26 @@ - - - - - - - - - - - - - - - - - - - Assets/Firebase/m2repository - - - - + + + + + + + + + + + + + + + + + + + Assets/Firebase/m2repository + + + + diff --git a/Assets/Firebase/Editor/MessagingDependencies.xml.meta b/Assets/Firebase/Editor/MessagingDependencies.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS.meta b/Assets/Firebase/Plugins/iOS.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Analytics.dll b/Assets/Firebase/Plugins/iOS/Firebase.Analytics.dll old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Analytics.dll.meta b/Assets/Firebase/Plugins/iOS/Firebase.Analytics.dll.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Analytics.pdb b/Assets/Firebase/Plugins/iOS/Firebase.Analytics.pdb old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Analytics.pdb.meta b/Assets/Firebase/Plugins/iOS/Firebase.Analytics.pdb.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.App.dll b/Assets/Firebase/Plugins/iOS/Firebase.App.dll old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.App.dll.meta b/Assets/Firebase/Plugins/iOS/Firebase.App.dll.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.App.pdb b/Assets/Firebase/Plugins/iOS/Firebase.App.pdb old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.App.pdb.meta b/Assets/Firebase/Plugins/iOS/Firebase.App.pdb.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Crashlytics.dll b/Assets/Firebase/Plugins/iOS/Firebase.Crashlytics.dll old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Crashlytics.dll.meta b/Assets/Firebase/Plugins/iOS/Firebase.Crashlytics.dll.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Crashlytics.pdb b/Assets/Firebase/Plugins/iOS/Firebase.Crashlytics.pdb old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Crashlytics.pdb.meta b/Assets/Firebase/Plugins/iOS/Firebase.Crashlytics.pdb.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Messaging.dll b/Assets/Firebase/Plugins/iOS/Firebase.Messaging.dll old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Messaging.dll.meta b/Assets/Firebase/Plugins/iOS/Firebase.Messaging.dll.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Messaging.pdb b/Assets/Firebase/Plugins/iOS/Firebase.Messaging.pdb old mode 100644 new mode 100755 diff --git a/Assets/Firebase/Plugins/iOS/Firebase.Messaging.pdb.meta b/Assets/Firebase/Plugins/iOS/Firebase.Messaging.pdb.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/maven-metadata.xml b/Assets/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/maven-metadata.xml old mode 100644 new mode 100755 index 5615926..d7df9fa --- a/Assets/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/maven-metadata.xml +++ b/Assets/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/maven-metadata.xml @@ -1,9 +1,9 @@ - - com.google.firebase - firebase-analytics-unity - - 12.8.0 - 12.8.0 - - - + + com.google.firebase + firebase-analytics-unity + + 12.8.0 + 12.8.0 + + + diff --git a/Assets/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/maven-metadata.xml.meta b/Assets/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/maven-metadata.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/m2repository/com/google/firebase/firebase-app-unity/maven-metadata.xml b/Assets/Firebase/m2repository/com/google/firebase/firebase-app-unity/maven-metadata.xml old mode 100644 new mode 100755 index 3ec2e1c..9f17e50 --- a/Assets/Firebase/m2repository/com/google/firebase/firebase-app-unity/maven-metadata.xml +++ b/Assets/Firebase/m2repository/com/google/firebase/firebase-app-unity/maven-metadata.xml @@ -1,9 +1,9 @@ - - com.google.firebase - firebase-app-unity - - 12.8.0 - 12.8.0 - - - + + com.google.firebase + firebase-app-unity + + 12.8.0 + 12.8.0 + + + diff --git a/Assets/Firebase/m2repository/com/google/firebase/firebase-app-unity/maven-metadata.xml.meta b/Assets/Firebase/m2repository/com/google/firebase/firebase-app-unity/maven-metadata.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/maven-metadata.xml b/Assets/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/maven-metadata.xml old mode 100644 new mode 100755 index 2bc25b5..2054061 --- a/Assets/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/maven-metadata.xml +++ b/Assets/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/maven-metadata.xml @@ -1,9 +1,9 @@ - - com.google.firebase - firebase-crashlytics-unity - - 12.8.0 - 12.8.0 - - - + + com.google.firebase + firebase-crashlytics-unity + + 12.8.0 + 12.8.0 + + + diff --git a/Assets/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/maven-metadata.xml.meta b/Assets/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/maven-metadata.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/maven-metadata.xml b/Assets/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/maven-metadata.xml old mode 100644 new mode 100755 index 48e4afe..ed7fa68 --- a/Assets/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/maven-metadata.xml +++ b/Assets/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/maven-metadata.xml @@ -1,9 +1,9 @@ - - com.google.firebase - firebase-messaging-unity - - 12.8.0 - 12.8.0 - - - + + com.google.firebase + firebase-messaging-unity + + 12.8.0 + 12.8.0 + + + diff --git a/Assets/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/maven-metadata.xml.meta b/Assets/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/maven-metadata.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase.meta b/Assets/GeneratedLocalRepo/Firebase.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0/firebase-analytics-unity-12.8.0.aar b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0/firebase-analytics-unity-12.8.0.aar old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0/firebase-analytics-unity-12.8.0.aar.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0/firebase-analytics-unity-12.8.0.aar.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0/firebase-analytics-unity-12.8.0.pom b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0/firebase-analytics-unity-12.8.0.pom old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0/firebase-analytics-unity-12.8.0.pom.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.8.0/firebase-analytics-unity-12.8.0.pom.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0/firebase-app-unity-12.8.0.aar b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0/firebase-app-unity-12.8.0.aar old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0/firebase-app-unity-12.8.0.aar.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0/firebase-app-unity-12.8.0.aar.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0/firebase-app-unity-12.8.0.pom b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0/firebase-app-unity-12.8.0.pom old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0/firebase-app-unity-12.8.0.pom.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-app-unity/12.8.0/firebase-app-unity-12.8.0.pom.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0/firebase-crashlytics-unity-12.8.0.aar b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0/firebase-crashlytics-unity-12.8.0.aar old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0/firebase-crashlytics-unity-12.8.0.aar.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0/firebase-crashlytics-unity-12.8.0.aar.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0/firebase-crashlytics-unity-12.8.0.pom b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0/firebase-crashlytics-unity-12.8.0.pom old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0/firebase-crashlytics-unity-12.8.0.pom.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.8.0/firebase-crashlytics-unity-12.8.0.pom.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0/firebase-messaging-unity-12.8.0.aar b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0/firebase-messaging-unity-12.8.0.aar old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0/firebase-messaging-unity-12.8.0.aar.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0/firebase-messaging-unity-12.8.0.aar.meta old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0/firebase-messaging-unity-12.8.0.pom b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0/firebase-messaging-unity-12.8.0.pom old mode 100644 new mode 100755 diff --git a/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0/firebase-messaging-unity-12.8.0.pom.meta b/Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.8.0/firebase-messaging-unity-12.8.0.pom.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/Demo/MYp0ZVTT2QSDKDemo.cs b/Assets/MYp0ZVTT2QSDK/Demo/MYp0ZVTT2QSDKDemo.cs old mode 100644 new mode 100755 index 60f22e7..b670fd8 --- a/Assets/MYp0ZVTT2QSDK/Demo/MYp0ZVTT2QSDKDemo.cs +++ b/Assets/MYp0ZVTT2QSDK/Demo/MYp0ZVTT2QSDKDemo.cs @@ -1,231 +1,231 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using Newtonsoft.Json; -using MYp0ZVTT2QSDK; -using UnityEngine; -using UnityEngine.UI; -using Random = UnityEngine.Random; - -public class MYp0ZVTT2QSDKDemo : MonoBehaviour -{ - public void ShowReward() - { - MYp0ZVTT2QSDKHelper.Instance.ShowRewardVideo("TAG", b => - { - Debug.LogError($"reward result = {b}"); - },(() => - { - Debug.LogError($"reward close!!!"); - })); - } - - public void ShowInter() - { - MYp0ZVTT2QSDKHelper.Instance.ShowInter("TAG", () => - { - Debug.LogError("inter hide"); - }); - } - - public void ShowAdmobInter() - { - MYp0ZVTT2QSDKHelper.Instance.ShowAdmobInter("TAG", () => - { - Debug.LogError("inter hide"); - }); - } - - public void ShowSplash() - { - MYp0ZVTT2QSDKHelper.Instance.ShowSplash(); - } - - public void CheckReward(Image btnImg) - { - var isReady = MYp0ZVTT2QSDKHelper.Instance.IsVideoReady(); - btnImg.color = isReady ? Color.green : Color.white; - Debug.Log($"Reward : {isReady}"); - } - - public void CheckInter(Image btnImg) - { - var isReady = MYp0ZVTT2QSDKHelper.Instance.IsInterReady(); - btnImg.color = isReady ? Color.green : Color.white; - Debug.Log($"Inter : {isReady}"); - } - - public void CheckSplash(Image btnImg) - { - var isReady = MYp0ZVTT2QSDKHelper.Instance.IsSplashReady(); - btnImg.color = isReady ? Color.green : Color.white; - Debug.Log($"Splash : {isReady}"); - } - - public void Track() - { - MYp0ZVTT2QSDKHelper.Instance.Track("test", new Dictionary() - { - {"evt1", "1"}, - {"evt2", "2"}, - {"evt3", "3"}, - {"evt4", "4"}, - {"evt5", "5"}, - {"evt6", "6"}, - {"evt7", "7"}, - {"evt8", "8"}, - {"evt9", "9"}, - }); - - - } - - public void GetCountryCode() - { - - var code = MYp0ZVTT2QSDKHelper.Instance.GetCountryCode(); - Debug.Log($"country : {code}"); - } - - public void ShowH5() - { - MYp0ZVTT2QSDKHelper.Instance.H5.ShowH5((() => - { - Debug.Log("H5 close"); - }), () => - { - Debug.Log($"H5 show failed!"); - }); - } - - public void ShowH5(RectTransform rectTransform) - { - MYp0ZVTT2QSDKHelper.Instance.H5.ShowH5(rectTransform); - } - - public void HideH5() - { - MYp0ZVTT2QSDKHelper.Instance.H5.HideH5(); - } - - public void CheckShowH5(Image btnImg) - { - var show = MYp0ZVTT2QSDKHelper.Instance.H5.IsShowH5(); - btnImg.color = show ? Color.green : Color.red; - Debug.Log($"CheckShowH5 : {show}"); - } - - private int _level = 1; - public void TrackLevel() - { - MYp0ZVTT2QSDKHelper.Instance.TrackLevelUp(_level); - if (Random.Range(0, 100) < 50) - { - _level++; - } - } - - private string withDrawSceneId = ""; - public void GetWithDrawConfigs() - { - MYp0ZVTT2QSDKHelper.Instance.GetWithDrawConfigs(((b, s) => - { - Debug.Log($"GetWithDrawConfigs result : {b}, data : {s}"); - if (b) - { - var cfgs = JsonConvert.DeserializeObject>(s); - int idx = 0; - foreach (WithDrawConfig config in cfgs) - { - Debug.Log($"index = {idx}, {config.ToString()}"); - if (idx == 0) - withDrawSceneId = config.SecneId; - idx++; - } - } - - })); - } - - private int payIndex = 0; - public void CreateWithDrawOrder() - { - string taxNo = ""; - string payAccount = "tom@gmail.com"; - string accountType = "E"; - PaymentTypeCode payCode = PaymentTypeCode.GOPAY; - //GOPAY DANA 收款账号需要为电话号码 - if (payIndex == 1 || payIndex == 0) - { - payCode = payIndex == 1 ? PaymentTypeCode.DANA : payCode; - payAccount = "0881234567890"; - accountType = "P"; - } - if (payIndex == 2) - { - // PIX 需要填写税号 - payCode = PaymentTypeCode.PIX; - taxNo = "99999999999"; - } - if (payIndex == 3) payCode = PaymentTypeCode.MERCADOPAGO; - MYp0ZVTT2QSDKHelper.Instance.CreateWithDrawOrder(withDrawSceneId, payCode, payAccount, accountType, "testName", taxNo, b => - { - Debug.Log($"CreateWithDrawOrder result : {b}"); - }); - - payIndex++; - payIndex = payIndex > 3 ? 0 : payIndex; - } - - public void GetWithDrawOrders() - { - MYp0ZVTT2QSDKHelper.Instance.GetWithDrawOrders(((b, s) => - { - Debug.Log($"GetWithDrawOrders result : {b}, data : {s}"); - if (b) - { - var cfgs = JsonConvert.DeserializeObject>(s); - int idx = 0; - foreach (WithDrawOrder config in cfgs) - { - Debug.Log($"index = {idx}, {config.ToString()}"); - idx++; - } - } - })); - } - - // Start is called before the first frame update - void Start() - { - Init(); - - Invoke("ShowSplash", 5); - } - - // Update is called once per frame - void Update() - { - - } - - private void Init() - { - MYp0ZVTT2QSDKHelper.Instance.RegistIosParam((i => - { - Debug.Log($"ios ab param : {i}"); - })); - - void GameConfig(bool result, string config) - { - Debug.Log($"************* game config result : {result}, config : {config}"); - } - - MYp0ZVTT2QSDKHelper.Instance.Init(null, "app_config", GameConfig); - } - - public static string GetSdkVersion() - { - return MYp0ZVTT2QSDKHelper.SdkVersion; - } -} +using System; +using System.Collections; +using System.Collections.Generic; +using Newtonsoft.Json; +using MYp0ZVTT2QSDK; +using UnityEngine; +using UnityEngine.UI; +using Random = UnityEngine.Random; + +public class MYp0ZVTT2QSDKDemo : MonoBehaviour +{ + public void ShowReward() + { + MYp0ZVTT2QSDKHelper.Instance.ShowRewardVideo("TAG", b => + { + Debug.LogError($"reward result = {b}"); + },(() => + { + Debug.LogError($"reward close!!!"); + })); + } + + public void ShowInter() + { + MYp0ZVTT2QSDKHelper.Instance.ShowInter("TAG", () => + { + Debug.LogError("inter hide"); + }); + } + + public void ShowAdmobInter() + { + MYp0ZVTT2QSDKHelper.Instance.ShowAdmobInter("TAG", () => + { + Debug.LogError("inter hide"); + }); + } + + public void ShowSplash() + { + MYp0ZVTT2QSDKHelper.Instance.ShowSplash(); + } + + public void CheckReward(Image btnImg) + { + var isReady = MYp0ZVTT2QSDKHelper.Instance.IsVideoReady(); + btnImg.color = isReady ? Color.green : Color.white; + Debug.Log($"Reward : {isReady}"); + } + + public void CheckInter(Image btnImg) + { + var isReady = MYp0ZVTT2QSDKHelper.Instance.IsInterReady(); + btnImg.color = isReady ? Color.green : Color.white; + Debug.Log($"Inter : {isReady}"); + } + + public void CheckSplash(Image btnImg) + { + var isReady = MYp0ZVTT2QSDKHelper.Instance.IsSplashReady(); + btnImg.color = isReady ? Color.green : Color.white; + Debug.Log($"Splash : {isReady}"); + } + + public void Track() + { + MYp0ZVTT2QSDKHelper.Instance.Track("test", new Dictionary() + { + {"evt1", "1"}, + {"evt2", "2"}, + {"evt3", "3"}, + {"evt4", "4"}, + {"evt5", "5"}, + {"evt6", "6"}, + {"evt7", "7"}, + {"evt8", "8"}, + {"evt9", "9"}, + }); + + + } + + public void GetCountryCode() + { + + var code = MYp0ZVTT2QSDKHelper.Instance.GetCountryCode(); + Debug.Log($"country : {code}"); + } + + public void ShowH5() + { + MYp0ZVTT2QSDKHelper.Instance.H5.ShowH5((() => + { + Debug.Log("H5 close"); + }), () => + { + Debug.Log($"H5 show failed!"); + }); + } + + public void ShowH5(RectTransform rectTransform) + { + MYp0ZVTT2QSDKHelper.Instance.H5.ShowH5(rectTransform); + } + + public void HideH5() + { + MYp0ZVTT2QSDKHelper.Instance.H5.HideH5(); + } + + public void CheckShowH5(Image btnImg) + { + var show = MYp0ZVTT2QSDKHelper.Instance.H5.IsShowH5(); + btnImg.color = show ? Color.green : Color.red; + Debug.Log($"CheckShowH5 : {show}"); + } + + private int _level = 1; + public void TrackLevel() + { + MYp0ZVTT2QSDKHelper.Instance.TrackLevelUp(_level); + if (Random.Range(0, 100) < 50) + { + _level++; + } + } + + private string withDrawSceneId = ""; + public void GetWithDrawConfigs() + { + MYp0ZVTT2QSDKHelper.Instance.GetWithDrawConfigs(((b, s) => + { + Debug.Log($"GetWithDrawConfigs result : {b}, data : {s}"); + if (b) + { + var cfgs = JsonConvert.DeserializeObject>(s); + int idx = 0; + foreach (WithDrawConfig config in cfgs) + { + Debug.Log($"index = {idx}, {config.ToString()}"); + if (idx == 0) + withDrawSceneId = config.SecneId; + idx++; + } + } + + })); + } + + private int payIndex = 0; + public void CreateWithDrawOrder() + { + string taxNo = ""; + string payAccount = "tom@gmail.com"; + string accountType = "E"; + PaymentTypeCode payCode = PaymentTypeCode.GOPAY; + //GOPAY DANA 收款账号需要为电话号码 + if (payIndex == 1 || payIndex == 0) + { + payCode = payIndex == 1 ? PaymentTypeCode.DANA : payCode; + payAccount = "0881234567890"; + accountType = "P"; + } + if (payIndex == 2) + { + // PIX 需要填写税号 + payCode = PaymentTypeCode.PIX; + taxNo = "99999999999"; + } + if (payIndex == 3) payCode = PaymentTypeCode.MERCADOPAGO; + MYp0ZVTT2QSDKHelper.Instance.CreateWithDrawOrder(withDrawSceneId, payCode, payAccount, accountType, "testName", taxNo, b => + { + Debug.Log($"CreateWithDrawOrder result : {b}"); + }); + + payIndex++; + payIndex = payIndex > 3 ? 0 : payIndex; + } + + public void GetWithDrawOrders() + { + MYp0ZVTT2QSDKHelper.Instance.GetWithDrawOrders(((b, s) => + { + Debug.Log($"GetWithDrawOrders result : {b}, data : {s}"); + if (b) + { + var cfgs = JsonConvert.DeserializeObject>(s); + int idx = 0; + foreach (WithDrawOrder config in cfgs) + { + Debug.Log($"index = {idx}, {config.ToString()}"); + idx++; + } + } + })); + } + + // Start is called before the first frame update + void Start() + { + Init(); + + Invoke("ShowSplash", 5); + } + + // Update is called once per frame + void Update() + { + + } + + private void Init() + { + MYp0ZVTT2QSDKHelper.Instance.RegistIosParam((i => + { + Debug.Log($"ios ab param : {i}"); + })); + + void GameConfig(bool result, string config) + { + Debug.Log($"************* game config result : {result}, config : {config}"); + } + + MYp0ZVTT2QSDKHelper.Instance.Init(null, "app_config", GameConfig); + } + + public static string GetSdkVersion() + { + return MYp0ZVTT2QSDKHelper.SdkVersion; + } +} diff --git a/Assets/MYp0ZVTT2QSDK/Demo/MYp0ZVTT2QSDKDemo.cs.meta b/Assets/MYp0ZVTT2QSDK/Demo/MYp0ZVTT2QSDKDemo.cs.meta old mode 100644 new mode 100755 index 00ac076..dcfc259 --- a/Assets/MYp0ZVTT2QSDK/Demo/MYp0ZVTT2QSDKDemo.cs.meta +++ b/Assets/MYp0ZVTT2QSDK/Demo/MYp0ZVTT2QSDKDemo.cs.meta @@ -1,11 +1,11 @@ -fileFormatVersion: 2 -guid: 959ec24a7131c9d488e5007fa82612be -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 959ec24a7131c9d488e5007fa82612be +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MYp0ZVTT2QSDK/Editor/MYp0ZVTT2QSDKConfigEditor.cs b/Assets/MYp0ZVTT2QSDK/Editor/MYp0ZVTT2QSDKConfigEditor.cs old mode 100644 new mode 100755 index 8bf96ad..26847af --- a/Assets/MYp0ZVTT2QSDK/Editor/MYp0ZVTT2QSDKConfigEditor.cs +++ b/Assets/MYp0ZVTT2QSDK/Editor/MYp0ZVTT2QSDKConfigEditor.cs @@ -1,653 +1,653 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using MYp0ZVTT2QSDK; -using UnityEditor; -using UnityEngine; - -public class MYp0ZVTT2QSDKConfigEditor : EditorWindow -{ - private static MYp0ZVTT2QSDKConfigEditor _view; - -private int _emptyKwInterIdCount = 1; -private int _emptyKwVideoIdCount = 1; - -private int _emptyBigoInterIdCount = 1; -private int _emptyBigoVideoIdCount = 1; - -[MenuItem("Tools/设置 &G")] -public static void ShowWin() -{ - if (_view != null) - { - CloseView(); - return; - } - - var win = GetWindow(); - win.minSize = new Vector2(790, 872); - _view = win; - RemoveExtraEmptyStrings(SDKConfig.KwaiInterUnitId, _view._emptyKwInterIdCount); - RemoveExtraEmptyStrings(SDKConfig.KwaiVideoUnitId, _view._emptyKwVideoIdCount); - RemoveExtraEmptyStrings(SDKConfig.BigoInterUnitId, _view._emptyBigoInterIdCount); - RemoveExtraEmptyStrings(SDKConfig.BigoVideoUnitId, _view._emptyBigoVideoIdCount); - win.Show(); - - #region topon - - // _view.loadPluginData(); - - #endregion - - } - - static void CloseView() -{ - _view.Close(); - _view = null; -} - -private void OnGUI() -{ - DrawWindow(); - EditorUtility.SetDirty(SDKConfig.Instance); -} - -#region Topon -// private AnyThink.Scripts.IntegrationManager.Editor.ATEditorCoroutine loadDataCoroutine; -// private AnyThink.Scripts.IntegrationManager.Editor.PluginData pluginData; -// private bool pluginDataLoadFailed; -// private void loadPluginData() -// { - // if (loadDataCoroutine != null) - // { - // loadDataCoroutine.Stop(); - // } - // loadDataCoroutine = AnyThink.Scripts.IntegrationManager.Editor.ATEditorCoroutine.startCoroutine(AnyThink.Scripts.IntegrationManager.Editor.ATIntegrationManager.Instance.loadPluginData(data => - // { - // if (data == null) - // { - // pluginDataLoadFailed = true; - // } - // else - // { - // ATLog.log("loadNetworksData() >>> pluginData: " + data); - // pluginData = data; - // pluginDataLoadFailed = false; - // } - // })); -// } - -#endregion - - private void DrawWindow() -{ - TextLabel("基础配置"); - EditorGUILayout.BeginVertical("frameBox"); -#if UNITY_IOS - SDKConfig.Instance.appsFlyerDevKey = DrawTextField("appsFlyerDevKey", SDKConfig.Instance.appsFlyerDevKey); - SDKConfig.Instance.appsFlyerIosAppleAppId = DrawTextField("appsFlyerIosAppleAppId", SDKConfig.Instance.appsFlyerIosAppleAppId); -#elif UNITY_ANDROID - SDKConfig.Instance.appsFlyerDevKey = DrawTextField("appsFlyerDevKey", SDKConfig.Instance.appsFlyerDevKey); -#endif - SDKConfig.Instance.logReportUrl = DrawTextField("配置域名", SDKConfig.Instance.logReportUrl); - SDKConfig.Instance.appKey = DrawTextField("appKey", SDKConfig.Instance.appKey); - SDKConfig.Instance.appSecret = DrawTextField("appSecret", SDKConfig.Instance.appSecret); - - EditorGUILayout.EndVertical(); - - TextLabel("广告配置"); - - - #region MAX - - EditorGUILayout.BeginVertical("frameBox"); - TextLabel("MAX", Color.cyan); - SDKConfig.Instance.maxAppKey = DrawTextField("MaxSdkKey", SDKConfig.Instance.maxAppKey); - SDKConfig.Instance.videoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.videoUnitId); - SDKConfig.Instance.interUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.interUnitId); - SDKConfig.Instance.bannerUnitId = DrawTextField("Banner ID", SDKConfig.Instance.bannerUnitId); - SDKConfig.Instance.splashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.splashUnitId); - EditorGUILayout.EndVertical(); - - AppLovinSettings.Instance.SdkKey = SDKConfig.Instance.maxAppKey; - - #endregion - - - #region Topon - - // EditorGUILayout.BeginVertical("frameBox"); - // TextLabel("Topon", Color.cyan); - // SDKConfig.Instance.toponAppId = DrawTextField("AppId", SDKConfig.Instance.toponAppId); - // SDKConfig.Instance.toponAppkey = DrawTextField("Appkey", SDKConfig.Instance.toponAppkey); - // SDKConfig.Instance.toponVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.toponVideoUnitId); - // SDKConfig.Instance.toponInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.toponInterUnitId); - // EditorGUILayout.EndVertical(); - - // var integrationManager = AnyThink.Scripts.IntegrationManager.Editor.ATIntegrationManager.Instance; - // bool isAdmobInstalledForAndroid = integrationManager.isAdmobInstalled(AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_ANDROID); - // bool isAdmobInstalledForIos = integrationManager.isAdmobInstalled(AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_IOS); - - // if (isAdmobInstalledForAndroid || isAdmobInstalledForIos) - // { - // if (isAdmobInstalledForAndroid) - // { - // var androidAdmobAppId = "ca-app-pub-3940256099942544~3347511713"; - // integrationManager.setAdmobAppidByOs(pluginData, AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_ANDROID, androidAdmobAppId); - // } - // if (isAdmobInstalledForIos) - // { - // var iosAdmobAppId = "ca-app-pub-3940256099942544~1458002511"; - // integrationManager.setAdmobAppidByOs(pluginData, AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_IOS, iosAdmobAppId); - // } - // } - - #endregion - -#if UNITY_ANDROID - - EditorGUILayout.BeginVertical("frameBox"); - EditorGUILayout.BeginHorizontal("frameBox"); - TextLabel("KWai", Color.cyan); - DrawButton("插屏ID +", AddInterId); - //DrawButton("插屏ID -", DelInterId); - DrawButton("激励视频ID +", AddRewardId); - //DrawButton("激励视频ID -", DelRewardId); - EditorGUILayout.EndHorizontal(); - SDKConfig.Instance.kwaiAppId = DrawTextField("AppId", SDKConfig.Instance.kwaiAppId); - - for (int i = 0; i < SDKConfig.Instance.kwaiInterUnitId.Count; i++) - { - var index = i; - GUILayout.BeginHorizontal(); - SDKConfig.Instance.kwaiInterUnitId[i] = - DrawTextField("插屏ID - " + (i + 1), SDKConfig.Instance.kwaiInterUnitId[i]); - DrawButtonX("X", () => DelInterId(index)); - GUILayout.EndHorizontal(); - - } - - for (int i = 0; i < SDKConfig.Instance.kwaiVideoUnitId.Count; i++) - { - var index = i; - GUILayout.BeginHorizontal(); - SDKConfig.Instance.kwaiVideoUnitId[i] = - DrawTextField("激励视频ID - " + (i + 1), SDKConfig.Instance.kwaiVideoUnitId[i]); - DrawButtonX("X", () => DelRewardId(index)); - GUILayout.EndHorizontal(); - - } - - EditorGUILayout.EndVertical(); - - EditorGUILayout.BeginVertical("frameBox"); - EditorGUILayout.BeginHorizontal("frameBox"); - TextLabel("Bigo", Color.cyan); - DrawButton("插屏ID +", AddBigoInterId); - DrawButton("激励视频ID +", AddBigoRewardId); - EditorGUILayout.EndHorizontal(); - SDKConfig.Instance.bigoAppId = DrawTextField("AppId", SDKConfig.Instance.bigoAppId); - SDKConfig.Instance.bigoSplashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.bigoSplashUnitId); - - for (int i = 0; i < SDKConfig.Instance.bigoInterUnitId.Count; i++) - { - //SDKConfig.Instance.bigoInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.bigoInterUnitId); - var index = i; - GUILayout.BeginHorizontal(); - SDKConfig.Instance.bigoInterUnitId[i] = - DrawTextField("插屏ID - " + (i + 1), SDKConfig.Instance.bigoInterUnitId[i]); - DrawButtonX("X", () => DelBigoInterId(index)); - GUILayout.EndHorizontal(); - } - - for (int i = 0; i < SDKConfig.Instance.bigoVideoUnitId.Count; i++) - { - //SDKConfig.Instance.bigoVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.bigoVideoUnitId); - var index = i; - GUILayout.BeginHorizontal(); - SDKConfig.Instance.bigoVideoUnitId[i] = - DrawTextField("激励视频ID - " + (i + 1), SDKConfig.Instance.bigoVideoUnitId[i]); - DrawButtonX("X", () => DelBigoRewardId(index)); - GUILayout.EndHorizontal(); - } - - EditorGUILayout.EndVertical(); -#endif - - - EditorGUILayout.BeginVertical("frameBox"); - SDKConfig.Instance.isUseAdmobSplash = DrawBoolField("启用开屏优化", SDKConfig.Instance.isUseAdmobSplash, ""); - if (SDKConfig.Instance.isUseAdmobSplash) - { - EditorGUILayout.BeginVertical("frameBox"); - TextLabel("Admob", Color.cyan); - SDKConfig.Instance.admobAppId = DrawTextField("AppId", SDKConfig.Instance.admobAppId); - SDKConfig.Instance.admobSplashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.admobSplashUnitId); - //SDKConfig.Instance.admobInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.admobInterUnitId); - //SDKConfig.Instance.admobVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.admobVideoUnitId); - - EditorGUILayout.EndVertical(); - } - else - { - SDKConfig.Instance.admobSplashUnitId = string.Empty; - } - EditorGUILayout.EndVertical(); - - TextLabel("Debug"); - EditorGUILayout.BeginVertical("frameBox"); - SDKConfig.Instance.isDebug = DrawBoolField("测试模式", SDKConfig.Instance.isDebug, "正式发布时请勿勾选"); - SDKConfig.Instance.isPrintLog = DrawBoolField("日志打印", SDKConfig.Instance.isPrintLog, "正式发布时请勿勾选"); - EditorGUILayout.EndVertical(); - - // 水平布局实现按钮靠右 - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); // 左侧填充弹性空间 - if (GUILayout.Button(new GUIContent("从剪贴板获取参数", _tooltipText), - GUILayout.Width(120), - GUILayout.Height(30) - )) - { - ParseClipboard(); - } - GUILayout.EndHorizontal(); - - - var sdkVersion = MYp0ZVTT2QSDKHelper.SdkVersion; - GUI.Label(new Rect(10, position.height - 40, 400, 40), "@version: " + sdkVersion); - - EditorPrefs.SetString("sdk_version", sdkVersion); -} - -private string DrawTextField(string title, string content) -{ - EditorGUILayout.BeginHorizontal(); - GUILayout.Label(title, GUILayout.MinWidth(90), GUILayout.ExpandWidth(false)); - content = GUILayout.TextField(content); - EditorGUILayout.EndHorizontal(); - return content; -} - -private bool DrawBoolField(string title, bool content, string warn = "") -{ - EditorGUILayout.BeginHorizontal(); - GUILayout.Label(title, GUILayout.MinWidth(80), GUILayout.ExpandWidth(false)); - content = EditorGUILayout.Toggle(content); - if (content) - { - TextLabelWarn(warn); - } - EditorGUILayout.EndHorizontal(); - return content; -} - -private void TextLabel(string content, Color color = new Color()) -{ - if (color.Equals(Color.clear)) - { - color = Color.gray; - } - GUIStyle style = new GUIStyle(); - style.contentOffset = new Vector2(8, 0); - style.normal.textColor = color; - style.fontSize = 14; - style.padding = new RectOffset(0, 0, 3, 0); - GUILayout.Label(content, style); -} - -private void TextLabelWarn(string content) -{ - GUIStyle style = new GUIStyle(); - style.contentOffset = new Vector2(8, 0); - style.normal.textColor = Color.red; - style.fontSize = 14; - style.padding = new RectOffset(0, 0, 3, 0); - GUILayout.Label(content, style); -} - -private void DrawButton(string btnName, Action clickAction) -{ - if (GUILayout.Button(btnName, GUILayout.Width(100), GUILayout.Height(30))) - { - clickAction?.Invoke(); - } -} - -private void DrawButtonX(string btnName, Action clickAction) -{ - var originalBackgroundColor = GUI.backgroundColor; - - // 设置按钮的背景颜色 - GUI.backgroundColor = Color.red; - if (GUILayout.Button(btnName, GUILayout.Width(40), GUILayout.Height(18))) - { - clickAction?.Invoke(); - } - - GUI.backgroundColor = originalBackgroundColor; -} - -private void AddInterId() -{ - _emptyKwInterIdCount++; - SDKConfig.KwaiInterUnitId.Add(""); -} - -private void DelInterId(int index) -{ - _emptyKwInterIdCount--; - SDKConfig.KwaiInterUnitId.RemoveAt(index); -} - -private void AddRewardId() -{ - _emptyKwVideoIdCount++; - SDKConfig.KwaiVideoUnitId.Add(""); -} - -private void DelRewardId(int index) -{ - _emptyKwVideoIdCount--; - SDKConfig.KwaiVideoUnitId.RemoveAt(index); -} - -private void AddBigoInterId() -{ - _emptyBigoInterIdCount++; - SDKConfig.BigoInterUnitId.Add(""); -} - -private void DelBigoInterId(int index) -{ - _emptyBigoInterIdCount--; - SDKConfig.BigoInterUnitId.RemoveAt(index); -} - -private void AddBigoRewardId() -{ - _emptyBigoVideoIdCount++; - SDKConfig.BigoVideoUnitId.Add(""); -} - -private void DelBigoRewardId(int index) -{ - _emptyBigoVideoIdCount--; - SDKConfig.BigoVideoUnitId.RemoveAt(index); -} - -static void RemoveExtraEmptyStrings(List list, int count) -{ - int emptyCount = count; - if (list == null) return; - // 先统计空字符串的数量 - for (int i = list.Count - 1; i >= 0; i--) - { - if (string.IsNullOrEmpty(list[i])) - { - emptyCount++; - if (emptyCount > 1) - { - // 若空字符串数量超过 1,移除该元素 - list.RemoveAt(i); - } - } - } -} - -// ---------------------------- 参数解析 ------------------------------ -private string clipboardText = ""; -private Dictionary parsedParameters = new Dictionary(); -private readonly string _tooltipText = "需提前在参数列表界面 Ctrl + A 全选,然后再 Ctrl + C 复制"; - - -// 正则表达式模式字典,用于匹配不同类型的广告参数 -private static readonly Dictionary parameterPatterns = new Dictionary - { - // App基本信息 - { "App名称", @"App name\s*([^\n]+)" }, - { "AF Dev key", @"AF Dev key(?:[\s-]*iOS)?\s*([^\n]+)"}, - { "APP KEY", @"a\s*p\s*p\s*k\s*e\s*y\s*([^\n]+)"}, - { "APP Secret", @"a\s*p\s*p\s*s\s*e\s*c\s*r\s*e\s*t\s*([^\n]+)" }, - { "包名", @"(?:正式包名|测试包名|包名)\*?\s+([^\n]+)"}, - { "广告源", @"广告源\s*([^\n]+)" }, - { "开发者邮箱", @"开发者邮箱\s*([^\n]+)" }, - { "谷歌商店链接", @"谷歌商店链接\s*([^\n]+)" }, - { "官网链接", @"官网链接\s*([^\n]+)" }, - { "隐私协议", @"隐私协议\s*([^\n]+)" }, - { "业务上报域名", @"(?:业务上报域名|业务域名)\s*([^\n]+)" }, - { "appkey", @"appkey\s*([^\n]+)" }, - { "appsecret", @"appsecret\s*([^\n]+)" }, - {"AF Apple Appid", @"(?i)app\s*id(?:\s+id)*\s*[=:]*\s*([^\n]*)"}, - - // MAX (兼容多种格式) - { "MAX 激励视频", @"MAX参数(?:-[^\s]+)?[\s\S]*?(?:激励视频|激励1|激励2|客户端激励|bidding激励广告位ID|激励)\s*[""\r\n]*([^""\s\r\n]+)"}, - { "MAX 插屏", @"MAX参数(?:-[^\s]+)?[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*[""\r\n]*([^""\s\r\n]+)" }, - { "MAX SDK Key", @"MAX参数[\s\S]*?SDK key\*?\s*([^\n]+)" }, - { "MAX ad review key", @"MAX参数[\s\S]*?ad review key\*?\s*([^\n]+)" }, - - // BIGO (兼容多种格式) - { "BIGO 应用ID", @"BIGO参数[\s\S]*?(?:应用ID|appid)\s*([^\n]+)" }, - { "BIGO 激励", @"BIGO参数[\s\S]*?(?:激励|激励1|激励2|客户端激励|bidding激励广告位ID)\s*([^\n]+)" }, - { "BIGO 插屏", @"BIGO参数[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*([^\n]+)" }, - - // Kwai (兼容多种格式) - { "Kwai 应用ID", @"kwai参数[\s\S]*?(?:应用ID|appid)\s*([^\n]+)" }, - { "Kwai 激励", @"kwai参数[\s\S]*?(?:激励|激励1|激励2|客户端激励|bidding激励广告位ID)\s*([^\n]+)" }, - { "Kwai 插屏", @"kwai参数[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*([^\n]+)" }, - - // Admob (兼容多种格式) - { "Admob 应用ID", @"admob参数[\s\S]*?(?:应用ID|App ID)\s*([^\n]+)" }, - { "Admob 激励", @"admob参数[\s\S]*?(?:激励1|激励)\s*([^\n]+)" }, - { "Admob 插屏", @"admob参数[\s\S]*?(?:插屏1|插屏)\s*([^\n]+)" }, - { "Admob txt", @"admob参数[\s\S]*?txt\s*([^\n]+)" }, - - // Facebook (兼容多种格式) - { "FB appid", @"fb参数[\s\S]*?appid\s*([^\n]+)" }, - { "FB property_id", @"fb参数[\s\S]*?property_id\s*([^\n]+)" }, - { "FB 激励", @"fb参数[\s\S]*?激励\s*([^\n]+)" }, - { "FB 插屏", @"fb参数[\s\S]*?插屏\s*([^\n]+)" }, - { "FB txt", @"fb参数[\s\S]*?txt\s*([^\n]+)" }, - - // Topon (兼容多种格式) - // Topon (兼容多种格式) - { "Topon ID", @"(?i)topon[\s\S]*?ID[\t\s]+([^\r\n]+)" }, - { "Topon KEY", @"(?i)topon[\s\S]*?(?:App Key|KEY)[\t\s]+([^\r\n]+)" }, - { "Topon 激励", @"(?i)topon[\s\S]*?激励[\t\s]+([^\r\n]+)" }, - { "Topon 插屏", @"(?i)topon[\s\S]*?插屏[\t\s]+([^\r\n]+)" } - }; - -private void ParseClipboard() -{ - if (string.IsNullOrEmpty(clipboardText.Trim())) - { - clipboardText = EditorGUIUtility.systemCopyBuffer; - } - - parsedParameters.Clear(); - - foreach (var pattern in parameterPatterns) - { - Match match = Regex.Match(clipboardText, pattern.Value, RegexOptions.IgnoreCase); - if (match.Success) - { - // 处理可能有多个捕获组的情况(如BIGO和Kwai的两种格式) - for (int i = 1; i < match.Groups.Count; i++) - { - if (!string.IsNullOrEmpty(match.Groups[i].Value)) - { - parsedParameters[pattern.Key] = match.Groups[i].Value.Trim(); - break; - } - } - } - } - - UpdateConfig(); - EditorUtility.DisplayDialog("解析完成", - $"成功解析 {parsedParameters.Count} 个参数", "确定"); -} - -private void UpdateConfig() -{ - SDKConfig.Instance.bigoVideoUnitId ??= new List(); - SDKConfig.Instance.bigoVideoUnitId.Clear(); - SDKConfig.Instance.bigoInterUnitId ??= new List(); - SDKConfig.Instance.bigoInterUnitId.Clear(); - - SDKConfig.Instance.kwaiVideoUnitId ??= new List(); - SDKConfig.Instance.kwaiVideoUnitId.Clear(); - SDKConfig.Instance.kwaiInterUnitId ??= new List(); - SDKConfig.Instance.kwaiInterUnitId.Clear(); - - foreach (KeyValuePair pair in parsedParameters) - { - //Debug.Log($"KEY : {pair.Key}, VALUE : {pair.Value}"); - if (pair.Key.Contains("包名")) - { -#if UNITY_IOS - PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, pair.Value); -#elif UNITY_ANDROID - PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, pair.Value); -#endif - - Debug.Log($"包名设置 : {pair.Value}"); - } - - if (pair.Key.Contains("AF Dev key")) - { - Debug.Log($"AF Dev key: {pair.Value}"); - SDKConfig.Instance.appsFlyerDevKey = pair.Value; - } - -#if UNITY_IOS - - if (pair.Key.Contains("AF Apple Appid")) - { - Debug.Log($"AF Apple Appid: {pair.Value}"); - SDKConfig.Instance.appsFlyerIosAppleAppId = pair.Value; - } -#endif - - if (pair.Key.Contains("APP KEY")) - { - Debug.Log($"BI APP KEY: {pair.Value}"); - SDKConfig.Instance.appKey = pair.Value; - } - - if (pair.Key.Contains("APP Secret")) - { - Debug.Log($"BI APP Secret: {pair.Value}"); - SDKConfig.Instance.appSecret = pair.Value; - } - - if (pair.Key.Contains("域名")) - { - Debug.Log($"业务域名: {pair.Value}"); - SDKConfig.Instance.logReportUrl = pair.Value; - } - - if (pair.Key.Contains("Topon ID")) - { - Debug.Log($"Topon APP ID: {pair.Value}"); - SDKConfig.Instance.toponAppId = pair.Value; - } - - if (pair.Key.Contains("Topon KEY")) - { - Debug.Log($"Topon APP KEY: {pair.Value}"); - SDKConfig.Instance.toponAppkey = pair.Value; - } - - if (pair.Key.Contains("Topon 激励")) - { - Debug.Log($"Topon 激励: {pair.Value}"); - SDKConfig.Instance.toponVideoUnitId = pair.Value; - } - - if (pair.Key.Contains("Topon 插屏")) - { - Debug.Log($"Topon 插屏: {pair.Value}"); - SDKConfig.Instance.toponInterUnitId = pair.Value; - } - - if (pair.Key.Contains("MAX SDK Key")) - { - Debug.Log($"MAX SDK Key: {pair.Value}"); - SDKConfig.Instance.maxAppKey = pair.Value; - } - - if (pair.Key.Contains("MAX 激励视频")) - { - Debug.Log($"MAX 激励视频: {pair.Value}"); - SDKConfig.Instance.videoUnitId = pair.Value; - } - - if (pair.Key.Contains("MAX 插屏")) - { - Debug.Log($"MAX 插屏: {pair.Value}"); - SDKConfig.Instance.interUnitId = pair.Value; - } - - if (pair.Key.Contains("BIGO 应用ID")) - { - Debug.Log($"BIGO 应用ID: {pair.Value}"); - SDKConfig.Instance.bigoAppId = pair.Value; - } - - if (pair.Key.Contains("BIGO 激励")) - { - Debug.Log($"BIGO 激励: {pair.Value}"); - //SDKConfig.Instance.bigoVideoUnitId = pair.Value; - SDKConfig.Instance.bigoVideoUnitId ??= new List(); - SDKConfig.Instance.bigoVideoUnitId.Add(pair.Value); - } - - if (pair.Key.Contains("BIGO 插屏")) - { - Debug.Log($"BIGO 插屏: {pair.Value}"); - //SDKConfig.Instance.bigoInterUnitId = pair.Value; - SDKConfig.Instance.bigoInterUnitId ??= new List(); - SDKConfig.Instance.bigoInterUnitId.Add(pair.Value); - } - - if (pair.Key.Contains("Admob 应用ID")) - { - Debug.Log($"Admob 应用ID: {pair.Value}"); - //SDKConfig.Instance.admobAppId = pair.Value; - } - - if (pair.Key.Contains("Admob 激励")) - { - Debug.Log($"Admob 激励: {pair.Value}"); - } - - if (pair.Key.Contains("Admob 插屏")) - { - Debug.Log($"Admob 插屏: {pair.Value}"); - } - - if (pair.Key.Contains("Kwai 应用ID")) - { - Debug.Log($"Kwai 应用ID: {pair.Value}"); - SDKConfig.Instance.kwaiAppId = pair.Value; - } - - if (pair.Key.Contains("Kwai 激励")) - { - Debug.Log($"Kwai 激励: {pair.Value}"); - SDKConfig.Instance.kwaiVideoUnitId ??= new List(); - SDKConfig.Instance.kwaiVideoUnitId.Add(pair.Value); - } - - if (pair.Key.Contains("Kwai 插屏")) - { - Debug.Log($"Kwai 插屏: {pair.Value}"); - SDKConfig.Instance.kwaiInterUnitId ??= new List(); - SDKConfig.Instance.kwaiInterUnitId.Add(pair.Value); - } - } -} - -} +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using MYp0ZVTT2QSDK; +using UnityEditor; +using UnityEngine; + +public class MYp0ZVTT2QSDKConfigEditor : EditorWindow +{ + private static MYp0ZVTT2QSDKConfigEditor _view; + +private int _emptyKwInterIdCount = 1; +private int _emptyKwVideoIdCount = 1; + +private int _emptyBigoInterIdCount = 1; +private int _emptyBigoVideoIdCount = 1; + +[MenuItem("Tools/设置 &G")] +public static void ShowWin() +{ + if (_view != null) + { + CloseView(); + return; + } + + var win = GetWindow(); + win.minSize = new Vector2(790, 872); + _view = win; + RemoveExtraEmptyStrings(SDKConfig.KwaiInterUnitId, _view._emptyKwInterIdCount); + RemoveExtraEmptyStrings(SDKConfig.KwaiVideoUnitId, _view._emptyKwVideoIdCount); + RemoveExtraEmptyStrings(SDKConfig.BigoInterUnitId, _view._emptyBigoInterIdCount); + RemoveExtraEmptyStrings(SDKConfig.BigoVideoUnitId, _view._emptyBigoVideoIdCount); + win.Show(); + + #region topon + + // _view.loadPluginData(); + + #endregion + + } + + static void CloseView() +{ + _view.Close(); + _view = null; +} + +private void OnGUI() +{ + DrawWindow(); + EditorUtility.SetDirty(SDKConfig.Instance); +} + +#region Topon +// private AnyThink.Scripts.IntegrationManager.Editor.ATEditorCoroutine loadDataCoroutine; +// private AnyThink.Scripts.IntegrationManager.Editor.PluginData pluginData; +// private bool pluginDataLoadFailed; +// private void loadPluginData() +// { + // if (loadDataCoroutine != null) + // { + // loadDataCoroutine.Stop(); + // } + // loadDataCoroutine = AnyThink.Scripts.IntegrationManager.Editor.ATEditorCoroutine.startCoroutine(AnyThink.Scripts.IntegrationManager.Editor.ATIntegrationManager.Instance.loadPluginData(data => + // { + // if (data == null) + // { + // pluginDataLoadFailed = true; + // } + // else + // { + // ATLog.log("loadNetworksData() >>> pluginData: " + data); + // pluginData = data; + // pluginDataLoadFailed = false; + // } + // })); +// } + +#endregion + + private void DrawWindow() +{ + TextLabel("基础配置"); + EditorGUILayout.BeginVertical("frameBox"); +#if UNITY_IOS + SDKConfig.Instance.appsFlyerDevKey = DrawTextField("appsFlyerDevKey", SDKConfig.Instance.appsFlyerDevKey); + SDKConfig.Instance.appsFlyerIosAppleAppId = DrawTextField("appsFlyerIosAppleAppId", SDKConfig.Instance.appsFlyerIosAppleAppId); +#elif UNITY_ANDROID + SDKConfig.Instance.appsFlyerDevKey = DrawTextField("appsFlyerDevKey", SDKConfig.Instance.appsFlyerDevKey); +#endif + SDKConfig.Instance.logReportUrl = DrawTextField("配置域名", SDKConfig.Instance.logReportUrl); + SDKConfig.Instance.appKey = DrawTextField("appKey", SDKConfig.Instance.appKey); + SDKConfig.Instance.appSecret = DrawTextField("appSecret", SDKConfig.Instance.appSecret); + + EditorGUILayout.EndVertical(); + + TextLabel("广告配置"); + + + #region MAX + + EditorGUILayout.BeginVertical("frameBox"); + TextLabel("MAX", Color.cyan); + SDKConfig.Instance.maxAppKey = DrawTextField("MaxSdkKey", SDKConfig.Instance.maxAppKey); + SDKConfig.Instance.videoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.videoUnitId); + SDKConfig.Instance.interUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.interUnitId); + SDKConfig.Instance.bannerUnitId = DrawTextField("Banner ID", SDKConfig.Instance.bannerUnitId); + SDKConfig.Instance.splashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.splashUnitId); + EditorGUILayout.EndVertical(); + + AppLovinSettings.Instance.SdkKey = SDKConfig.Instance.maxAppKey; + + #endregion + + + #region Topon + + // EditorGUILayout.BeginVertical("frameBox"); + // TextLabel("Topon", Color.cyan); + // SDKConfig.Instance.toponAppId = DrawTextField("AppId", SDKConfig.Instance.toponAppId); + // SDKConfig.Instance.toponAppkey = DrawTextField("Appkey", SDKConfig.Instance.toponAppkey); + // SDKConfig.Instance.toponVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.toponVideoUnitId); + // SDKConfig.Instance.toponInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.toponInterUnitId); + // EditorGUILayout.EndVertical(); + + // var integrationManager = AnyThink.Scripts.IntegrationManager.Editor.ATIntegrationManager.Instance; + // bool isAdmobInstalledForAndroid = integrationManager.isAdmobInstalled(AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_ANDROID); + // bool isAdmobInstalledForIos = integrationManager.isAdmobInstalled(AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_IOS); + + // if (isAdmobInstalledForAndroid || isAdmobInstalledForIos) + // { + // if (isAdmobInstalledForAndroid) + // { + // var androidAdmobAppId = "ca-app-pub-3940256099942544~3347511713"; + // integrationManager.setAdmobAppidByOs(pluginData, AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_ANDROID, androidAdmobAppId); + // } + // if (isAdmobInstalledForIos) + // { + // var iosAdmobAppId = "ca-app-pub-3940256099942544~1458002511"; + // integrationManager.setAdmobAppidByOs(pluginData, AnyThink.Scripts.IntegrationManager.Editor.ATConfig.OS_IOS, iosAdmobAppId); + // } + // } + + #endregion + +#if UNITY_ANDROID + + EditorGUILayout.BeginVertical("frameBox"); + EditorGUILayout.BeginHorizontal("frameBox"); + TextLabel("KWai", Color.cyan); + DrawButton("插屏ID +", AddInterId); + //DrawButton("插屏ID -", DelInterId); + DrawButton("激励视频ID +", AddRewardId); + //DrawButton("激励视频ID -", DelRewardId); + EditorGUILayout.EndHorizontal(); + SDKConfig.Instance.kwaiAppId = DrawTextField("AppId", SDKConfig.Instance.kwaiAppId); + + for (int i = 0; i < SDKConfig.Instance.kwaiInterUnitId.Count; i++) + { + var index = i; + GUILayout.BeginHorizontal(); + SDKConfig.Instance.kwaiInterUnitId[i] = + DrawTextField("插屏ID - " + (i + 1), SDKConfig.Instance.kwaiInterUnitId[i]); + DrawButtonX("X", () => DelInterId(index)); + GUILayout.EndHorizontal(); + + } + + for (int i = 0; i < SDKConfig.Instance.kwaiVideoUnitId.Count; i++) + { + var index = i; + GUILayout.BeginHorizontal(); + SDKConfig.Instance.kwaiVideoUnitId[i] = + DrawTextField("激励视频ID - " + (i + 1), SDKConfig.Instance.kwaiVideoUnitId[i]); + DrawButtonX("X", () => DelRewardId(index)); + GUILayout.EndHorizontal(); + + } + + EditorGUILayout.EndVertical(); + + EditorGUILayout.BeginVertical("frameBox"); + EditorGUILayout.BeginHorizontal("frameBox"); + TextLabel("Bigo", Color.cyan); + DrawButton("插屏ID +", AddBigoInterId); + DrawButton("激励视频ID +", AddBigoRewardId); + EditorGUILayout.EndHorizontal(); + SDKConfig.Instance.bigoAppId = DrawTextField("AppId", SDKConfig.Instance.bigoAppId); + SDKConfig.Instance.bigoSplashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.bigoSplashUnitId); + + for (int i = 0; i < SDKConfig.Instance.bigoInterUnitId.Count; i++) + { + //SDKConfig.Instance.bigoInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.bigoInterUnitId); + var index = i; + GUILayout.BeginHorizontal(); + SDKConfig.Instance.bigoInterUnitId[i] = + DrawTextField("插屏ID - " + (i + 1), SDKConfig.Instance.bigoInterUnitId[i]); + DrawButtonX("X", () => DelBigoInterId(index)); + GUILayout.EndHorizontal(); + } + + for (int i = 0; i < SDKConfig.Instance.bigoVideoUnitId.Count; i++) + { + //SDKConfig.Instance.bigoVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.bigoVideoUnitId); + var index = i; + GUILayout.BeginHorizontal(); + SDKConfig.Instance.bigoVideoUnitId[i] = + DrawTextField("激励视频ID - " + (i + 1), SDKConfig.Instance.bigoVideoUnitId[i]); + DrawButtonX("X", () => DelBigoRewardId(index)); + GUILayout.EndHorizontal(); + } + + EditorGUILayout.EndVertical(); +#endif + + + EditorGUILayout.BeginVertical("frameBox"); + SDKConfig.Instance.isUseAdmobSplash = DrawBoolField("启用开屏优化", SDKConfig.Instance.isUseAdmobSplash, ""); + if (SDKConfig.Instance.isUseAdmobSplash) + { + EditorGUILayout.BeginVertical("frameBox"); + TextLabel("Admob", Color.cyan); + SDKConfig.Instance.admobAppId = DrawTextField("AppId", SDKConfig.Instance.admobAppId); + SDKConfig.Instance.admobSplashUnitId = DrawTextField("开屏 ID", SDKConfig.Instance.admobSplashUnitId); + //SDKConfig.Instance.admobInterUnitId = DrawTextField("插屏 ID", SDKConfig.Instance.admobInterUnitId); + //SDKConfig.Instance.admobVideoUnitId = DrawTextField("激励视频 ID", SDKConfig.Instance.admobVideoUnitId); + + EditorGUILayout.EndVertical(); + } + else + { + SDKConfig.Instance.admobSplashUnitId = string.Empty; + } + EditorGUILayout.EndVertical(); + + TextLabel("Debug"); + EditorGUILayout.BeginVertical("frameBox"); + SDKConfig.Instance.isDebug = DrawBoolField("测试模式", SDKConfig.Instance.isDebug, "正式发布时请勿勾选"); + SDKConfig.Instance.isPrintLog = DrawBoolField("日志打印", SDKConfig.Instance.isPrintLog, "正式发布时请勿勾选"); + EditorGUILayout.EndVertical(); + + // 水平布局实现按钮靠右 + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); // 左侧填充弹性空间 + if (GUILayout.Button(new GUIContent("从剪贴板获取参数", _tooltipText), + GUILayout.Width(120), + GUILayout.Height(30) + )) + { + ParseClipboard(); + } + GUILayout.EndHorizontal(); + + + var sdkVersion = MYp0ZVTT2QSDKHelper.SdkVersion; + GUI.Label(new Rect(10, position.height - 40, 400, 40), "@version: " + sdkVersion); + + EditorPrefs.SetString("sdk_version", sdkVersion); +} + +private string DrawTextField(string title, string content) +{ + EditorGUILayout.BeginHorizontal(); + GUILayout.Label(title, GUILayout.MinWidth(90), GUILayout.ExpandWidth(false)); + content = GUILayout.TextField(content); + EditorGUILayout.EndHorizontal(); + return content; +} + +private bool DrawBoolField(string title, bool content, string warn = "") +{ + EditorGUILayout.BeginHorizontal(); + GUILayout.Label(title, GUILayout.MinWidth(80), GUILayout.ExpandWidth(false)); + content = EditorGUILayout.Toggle(content); + if (content) + { + TextLabelWarn(warn); + } + EditorGUILayout.EndHorizontal(); + return content; +} + +private void TextLabel(string content, Color color = new Color()) +{ + if (color.Equals(Color.clear)) + { + color = Color.gray; + } + GUIStyle style = new GUIStyle(); + style.contentOffset = new Vector2(8, 0); + style.normal.textColor = color; + style.fontSize = 14; + style.padding = new RectOffset(0, 0, 3, 0); + GUILayout.Label(content, style); +} + +private void TextLabelWarn(string content) +{ + GUIStyle style = new GUIStyle(); + style.contentOffset = new Vector2(8, 0); + style.normal.textColor = Color.red; + style.fontSize = 14; + style.padding = new RectOffset(0, 0, 3, 0); + GUILayout.Label(content, style); +} + +private void DrawButton(string btnName, Action clickAction) +{ + if (GUILayout.Button(btnName, GUILayout.Width(100), GUILayout.Height(30))) + { + clickAction?.Invoke(); + } +} + +private void DrawButtonX(string btnName, Action clickAction) +{ + var originalBackgroundColor = GUI.backgroundColor; + + // 设置按钮的背景颜色 + GUI.backgroundColor = Color.red; + if (GUILayout.Button(btnName, GUILayout.Width(40), GUILayout.Height(18))) + { + clickAction?.Invoke(); + } + + GUI.backgroundColor = originalBackgroundColor; +} + +private void AddInterId() +{ + _emptyKwInterIdCount++; + SDKConfig.KwaiInterUnitId.Add(""); +} + +private void DelInterId(int index) +{ + _emptyKwInterIdCount--; + SDKConfig.KwaiInterUnitId.RemoveAt(index); +} + +private void AddRewardId() +{ + _emptyKwVideoIdCount++; + SDKConfig.KwaiVideoUnitId.Add(""); +} + +private void DelRewardId(int index) +{ + _emptyKwVideoIdCount--; + SDKConfig.KwaiVideoUnitId.RemoveAt(index); +} + +private void AddBigoInterId() +{ + _emptyBigoInterIdCount++; + SDKConfig.BigoInterUnitId.Add(""); +} + +private void DelBigoInterId(int index) +{ + _emptyBigoInterIdCount--; + SDKConfig.BigoInterUnitId.RemoveAt(index); +} + +private void AddBigoRewardId() +{ + _emptyBigoVideoIdCount++; + SDKConfig.BigoVideoUnitId.Add(""); +} + +private void DelBigoRewardId(int index) +{ + _emptyBigoVideoIdCount--; + SDKConfig.BigoVideoUnitId.RemoveAt(index); +} + +static void RemoveExtraEmptyStrings(List list, int count) +{ + int emptyCount = count; + if (list == null) return; + // 先统计空字符串的数量 + for (int i = list.Count - 1; i >= 0; i--) + { + if (string.IsNullOrEmpty(list[i])) + { + emptyCount++; + if (emptyCount > 1) + { + // 若空字符串数量超过 1,移除该元素 + list.RemoveAt(i); + } + } + } +} + +// ---------------------------- 参数解析 ------------------------------ +private string clipboardText = ""; +private Dictionary parsedParameters = new Dictionary(); +private readonly string _tooltipText = "需提前在参数列表界面 Ctrl + A 全选,然后再 Ctrl + C 复制"; + + +// 正则表达式模式字典,用于匹配不同类型的广告参数 +private static readonly Dictionary parameterPatterns = new Dictionary + { + // App基本信息 + { "App名称", @"App name\s*([^\n]+)" }, + { "AF Dev key", @"AF Dev key(?:[\s-]*iOS)?\s*([^\n]+)"}, + { "APP KEY", @"a\s*p\s*p\s*k\s*e\s*y\s*([^\n]+)"}, + { "APP Secret", @"a\s*p\s*p\s*s\s*e\s*c\s*r\s*e\s*t\s*([^\n]+)" }, + { "包名", @"(?:正式包名|测试包名|包名)\*?\s+([^\n]+)"}, + { "广告源", @"广告源\s*([^\n]+)" }, + { "开发者邮箱", @"开发者邮箱\s*([^\n]+)" }, + { "谷歌商店链接", @"谷歌商店链接\s*([^\n]+)" }, + { "官网链接", @"官网链接\s*([^\n]+)" }, + { "隐私协议", @"隐私协议\s*([^\n]+)" }, + { "业务上报域名", @"(?:业务上报域名|业务域名)\s*([^\n]+)" }, + { "appkey", @"appkey\s*([^\n]+)" }, + { "appsecret", @"appsecret\s*([^\n]+)" }, + {"AF Apple Appid", @"(?i)app\s*id(?:\s+id)*\s*[=:]*\s*([^\n]*)"}, + + // MAX (兼容多种格式) + { "MAX 激励视频", @"MAX参数(?:-[^\s]+)?[\s\S]*?(?:激励视频|激励1|激励2|客户端激励|bidding激励广告位ID|激励)\s*[""\r\n]*([^""\s\r\n]+)"}, + { "MAX 插屏", @"MAX参数(?:-[^\s]+)?[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*[""\r\n]*([^""\s\r\n]+)" }, + { "MAX SDK Key", @"MAX参数[\s\S]*?SDK key\*?\s*([^\n]+)" }, + { "MAX ad review key", @"MAX参数[\s\S]*?ad review key\*?\s*([^\n]+)" }, + + // BIGO (兼容多种格式) + { "BIGO 应用ID", @"BIGO参数[\s\S]*?(?:应用ID|appid)\s*([^\n]+)" }, + { "BIGO 激励", @"BIGO参数[\s\S]*?(?:激励|激励1|激励2|客户端激励|bidding激励广告位ID)\s*([^\n]+)" }, + { "BIGO 插屏", @"BIGO参数[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*([^\n]+)" }, + + // Kwai (兼容多种格式) + { "Kwai 应用ID", @"kwai参数[\s\S]*?(?:应用ID|appid)\s*([^\n]+)" }, + { "Kwai 激励", @"kwai参数[\s\S]*?(?:激励|激励1|激励2|客户端激励|bidding激励广告位ID)\s*([^\n]+)" }, + { "Kwai 插屏", @"kwai参数[\s\S]*?(?:插屏|插屏1|插屏2|客户端插屏|bidding插屏广告位ID)\s*([^\n]+)" }, + + // Admob (兼容多种格式) + { "Admob 应用ID", @"admob参数[\s\S]*?(?:应用ID|App ID)\s*([^\n]+)" }, + { "Admob 激励", @"admob参数[\s\S]*?(?:激励1|激励)\s*([^\n]+)" }, + { "Admob 插屏", @"admob参数[\s\S]*?(?:插屏1|插屏)\s*([^\n]+)" }, + { "Admob txt", @"admob参数[\s\S]*?txt\s*([^\n]+)" }, + + // Facebook (兼容多种格式) + { "FB appid", @"fb参数[\s\S]*?appid\s*([^\n]+)" }, + { "FB property_id", @"fb参数[\s\S]*?property_id\s*([^\n]+)" }, + { "FB 激励", @"fb参数[\s\S]*?激励\s*([^\n]+)" }, + { "FB 插屏", @"fb参数[\s\S]*?插屏\s*([^\n]+)" }, + { "FB txt", @"fb参数[\s\S]*?txt\s*([^\n]+)" }, + + // Topon (兼容多种格式) + // Topon (兼容多种格式) + { "Topon ID", @"(?i)topon[\s\S]*?ID[\t\s]+([^\r\n]+)" }, + { "Topon KEY", @"(?i)topon[\s\S]*?(?:App Key|KEY)[\t\s]+([^\r\n]+)" }, + { "Topon 激励", @"(?i)topon[\s\S]*?激励[\t\s]+([^\r\n]+)" }, + { "Topon 插屏", @"(?i)topon[\s\S]*?插屏[\t\s]+([^\r\n]+)" } + }; + +private void ParseClipboard() +{ + if (string.IsNullOrEmpty(clipboardText.Trim())) + { + clipboardText = EditorGUIUtility.systemCopyBuffer; + } + + parsedParameters.Clear(); + + foreach (var pattern in parameterPatterns) + { + Match match = Regex.Match(clipboardText, pattern.Value, RegexOptions.IgnoreCase); + if (match.Success) + { + // 处理可能有多个捕获组的情况(如BIGO和Kwai的两种格式) + for (int i = 1; i < match.Groups.Count; i++) + { + if (!string.IsNullOrEmpty(match.Groups[i].Value)) + { + parsedParameters[pattern.Key] = match.Groups[i].Value.Trim(); + break; + } + } + } + } + + UpdateConfig(); + EditorUtility.DisplayDialog("解析完成", + $"成功解析 {parsedParameters.Count} 个参数", "确定"); +} + +private void UpdateConfig() +{ + SDKConfig.Instance.bigoVideoUnitId ??= new List(); + SDKConfig.Instance.bigoVideoUnitId.Clear(); + SDKConfig.Instance.bigoInterUnitId ??= new List(); + SDKConfig.Instance.bigoInterUnitId.Clear(); + + SDKConfig.Instance.kwaiVideoUnitId ??= new List(); + SDKConfig.Instance.kwaiVideoUnitId.Clear(); + SDKConfig.Instance.kwaiInterUnitId ??= new List(); + SDKConfig.Instance.kwaiInterUnitId.Clear(); + + foreach (KeyValuePair pair in parsedParameters) + { + //Debug.Log($"KEY : {pair.Key}, VALUE : {pair.Value}"); + if (pair.Key.Contains("包名")) + { +#if UNITY_IOS + PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, pair.Value); +#elif UNITY_ANDROID + PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, pair.Value); +#endif + + Debug.Log($"包名设置 : {pair.Value}"); + } + + if (pair.Key.Contains("AF Dev key")) + { + Debug.Log($"AF Dev key: {pair.Value}"); + SDKConfig.Instance.appsFlyerDevKey = pair.Value; + } + +#if UNITY_IOS + + if (pair.Key.Contains("AF Apple Appid")) + { + Debug.Log($"AF Apple Appid: {pair.Value}"); + SDKConfig.Instance.appsFlyerIosAppleAppId = pair.Value; + } +#endif + + if (pair.Key.Contains("APP KEY")) + { + Debug.Log($"BI APP KEY: {pair.Value}"); + SDKConfig.Instance.appKey = pair.Value; + } + + if (pair.Key.Contains("APP Secret")) + { + Debug.Log($"BI APP Secret: {pair.Value}"); + SDKConfig.Instance.appSecret = pair.Value; + } + + if (pair.Key.Contains("域名")) + { + Debug.Log($"业务域名: {pair.Value}"); + SDKConfig.Instance.logReportUrl = pair.Value; + } + + if (pair.Key.Contains("Topon ID")) + { + Debug.Log($"Topon APP ID: {pair.Value}"); + SDKConfig.Instance.toponAppId = pair.Value; + } + + if (pair.Key.Contains("Topon KEY")) + { + Debug.Log($"Topon APP KEY: {pair.Value}"); + SDKConfig.Instance.toponAppkey = pair.Value; + } + + if (pair.Key.Contains("Topon 激励")) + { + Debug.Log($"Topon 激励: {pair.Value}"); + SDKConfig.Instance.toponVideoUnitId = pair.Value; + } + + if (pair.Key.Contains("Topon 插屏")) + { + Debug.Log($"Topon 插屏: {pair.Value}"); + SDKConfig.Instance.toponInterUnitId = pair.Value; + } + + if (pair.Key.Contains("MAX SDK Key")) + { + Debug.Log($"MAX SDK Key: {pair.Value}"); + SDKConfig.Instance.maxAppKey = pair.Value; + } + + if (pair.Key.Contains("MAX 激励视频")) + { + Debug.Log($"MAX 激励视频: {pair.Value}"); + SDKConfig.Instance.videoUnitId = pair.Value; + } + + if (pair.Key.Contains("MAX 插屏")) + { + Debug.Log($"MAX 插屏: {pair.Value}"); + SDKConfig.Instance.interUnitId = pair.Value; + } + + if (pair.Key.Contains("BIGO 应用ID")) + { + Debug.Log($"BIGO 应用ID: {pair.Value}"); + SDKConfig.Instance.bigoAppId = pair.Value; + } + + if (pair.Key.Contains("BIGO 激励")) + { + Debug.Log($"BIGO 激励: {pair.Value}"); + //SDKConfig.Instance.bigoVideoUnitId = pair.Value; + SDKConfig.Instance.bigoVideoUnitId ??= new List(); + SDKConfig.Instance.bigoVideoUnitId.Add(pair.Value); + } + + if (pair.Key.Contains("BIGO 插屏")) + { + Debug.Log($"BIGO 插屏: {pair.Value}"); + //SDKConfig.Instance.bigoInterUnitId = pair.Value; + SDKConfig.Instance.bigoInterUnitId ??= new List(); + SDKConfig.Instance.bigoInterUnitId.Add(pair.Value); + } + + if (pair.Key.Contains("Admob 应用ID")) + { + Debug.Log($"Admob 应用ID: {pair.Value}"); + //SDKConfig.Instance.admobAppId = pair.Value; + } + + if (pair.Key.Contains("Admob 激励")) + { + Debug.Log($"Admob 激励: {pair.Value}"); + } + + if (pair.Key.Contains("Admob 插屏")) + { + Debug.Log($"Admob 插屏: {pair.Value}"); + } + + if (pair.Key.Contains("Kwai 应用ID")) + { + Debug.Log($"Kwai 应用ID: {pair.Value}"); + SDKConfig.Instance.kwaiAppId = pair.Value; + } + + if (pair.Key.Contains("Kwai 激励")) + { + Debug.Log($"Kwai 激励: {pair.Value}"); + SDKConfig.Instance.kwaiVideoUnitId ??= new List(); + SDKConfig.Instance.kwaiVideoUnitId.Add(pair.Value); + } + + if (pair.Key.Contains("Kwai 插屏")) + { + Debug.Log($"Kwai 插屏: {pair.Value}"); + SDKConfig.Instance.kwaiInterUnitId ??= new List(); + SDKConfig.Instance.kwaiInterUnitId.Add(pair.Value); + } + } +} + +} diff --git a/Assets/MYp0ZVTT2QSDK/Editor/MYp0ZVTT2QSDKConfigEditor.cs.meta b/Assets/MYp0ZVTT2QSDK/Editor/MYp0ZVTT2QSDKConfigEditor.cs.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/Plugins/AcquireCountryCode.java b/Assets/MYp0ZVTT2QSDK/Plugins/AcquireCountryCode.java old mode 100644 new mode 100755 index 92b7306..c4a8d5b --- a/Assets/MYp0ZVTT2QSDK/Plugins/AcquireCountryCode.java +++ b/Assets/MYp0ZVTT2QSDK/Plugins/AcquireCountryCode.java @@ -1,17 +1,17 @@ -package com.tool.countrycode; -import android.app.Activity; -import java.util.Locale; -public class AcquireCountryCode { - // 获取国家码 - public static String getCountryCode() - { - Locale locale = Locale.getDefault(); - return locale.getCountry(); - } - - public static String getCountryCode3() { - Locale currentLocale = Locale.getDefault(); - return currentLocale.getISO3Country(); - } - +package com.tool.countrycode; +import android.app.Activity; +import java.util.Locale; +public class AcquireCountryCode { + // 获取国家码 + public static String getCountryCode() + { + Locale locale = Locale.getDefault(); + return locale.getCountry(); + } + + public static String getCountryCode3() { + Locale currentLocale = Locale.getDefault(); + return currentLocale.getISO3Country(); + } + } \ No newline at end of file diff --git a/Assets/MYp0ZVTT2QSDK/Plugins/AcquireCountryCode.java.meta b/Assets/MYp0ZVTT2QSDK/Plugins/AcquireCountryCode.java.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/Plugins/BouncyCastle.Cryptography.dll b/Assets/MYp0ZVTT2QSDK/Plugins/BouncyCastle.Cryptography.dll old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/Plugins/BouncyCastle.Cryptography.dll.meta b/Assets/MYp0ZVTT2QSDK/Plugins/BouncyCastle.Cryptography.dll.meta old mode 100644 new mode 100755 index 94c3e32..f60d3ff --- a/Assets/MYp0ZVTT2QSDK/Plugins/BouncyCastle.Cryptography.dll.meta +++ b/Assets/MYp0ZVTT2QSDK/Plugins/BouncyCastle.Cryptography.dll.meta @@ -1,33 +1,33 @@ -fileFormatVersion: 2 -guid: 6e3da5c7fe21c1347a563e64e8f305d4 -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 - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 6e3da5c7fe21c1347a563e64e8f305d4 +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 + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MYp0ZVTT2QSDK/Plugins/OPS.Obfuscator.dll b/Assets/MYp0ZVTT2QSDK/Plugins/OPS.Obfuscator.dll old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/Plugins/OPS.Obfuscator.dll.meta b/Assets/MYp0ZVTT2QSDK/Plugins/OPS.Obfuscator.dll.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/Plugins/iOS/CountryInfo.mm b/Assets/MYp0ZVTT2QSDK/Plugins/iOS/CountryInfo.mm old mode 100644 new mode 100755 index b618b36..09d2bec --- a/Assets/MYp0ZVTT2QSDK/Plugins/iOS/CountryInfo.mm +++ b/Assets/MYp0ZVTT2QSDK/Plugins/iOS/CountryInfo.mm @@ -1,12 +1,12 @@ -#import - -extern "C" { - __attribute__((visibility("default"))) - const char* _GetDeviceCountryCode() { - @autoreleasepool { - NSLocale *currentLocale = [NSLocale currentLocale]; - NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; - return strdup([countryCode UTF8String]); // 使用strdup确保内存安全 - } - } -} +#import + +extern "C" { + __attribute__((visibility("default"))) + const char* _GetDeviceCountryCode() { + @autoreleasepool { + NSLocale *currentLocale = [NSLocale currentLocale]; + NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; + return strdup([countryCode UTF8String]); // 使用strdup确保内存安全 + } + } +} diff --git a/Assets/MYp0ZVTT2QSDK/Plugins/iOS/CountryInfo.mm.meta b/Assets/MYp0ZVTT2QSDK/Plugins/iOS/CountryInfo.mm.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.asmdef b/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.asmdef old mode 100644 new mode 100755 index 28a7469..bd836f1 --- a/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.asmdef +++ b/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.asmdef @@ -1,14 +1,14 @@ -{ - "name": "SDKConfig", - "rootNamespace": "", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false +{ + "name": "SDKConfig", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.asmdef.meta b/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.asmdef.meta old mode 100644 new mode 100755 index 74f1efc..7e1dac2 --- a/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.asmdef.meta +++ b/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.asmdef.meta @@ -1,7 +1,7 @@ -fileFormatVersion: 2 -guid: 8b6da46957b38914aa097a61bd86a16d -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 8b6da46957b38914aa097a61bd86a16d +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.cs b/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.cs old mode 100644 new mode 100755 index 2042882..7f882fc --- a/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.cs +++ b/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.cs @@ -1,234 +1,234 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace MYp0ZVTT2QSDK -{ - [System.Serializable] - public class SDKConfig : ScriptableObject - { - - public string appsFlyerDevKey; - - public string appsFlyerIosAppleAppId; - - public string appKey; - - public string appSecret; - - public string logReportUrl; - - public string maxAppKey; - - public string splashUnitId; - - public string bannerUnitId; - - public string interUnitId; - - public string videoUnitId; - - public string kwaiAppId; - - public List kwaiVideoUnitId = new(); - - public List kwaiInterUnitId = new(); - - public string bigoAppId; - - public List bigoVideoUnitId = new(); - - public List bigoInterUnitId = new(); - - public string bigoSplashUnitId; - - public string toponAppId; - - public string toponAppkey; - - public string toponVideoUnitId; - - public string toponInterUnitId; - - public string admobAppId; - - public string admobVideoUnitId; - - public string admobInterUnitId; - - public string admobSplashUnitId; - - public bool isDebug = false; - - public bool isPrintLog = false; - - public bool isUseAdmobSplash = false; - - private static SDKConfig _instance; - - public static SDKConfig Instance - { - get - { - if (_instance != null) return _instance; - _instance = AssetUtils.GetScriptableObject(typeof(SDKConfig).Name, "Assets/Resources", false, false); - return _instance; - } - set - { - _instance = value; - } - } - - public static string AppsFlyerDevKey - { - get { return Instance.appsFlyerDevKey; } - } - - public static string AppsFlyerIosAppleAppId - { - get { return Instance.appsFlyerIosAppleAppId; } - } - - public static string AppKey - { - get { return Instance.appKey; } - } - - public static string AppSecret - { - get { return Instance.appSecret; } - } - - public static string LogReportUrl - { - get - { - if (!Instance.logReportUrl.StartsWith("http")) - { - return "https://" + Instance.logReportUrl.Replace(" ", ""); ; - } - return Instance.logReportUrl.Replace(" ", ""); ; - } - } - - public static string MaxAppKey - { - get { return Instance.maxAppKey; } - } - - public static string SplashUnitID - { - get { return Instance.splashUnitId; } - } - - public static string BannerUnitId - { - get { return Instance.bannerUnitId; } - } - - public static string InterUnitId - { - get { return Instance.interUnitId; } - } - - public static string VideoUnitId - { - get { return Instance.videoUnitId; } - } - - public static string KwaiAppId - { - get => Instance.kwaiAppId; - set => Instance.kwaiAppId = value; - } - - public static List KwaiVideoUnitId - { - get => Instance.kwaiVideoUnitId; - set => Instance.kwaiVideoUnitId = value; - } - - public static List KwaiInterUnitId - { - get => Instance.kwaiInterUnitId; - set => Instance.kwaiInterUnitId = value; - } - - public static string BigoAppId - { - get => Instance.bigoAppId; - set => Instance.bigoAppId = value; - } - - public static List BigoVideoUnitId - { - get => Instance.bigoVideoUnitId; - set => Instance.bigoVideoUnitId = value; - } - - public static List BigoInterUnitId - { - get => Instance.bigoInterUnitId; - set => Instance.bigoInterUnitId = value; - } - - public static string BigoSplashUnitId - { - get => Instance.bigoSplashUnitId; - set => Instance.bigoSplashUnitId = value; - } - - public static string ToponAppId - { - get { return Instance.toponAppId; } - } - - public static string ToponAppkey - { - get { return Instance.toponAppkey; } - } - - public static string ToponVideoUnitId - { - get { return Instance.toponVideoUnitId; } - } - - public static string ToponInterUnitId - { - get { return Instance.toponInterUnitId; } - } - - public static string AdmobAppId - { - get => Instance.admobAppId; - set => Instance.admobAppId = value; - } - - public static string AdmobVideoUnitId - { - get => Instance.admobVideoUnitId; - set => Instance.admobVideoUnitId = value; - } - - public static string AdmobSplashUnitId - { - get => Instance.admobSplashUnitId; - set => Instance.admobSplashUnitId = value; - } - - public static string AdmobInterUnitId - { - get => Instance.admobInterUnitId; - set => Instance.admobInterUnitId = value; - } - - public static bool IsDebug => Instance.isDebug; - - public static bool IsPrintLog => Instance.isPrintLog; - - public static bool IsUseAdmobSplash => Instance.isUseAdmobSplash; - - } -} - +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MYp0ZVTT2QSDK +{ + [System.Serializable] + public class SDKConfig : ScriptableObject + { + + public string appsFlyerDevKey; + + public string appsFlyerIosAppleAppId; + + public string appKey; + + public string appSecret; + + public string logReportUrl; + + public string maxAppKey; + + public string splashUnitId; + + public string bannerUnitId; + + public string interUnitId; + + public string videoUnitId; + + public string kwaiAppId; + + public List kwaiVideoUnitId = new(); + + public List kwaiInterUnitId = new(); + + public string bigoAppId; + + public List bigoVideoUnitId = new(); + + public List bigoInterUnitId = new(); + + public string bigoSplashUnitId; + + public string toponAppId; + + public string toponAppkey; + + public string toponVideoUnitId; + + public string toponInterUnitId; + + public string admobAppId; + + public string admobVideoUnitId; + + public string admobInterUnitId; + + public string admobSplashUnitId; + + public bool isDebug = false; + + public bool isPrintLog = false; + + public bool isUseAdmobSplash = false; + + private static SDKConfig _instance; + + public static SDKConfig Instance + { + get + { + if (_instance != null) return _instance; + _instance = AssetUtils.GetScriptableObject(typeof(SDKConfig).Name, "Assets/Resources", false, false); + return _instance; + } + set + { + _instance = value; + } + } + + public static string AppsFlyerDevKey + { + get { return Instance.appsFlyerDevKey; } + } + + public static string AppsFlyerIosAppleAppId + { + get { return Instance.appsFlyerIosAppleAppId; } + } + + public static string AppKey + { + get { return Instance.appKey; } + } + + public static string AppSecret + { + get { return Instance.appSecret; } + } + + public static string LogReportUrl + { + get + { + if (!Instance.logReportUrl.StartsWith("http")) + { + return "https://" + Instance.logReportUrl.Replace(" ", ""); ; + } + return Instance.logReportUrl.Replace(" ", ""); ; + } + } + + public static string MaxAppKey + { + get { return Instance.maxAppKey; } + } + + public static string SplashUnitID + { + get { return Instance.splashUnitId; } + } + + public static string BannerUnitId + { + get { return Instance.bannerUnitId; } + } + + public static string InterUnitId + { + get { return Instance.interUnitId; } + } + + public static string VideoUnitId + { + get { return Instance.videoUnitId; } + } + + public static string KwaiAppId + { + get => Instance.kwaiAppId; + set => Instance.kwaiAppId = value; + } + + public static List KwaiVideoUnitId + { + get => Instance.kwaiVideoUnitId; + set => Instance.kwaiVideoUnitId = value; + } + + public static List KwaiInterUnitId + { + get => Instance.kwaiInterUnitId; + set => Instance.kwaiInterUnitId = value; + } + + public static string BigoAppId + { + get => Instance.bigoAppId; + set => Instance.bigoAppId = value; + } + + public static List BigoVideoUnitId + { + get => Instance.bigoVideoUnitId; + set => Instance.bigoVideoUnitId = value; + } + + public static List BigoInterUnitId + { + get => Instance.bigoInterUnitId; + set => Instance.bigoInterUnitId = value; + } + + public static string BigoSplashUnitId + { + get => Instance.bigoSplashUnitId; + set => Instance.bigoSplashUnitId = value; + } + + public static string ToponAppId + { + get { return Instance.toponAppId; } + } + + public static string ToponAppkey + { + get { return Instance.toponAppkey; } + } + + public static string ToponVideoUnitId + { + get { return Instance.toponVideoUnitId; } + } + + public static string ToponInterUnitId + { + get { return Instance.toponInterUnitId; } + } + + public static string AdmobAppId + { + get => Instance.admobAppId; + set => Instance.admobAppId = value; + } + + public static string AdmobVideoUnitId + { + get => Instance.admobVideoUnitId; + set => Instance.admobVideoUnitId = value; + } + + public static string AdmobSplashUnitId + { + get => Instance.admobSplashUnitId; + set => Instance.admobSplashUnitId = value; + } + + public static string AdmobInterUnitId + { + get => Instance.admobInterUnitId; + set => Instance.admobInterUnitId = value; + } + + public static bool IsDebug => Instance.isDebug; + + public static bool IsPrintLog => Instance.isPrintLog; + + public static bool IsUseAdmobSplash => Instance.isUseAdmobSplash; + + } +} + diff --git a/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.cs.meta b/Assets/MYp0ZVTT2QSDK/Scripts/Config/SDKConfig.cs.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/Scripts/Config/Utils/AssetUtils.cs b/Assets/MYp0ZVTT2QSDK/Scripts/Config/Utils/AssetUtils.cs old mode 100644 new mode 100755 index 08e72cf..3bcc584 --- a/Assets/MYp0ZVTT2QSDK/Scripts/Config/Utils/AssetUtils.cs +++ b/Assets/MYp0ZVTT2QSDK/Scripts/Config/Utils/AssetUtils.cs @@ -1,152 +1,152 @@ - -using System; -using System.IO; -using UnityEngine; - -#if UNITY_EDITOR -using System.Collections.Generic; -using UnityEditor; -#endif - -namespace MYp0ZVTT2QSDK -{ - public static class AssetUtils - { - /// - /// Returns a reference to a scriptable object of type T with the given fileName at the relative resourcesPath. - /// If the asset is not found, one will get created automatically (in the Editor only) - /// - /// - /// - /// - /// - /// - /// - public static T GetScriptableObject(string fileName, - string resourcesPath, - bool saveAssetDatabase, - bool refreshAssetDatabase) - where T : ScriptableObject - { - if (string.IsNullOrEmpty(resourcesPath)) return null; - if (string.IsNullOrEmpty(fileName)) return null; - // ReSharper disable once SuspiciousTypeConversion.Global - // if (!resourcesPath[resourcesPath.Length - 1].Equals(@"\")) resourcesPath += @"\"; - // resourcesPath = resourcesPath.Replace(@"\", "/"); - resourcesPath = CleanPath(resourcesPath); - - var obj = (T)Resources.Load(fileName, typeof(T)); - - if (obj == null) - { - string simpleResourcesPath = resourcesPath.Replace(resourcesPath.Substring(0, resourcesPath.LastIndexOf("Resources", StringComparison.Ordinal)), ""); - simpleResourcesPath = simpleResourcesPath.Replace("Resources", "").Remove(0, 1); - obj = (T)Resources.Load(Path.Combine(simpleResourcesPath, fileName), typeof(T)); - } - -#if UNITY_EDITOR - if (obj != null) return obj; - if (!Directory.Exists("Assets/Resources")) - { - Directory.CreateDirectory("Assets/Resources"); - } - obj = CreateAsset(resourcesPath, fileName, ".asset", saveAssetDatabase, refreshAssetDatabase); -#endif - return obj; - } - - public static T GetResource(string resourcesPath, string fileName) where T : ScriptableObject - { - if (string.IsNullOrEmpty(resourcesPath)) return null; - if (string.IsNullOrEmpty(fileName)) return null; - resourcesPath = CleanPath(resourcesPath); - // ReSharper disable once SuspiciousTypeConversion.Global - // if (!resourcesPath[resourcesPath.Length - 1].Equals(@"\")) resourcesPath += @"\"; - // resourcesPath = resourcesPath.Replace(@"\", "/"); - - return (T)Resources.Load(resourcesPath + fileName, typeof(T)); - } - - public static string CleanPath(string path) - { - // ReSharper disable once SuspiciousTypeConversion.Global - if (!path[path.Length - 1].Equals(@"\")) path += @"\"; - path = path.Replace(@"\\", @"\"); - path = path.Replace(@"\", "/"); - return path; - } - -#if UNITY_EDITOR - public static T CreateAsset(string relativePath, - string fileName, - string extension = ".asset", - bool saveAssetDatabase = true, - bool refreshAssetDatabase = true) - where T : ScriptableObject - { - if (string.IsNullOrEmpty(relativePath)) return null; - if (string.IsNullOrEmpty(fileName)) return null; - relativePath = CleanPath(relativePath); - // ReSharper disable once SuspiciousTypeConversion.Global - // if (!relativePath[relativePath.Length - 1].Equals(@"\")) relativePath += @"\"; - // relativePath = relativePath.Replace(@"\\", @"\"); - var asset = ScriptableObject.CreateInstance(); - AssetDatabase.CreateAsset(asset, relativePath + fileName + extension); - EditorUtility.SetDirty(asset); - if (saveAssetDatabase) AssetDatabase.SaveAssets(); - if (refreshAssetDatabase) AssetDatabase.Refresh(); - return asset; - } - - public static List GetAssets() where T : ScriptableObject - { - var list = new List(); - string[] guids = AssetDatabase.FindAssets("t:" + typeof(T).Name); - foreach (string guid in guids) - { - var asset = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid)); - if (asset == null) continue; - list.Add(asset); - } - - return list; - } - - public static void MoveAssetToTrash(string relativePath, string fileName, bool saveAssetDatabase = true, - bool refreshAssetDatabase = true, bool printDebugMessage = true) - { - if (string.IsNullOrEmpty(relativePath)) return; - if (string.IsNullOrEmpty(fileName)) return; - // ReSharper disable once SuspiciousTypeConversion.Global - // if (!relativePath[relativePath.Length - 1].Equals(@"\")) relativePath += @"\"; - relativePath = CleanPath(relativePath); - if (!AssetDatabase.MoveAssetToTrash(relativePath + fileName + ".asset")) return; - if (printDebugMessage) Debug.Log("The " + fileName + ".asset file has been moved to trash."); - if (saveAssetDatabase) AssetDatabase.SaveAssets(); - if (refreshAssetDatabase) AssetDatabase.Refresh(); - } - - public static Texture GetTexture(string filePath, string fileName, string fileExtension = ".png") - { - if (string.IsNullOrEmpty(filePath)) return null; - if (string.IsNullOrEmpty(fileName)) return null; - // ReSharper disable once SuspiciousTypeConversion.Global - // if (!filePath[filePath.Length - 1].Equals(@"\")) filePath += @"\"; - filePath = CleanPath(filePath); - return AssetDatabase.LoadAssetAtPath(filePath + fileName + fileExtension); - } - - public static Texture2D GetTexture2D(string filePath, string fileName, string fileExtension = ".png") - { - if (string.IsNullOrEmpty(filePath)) return null; - if (string.IsNullOrEmpty(fileName)) return null; - // ReSharper disable once SuspiciousTypeConversion.Global - // if (!filePath[filePath.Length - 1].Equals(@"\")) filePath += @"\"; - filePath = CleanPath(filePath); - return AssetDatabase.LoadAssetAtPath(filePath + fileName + fileExtension); - } -#endif - } - -} - + +using System; +using System.IO; +using UnityEngine; + +#if UNITY_EDITOR +using System.Collections.Generic; +using UnityEditor; +#endif + +namespace MYp0ZVTT2QSDK +{ + public static class AssetUtils + { + /// + /// Returns a reference to a scriptable object of type T with the given fileName at the relative resourcesPath. + /// If the asset is not found, one will get created automatically (in the Editor only) + /// + /// + /// + /// + /// + /// + /// + public static T GetScriptableObject(string fileName, + string resourcesPath, + bool saveAssetDatabase, + bool refreshAssetDatabase) + where T : ScriptableObject + { + if (string.IsNullOrEmpty(resourcesPath)) return null; + if (string.IsNullOrEmpty(fileName)) return null; + // ReSharper disable once SuspiciousTypeConversion.Global + // if (!resourcesPath[resourcesPath.Length - 1].Equals(@"\")) resourcesPath += @"\"; + // resourcesPath = resourcesPath.Replace(@"\", "/"); + resourcesPath = CleanPath(resourcesPath); + + var obj = (T)Resources.Load(fileName, typeof(T)); + + if (obj == null) + { + string simpleResourcesPath = resourcesPath.Replace(resourcesPath.Substring(0, resourcesPath.LastIndexOf("Resources", StringComparison.Ordinal)), ""); + simpleResourcesPath = simpleResourcesPath.Replace("Resources", "").Remove(0, 1); + obj = (T)Resources.Load(Path.Combine(simpleResourcesPath, fileName), typeof(T)); + } + +#if UNITY_EDITOR + if (obj != null) return obj; + if (!Directory.Exists("Assets/Resources")) + { + Directory.CreateDirectory("Assets/Resources"); + } + obj = CreateAsset(resourcesPath, fileName, ".asset", saveAssetDatabase, refreshAssetDatabase); +#endif + return obj; + } + + public static T GetResource(string resourcesPath, string fileName) where T : ScriptableObject + { + if (string.IsNullOrEmpty(resourcesPath)) return null; + if (string.IsNullOrEmpty(fileName)) return null; + resourcesPath = CleanPath(resourcesPath); + // ReSharper disable once SuspiciousTypeConversion.Global + // if (!resourcesPath[resourcesPath.Length - 1].Equals(@"\")) resourcesPath += @"\"; + // resourcesPath = resourcesPath.Replace(@"\", "/"); + + return (T)Resources.Load(resourcesPath + fileName, typeof(T)); + } + + public static string CleanPath(string path) + { + // ReSharper disable once SuspiciousTypeConversion.Global + if (!path[path.Length - 1].Equals(@"\")) path += @"\"; + path = path.Replace(@"\\", @"\"); + path = path.Replace(@"\", "/"); + return path; + } + +#if UNITY_EDITOR + public static T CreateAsset(string relativePath, + string fileName, + string extension = ".asset", + bool saveAssetDatabase = true, + bool refreshAssetDatabase = true) + where T : ScriptableObject + { + if (string.IsNullOrEmpty(relativePath)) return null; + if (string.IsNullOrEmpty(fileName)) return null; + relativePath = CleanPath(relativePath); + // ReSharper disable once SuspiciousTypeConversion.Global + // if (!relativePath[relativePath.Length - 1].Equals(@"\")) relativePath += @"\"; + // relativePath = relativePath.Replace(@"\\", @"\"); + var asset = ScriptableObject.CreateInstance(); + AssetDatabase.CreateAsset(asset, relativePath + fileName + extension); + EditorUtility.SetDirty(asset); + if (saveAssetDatabase) AssetDatabase.SaveAssets(); + if (refreshAssetDatabase) AssetDatabase.Refresh(); + return asset; + } + + public static List GetAssets() where T : ScriptableObject + { + var list = new List(); + string[] guids = AssetDatabase.FindAssets("t:" + typeof(T).Name); + foreach (string guid in guids) + { + var asset = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid)); + if (asset == null) continue; + list.Add(asset); + } + + return list; + } + + public static void MoveAssetToTrash(string relativePath, string fileName, bool saveAssetDatabase = true, + bool refreshAssetDatabase = true, bool printDebugMessage = true) + { + if (string.IsNullOrEmpty(relativePath)) return; + if (string.IsNullOrEmpty(fileName)) return; + // ReSharper disable once SuspiciousTypeConversion.Global + // if (!relativePath[relativePath.Length - 1].Equals(@"\")) relativePath += @"\"; + relativePath = CleanPath(relativePath); + if (!AssetDatabase.MoveAssetToTrash(relativePath + fileName + ".asset")) return; + if (printDebugMessage) Debug.Log("The " + fileName + ".asset file has been moved to trash."); + if (saveAssetDatabase) AssetDatabase.SaveAssets(); + if (refreshAssetDatabase) AssetDatabase.Refresh(); + } + + public static Texture GetTexture(string filePath, string fileName, string fileExtension = ".png") + { + if (string.IsNullOrEmpty(filePath)) return null; + if (string.IsNullOrEmpty(fileName)) return null; + // ReSharper disable once SuspiciousTypeConversion.Global + // if (!filePath[filePath.Length - 1].Equals(@"\")) filePath += @"\"; + filePath = CleanPath(filePath); + return AssetDatabase.LoadAssetAtPath(filePath + fileName + fileExtension); + } + + public static Texture2D GetTexture2D(string filePath, string fileName, string fileExtension = ".png") + { + if (string.IsNullOrEmpty(filePath)) return null; + if (string.IsNullOrEmpty(fileName)) return null; + // ReSharper disable once SuspiciousTypeConversion.Global + // if (!filePath[filePath.Length - 1].Equals(@"\")) filePath += @"\"; + filePath = CleanPath(filePath); + return AssetDatabase.LoadAssetAtPath(filePath + fileName + fileExtension); + } +#endif + } + +} + diff --git a/Assets/MYp0ZVTT2QSDK/Scripts/Config/Utils/AssetUtils.cs.meta b/Assets/MYp0ZVTT2QSDK/Scripts/Config/Utils/AssetUtils.cs.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/Info.plist b/Assets/MYp0ZVTT2QSDK/ThirdParty/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/Info.plist old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle b/Assets/MYp0ZVTT2QSDK/ThirdParty/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/MacOS/AppsFlyerBundle old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/_CodeSignature/CodeResources b/Assets/MYp0ZVTT2QSDK/ThirdParty/AppsFlyer/Mac/AppsFlyerBundle.bundle/Contents/_CodeSignature/CodeResources old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/BigoAds.asmdef b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/BigoAds.asmdef old mode 100644 new mode 100755 index c712877..2051c3a --- a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/BigoAds.asmdef +++ b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/BigoAds.asmdef @@ -1,3 +1,3 @@ -{ - "name": "BigoAds" -} +{ + "name": "BigoAds" +} diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/BigoAds.asmdef.meta b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/BigoAds.asmdef.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/Scripts/Platforms/Android/AdHelper.java b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/Scripts/Platforms/Android/AdHelper.java old mode 100644 new mode 100755 index 9874007..6900850 --- a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/Scripts/Platforms/Android/AdHelper.java +++ b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/Scripts/Platforms/Android/AdHelper.java @@ -1,106 +1,106 @@ -package sg.bigo.ads; - -import android.app.Activity; -import android.content.Context; -import android.os.Handler; -import android.os.Looper; -import android.util.Log; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.TextView; - -import java.util.ArrayList; -import java.util.List; - -import sg.bigo.ads.api.AdOptionsView; -import sg.bigo.ads.api.AdTag; -import sg.bigo.ads.api.MediaView; -import sg.bigo.ads.api.NativeAd; - -public class AdHelper { - - public static void postToAndroidMainThread(Runnable runnable) { - new Handler(Looper.getMainLooper()).post(runnable); - } - - public static void addAdView(Activity activity, View adView, int position) { - if (adView == null) return; - ViewGroup contentView = activity.findViewById(android.R.id.content); - String tag = "ad_container"; - ViewGroup adContainer = contentView.findViewWithTag(tag); - if (adContainer == null) { - adContainer = new FrameLayout(activity); - adContainer.setTag(tag); - } - contentView.removeView(adContainer); - FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, position); - contentView.addView(adContainer, layoutParams); - adContainer.removeAllViews(); - adContainer.addView(adView); - } - - public static void removeAdView(Activity activity) - { - ViewGroup contentView = activity.findViewById(android.R.id.content); - String tag = "ad_container"; - ViewGroup adContainer = contentView.findViewWithTag(tag); - if (adContainer == null) return; - adContainer.removeAllViews(); - } - - public static int getLayoutIdByResName(Activity activity, String resName) { - return activity.getResources().getIdentifier(resName, "layout", activity.getPackageName()); - } - - public static int getDrawableIdByResName(Activity activity, String resName) { - return activity.getResources().getIdentifier(resName, "drawable", activity.getPackageName()); - } - - public static View renderNativeAdView(Activity activity, NativeAd nativeAd, String layoutResName) { - int layoutId = getLayoutIdByResName(activity, layoutResName); - if (layoutId <= 0) { - Log.w("BigoAds-Unity", "Invalid res name: " + layoutResName); - return null; - } - View view = LayoutInflater.from(activity).inflate(layoutId, null, false); - if (!(view instanceof ViewGroup)) { - return view; - } - ViewGroup nativeView = (ViewGroup) view; - TextView titleView = findViewByIdName(nativeView, "native_title"); - TextView descriptionView = findViewByIdName(nativeView, "native_description"); - TextView warningView = findViewByIdName(nativeView, "native_warning"); - Button ctaButton = findViewByIdName(nativeView, "native_cta"); - MediaView mediaView = findViewByIdName(nativeView, "native_media_view"); - ImageView iconView = findViewByIdName(nativeView, "native_icon_view"); - AdOptionsView optionsView = findViewByIdName(nativeView, "native_option_view"); - - titleView.setTag(AdTag.TITLE); - descriptionView.setTag(AdTag.DESCRIPTION); - warningView.setTag(AdTag.WARNING); - ctaButton.setTag(AdTag.CALL_TO_ACTION); - - titleView.setText(nativeAd.getTitle()); - descriptionView.setText(nativeAd.getDescription()); - warningView.setText(nativeAd.getWarning()); - ctaButton.setText(nativeAd.getCallToAction()); - - List clickableViews = new ArrayList<>(); - clickableViews.add(titleView); - clickableViews.add(descriptionView); - clickableViews.add(ctaButton); - nativeAd.registerViewForInteraction(nativeView, mediaView, iconView, optionsView, clickableViews); - return nativeView; - } - - private static T findViewByIdName(ViewGroup parent, String name) { - Context context = parent.getContext(); - int id = context.getResources().getIdentifier(name, "id", context.getPackageName()); - return parent.findViewById(id); - } -} +package sg.bigo.ads; + +import android.app.Activity; +import android.content.Context; +import android.os.Handler; +import android.os.Looper; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +import sg.bigo.ads.api.AdOptionsView; +import sg.bigo.ads.api.AdTag; +import sg.bigo.ads.api.MediaView; +import sg.bigo.ads.api.NativeAd; + +public class AdHelper { + + public static void postToAndroidMainThread(Runnable runnable) { + new Handler(Looper.getMainLooper()).post(runnable); + } + + public static void addAdView(Activity activity, View adView, int position) { + if (adView == null) return; + ViewGroup contentView = activity.findViewById(android.R.id.content); + String tag = "ad_container"; + ViewGroup adContainer = contentView.findViewWithTag(tag); + if (adContainer == null) { + adContainer = new FrameLayout(activity); + adContainer.setTag(tag); + } + contentView.removeView(adContainer); + FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, position); + contentView.addView(adContainer, layoutParams); + adContainer.removeAllViews(); + adContainer.addView(adView); + } + + public static void removeAdView(Activity activity) + { + ViewGroup contentView = activity.findViewById(android.R.id.content); + String tag = "ad_container"; + ViewGroup adContainer = contentView.findViewWithTag(tag); + if (adContainer == null) return; + adContainer.removeAllViews(); + } + + public static int getLayoutIdByResName(Activity activity, String resName) { + return activity.getResources().getIdentifier(resName, "layout", activity.getPackageName()); + } + + public static int getDrawableIdByResName(Activity activity, String resName) { + return activity.getResources().getIdentifier(resName, "drawable", activity.getPackageName()); + } + + public static View renderNativeAdView(Activity activity, NativeAd nativeAd, String layoutResName) { + int layoutId = getLayoutIdByResName(activity, layoutResName); + if (layoutId <= 0) { + Log.w("BigoAds-Unity", "Invalid res name: " + layoutResName); + return null; + } + View view = LayoutInflater.from(activity).inflate(layoutId, null, false); + if (!(view instanceof ViewGroup)) { + return view; + } + ViewGroup nativeView = (ViewGroup) view; + TextView titleView = findViewByIdName(nativeView, "native_title"); + TextView descriptionView = findViewByIdName(nativeView, "native_description"); + TextView warningView = findViewByIdName(nativeView, "native_warning"); + Button ctaButton = findViewByIdName(nativeView, "native_cta"); + MediaView mediaView = findViewByIdName(nativeView, "native_media_view"); + ImageView iconView = findViewByIdName(nativeView, "native_icon_view"); + AdOptionsView optionsView = findViewByIdName(nativeView, "native_option_view"); + + titleView.setTag(AdTag.TITLE); + descriptionView.setTag(AdTag.DESCRIPTION); + warningView.setTag(AdTag.WARNING); + ctaButton.setTag(AdTag.CALL_TO_ACTION); + + titleView.setText(nativeAd.getTitle()); + descriptionView.setText(nativeAd.getDescription()); + warningView.setText(nativeAd.getWarning()); + ctaButton.setText(nativeAd.getCallToAction()); + + List clickableViews = new ArrayList<>(); + clickableViews.add(titleView); + clickableViews.add(descriptionView); + clickableViews.add(ctaButton); + nativeAd.registerViewForInteraction(nativeView, mediaView, iconView, optionsView, clickableViews); + return nativeView; + } + + private static T findViewByIdName(ViewGroup parent, String name) { + Context context = parent.getContext(); + int id = context.getResources().getIdentifier(name, "id", context.getPackageName()); + return parent.findViewById(id); + } +} diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/Scripts/Platforms/Android/AdHelper.java.meta b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoAds/Scripts/Platforms/Android/AdHelper.java.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoSDK/Editor/Dependencies.xml b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoSDK/Editor/Dependencies.xml old mode 100644 new mode 100755 index cd51a2f..c0b0346 --- a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoSDK/Editor/Dependencies.xml +++ b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoSDK/Editor/Dependencies.xml @@ -1,13 +1,13 @@ - - - - - - - - - https://repo1.maven.org/maven2/ - - - - + + + + + + + + + https://repo1.maven.org/maven2/ + + + + diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoSDK/Editor/Dependencies.xml.meta b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/BigoSDK/Editor/Dependencies.xml.meta old mode 100644 new mode 100755 diff --git a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/Plugins/Android/res/layout/layout_bigo_native_ad.xml b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/Plugins/Android/res/layout/layout_bigo_native_ad.xml old mode 100644 new mode 100755 index e4c1ffc..27f9078 --- a/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/Plugins/Android/res/layout/layout_bigo_native_ad.xml +++ b/Assets/MYp0ZVTT2QSDK/ThirdParty/BigoAdsAll/Plugins/Android/res/layout/layout_bigo_native_ad.xml @@ -1,104 +1,104 @@ - - - - - - - - - - - - - - - -