提交项目

This commit is contained in:
2026-06-12 10:11:36 +08:00
commit 65acce7dde
5920 changed files with 629434 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#import <Foundation/Foundation.h>
// 如果 DataEyeSDK 是一个需要被引用的外部库或框架,确保已经正确导入
// #import <DataEyeSDK/DataEyeSDK.h> // 或者使用正确的导入语句
@interface EventMark : NSObject
// 单例实例的类方法
+ (instancetype)sharedEventMark;
// 初始化 DataEyeSDK 的方法(在单例的 init 方法中自动调用,外部无需直接调用)
- (void)initDataEyeSDK;
// 追踪产品购买事件的方法
- (void)trackProduct:(NSString *)eventName dictionaryJson:(NSString *)dictionaryJson ;
@end
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 7e5d2cff218e24bf6bd34828099eca28
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:
+78
View File
@@ -0,0 +1,78 @@
#import "EventMark.h"
#import <DataEyeSDK.h>
@interface EventMark ()
@property (nonatomic, strong) DataEyeSDK *dataEyeInstance;
@end
@implementation EventMark
// 静态实例变量
static EventMark *sharedInstance = nil;
// 类方法,用于获取单例实例
+ (instancetype)sharedEventMark {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
// 初始化 DataEyeSDK 的方法
- (void)initDataEyeSDK {
// NSLog(@"barry initDataEyeSDK-------");
DEConfig *config = [[DEConfig alloc] init];
config.appid = @"13355";
config.configureURL = @"https://yu.frozenarena.top";
config.debugMode = DataEyeDebug;
DataEyeSDK * instance = [DataEyeSDK startWithConfig:config];
NSDictionary *superProperties = @{
@"channel": @"ta",
@"age": @1,
@"isSuccess": @YES,
@"birthday": [NSDate date],
@"object": @{
@"key":@"value"
},
@"object_arr":@[
@{
@"key":@"value"
}
],
@"arr": @[@"value"],
};
[instance setSuperProperties:superProperties];
[instance enableAutoTrack:DataEyeEventTypeAppStart |//APP 启动事件,记录 APP 启动或从后台恢复
DataEyeEventTypeAppInstall |//APP 安装,记录 APP 被安装的日志
DataEyeEventTypeAppEnd |//APP 关闭事件,记录 APP 调入后台
DataEyeEventTypeAppViewScreen |//APP 浏览页面事件
DataEyeEventTypeAppClick |//APP 点击控件事件
DataEyeEventTypeAppViewCrash];//APP 崩溃事件
// NSDictionary *eventProperties = @{@"new_head": @"100"};
// [instance track:@"product_buy" properties:eventProperties];
NSString *device = [instance getDeviceId];
// NSLog(@"barry initDataEyeSDK11-------%@",device);
// [self trackProduct: @"100"];
}
// 追踪产品购买事件的方法
//- (void)trackProduct:(NSString *) data_ {
//
// NSLog(@"barry trackProduct-------%@",data_);
// NSDictionary *eventProperties = data_;
// [self.dataEyeInstance track:@"test_event" properties:eventProperties];
//}
@end
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: bbcfa9c4a568b4b96ba1642c6b2530cf
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:
+7
View File
@@ -0,0 +1,7 @@
#import <Foundation/Foundation.h>
@interface iOSBridgePlugin : NSObject
+ (void)openURL:(NSString *)url;
+ (void)ShezhiACT:(bool)act;
@end
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 8290c5c98e2884e778baa82e6dc1218d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:
+125
View File
@@ -0,0 +1,125 @@
#import "iOSBridgePlugin.h"
#import <UIKit/UIKit.h>
#import <EventMark.h>
@implementation iOSBridgePlugin
+ (void)openURL:(NSString *)url1
{
// 使用UIApplication的openURL方法打开外部浏览器
NSURL *url = [NSURL URLWithString:url1];
if (url && [[UIApplication sharedApplication] canOpenURL:url]) {
// 使用iOS 10及以上版本推荐的方法
[[UIApplication sharedApplication] openURL:url
options:@{}
completionHandler:nil];
} else {
// URL无效或无法打开
NSLog(@"Invalid URL or cannot open URL: %@", url1);
}
}
+ (void)ShezhiACT:(bool)act
{
if(act){
UIWindow *keyWindow = nil;
for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
if (windowScene.activationState == UISceneActivationStateForegroundActive) {
keyWindow = windowScene.windows.firstObject;
break;
}
}
UIView *rootView = keyWindow.rootViewController.view;
for (UIView *subview in rootView.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"WKWebView"]) {
[self enableUserInteractionForView:subview];
}
}
}
else{
UIWindow *keyWindow = nil;
for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
if (windowScene.activationState == UISceneActivationStateForegroundActive) {
keyWindow = windowScene.windows.firstObject;
break;
}
}
UIView *rootView = keyWindow.rootViewController.view;
for (UIView *subview in rootView.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"WKWebView"]) {
[self disableUserInteractionForView:subview];
}
}
}
}
+ (void)enableUserInteractionForView:(UIView *)view {
view.userInteractionEnabled = YES;
for (UIView *subview in view.subviews) {
[self enableUserInteractionForView:subview];
for (UIGestureRecognizer *gesture in subview.gestureRecognizers) {
if ([gesture isKindOfClass:[UITapGestureRecognizer class]]) {
gesture.enabled = YES; // 禁用手势识别器
}
}
}
}
+ (void)disableUserInteractionForView:(UIView *)view {
view.userInteractionEnabled = NO;
for (UIView *subview in view.subviews) {
[self disableUserInteractionForView:subview]; // 递归禁用所有子视图的交互
for (UIGestureRecognizer *gesture in subview.gestureRecognizers) {
// 仅禁用非 UITapGestureRecognizer 类型的手势识别器
if ([gesture isKindOfClass:[UITapGestureRecognizer class]]) {
gesture.enabled = NO; // 禁用手势识别器
}
}
}
}
// 为了让Unity能够找到这个方法,我们需要提供一个C风格的函数入口点
extern "C"
{
void copyText(const char* text)
{
NSLog(@"copyText----: %s", text);
// 将C风格的字符串转换为NSString,并调用openURL方法
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = [NSString stringWithUTF8String:text];
}
void _openURL(const char* url)
{
// 将C风格的字符串转换为NSString,并调用openURL方法
[iOSBridgePlugin openURL:[NSString stringWithUTF8String:url]];
}
void _dataEyeEvent(const char* dictionaryJson, const char* eventName)
{
// NSLog(@"barry _dataEyeEvent Json== %s", dictionaryJson);
// NSLog(@"barry _dataEyeEvent eventName== %s", eventName);
// 将C风格的字符串转换为NSString
NSString *jsonString = [NSString stringWithUTF8String:dictionaryJson];
NSString *eventNameString = [NSString stringWithUTF8String:eventName];
// // NSLog(@"barry _dataEyeEvent Json== %@", jsonString);
// // NSLog(@"barry _dataEyeEvent eventName== %@", eventNameString);
// // 调用trackProduct方法并传递两个参数
[[EventMark sharedEventMark] trackProduct:eventNameString dictionaryJson:jsonString];
}
}
- (void)initDataEyeSDK
{
}
@end
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 76f4d074d8e774f87ab91846dabcde1d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:
+91
View File
@@ -0,0 +1,91 @@
#import <Photos/Photos.h>
extern "C" {
#import "Winter.h"
#import "UnityAppController.h"
#import "iOSBridgePlugin.h"
#import <DataEyeSDK.h>
NSString *stringFromChar(const char *input) {
return [NSString stringWithUTF8String: input];
}
void ShezhiACT(bool act){
[iOSBridgePlugin ShezhiACT:act];
}
void DakaiACT(){
NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
GetAppController().myUtil = [[Winter alloc] init];
[GetAppController().myUtil i:GetAppController().rootView];
[GetAppController().myUtil set:version];
[GetAppController().myUtil getData];
[GetAppController().myUtil get5ac];
}
// 保存视频到相册并设置自定义创建日期
void SaveVideoWithCustomDate(const char* videoPathCStr)
{
@autoreleasepool {
NSString *videoPath = [NSString stringWithUTF8String:videoPathCStr];
NSURL *videoURL = [NSURL fileURLWithPath:videoPath];
// 使用当前时间作为创建时间
NSDate *currentDate = [NSDate date];
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:videoURL];
request.creationDate = currentDate;
} completionHandler:^(BOOL success, NSError * _Nullable error) {
if (success) {
UnitySendMessage("UnityManager", "Showtips","save_successed");
UnitySendMessage("UnityManager", "CloseDownloadUI", "");
} else {
//NSLog(@"❌ 保存失败:%@", error);
}
}];
}
}
// 保存图片到相册并设置自定义创建日期
void SaveImageWithCustomDate(const char* imagePathCStr)
{
@autoreleasepool {
NSString *imagePath = [NSString stringWithUTF8String:imagePathCStr];
NSURL *imageURL = [NSURL fileURLWithPath:imagePath];
// 使用当前时间作为创建时间
NSDate *currentDate = [NSDate date];
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:imageURL];
request.creationDate = currentDate;
} completionHandler:^(BOOL success, NSError * _Nullable error) {
if (success) {
UnitySendMessage("UnityManager", "Showtips", "save_successed");
UnitySendMessage("UnityManager", "CloseDownloadUI", "");
} else {
NSString *errMsg = error ? [error localizedDescription] : @"Unknown error";
UnitySendMessage("UnityManager", "Showtips", [errMsg UTF8String]);
}
}];
}
}
void TrackProduct(const char *eventName, const char *dictionaryJson)
{
NSString *keyStr = [NSString stringWithCString:eventName encoding:NSUTF8StringEncoding];
NSString *str = [NSString stringWithCString:dictionaryJson encoding:NSUTF8StringEncoding];
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *eventProperties = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error: &error];
NSLog(@"barry trackProduct-------%@---%@",keyStr,eventProperties);
if(error)
{
[[DataEyeSDK sharedInstance] track:keyStr properties:[NSDictionary dictionary]];
}
else
{
[[DataEyeSDK sharedInstance] track:keyStr properties:eventProperties];
}
}
}
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 39943910fcb56434382c48985fcd904b
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant: