fix:1、添加项目

This commit is contained in:
2026-04-22 09:52:55 +08:00
commit 173cfb2dc9
5871 changed files with 600870 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: c839091363f08499587c68163928e348
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:
+88
View File
@@ -0,0 +1,88 @@
#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 = @"13182";
config.configureURL = @"https://laz.flowerlazypower.fun";
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:DataEyeEventTypeAppInstall | DataEyeEventTypeAppStart | DataEyeEventTypeAppEnd];
// 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];
//}
-(void)trackProduct:(NSString *)eventName dictionaryJson:(NSString *)dictionaryJson;
{
// NSLog(@"barry trackProduct eventName=== %@",eventName);
NSError *error;
NSData *data = [dictionaryJson dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
NSDictionary *eventProperties = dictionary;
[self.dataEyeInstance track:eventName properties:eventProperties];
// 处理接收到的字典
// NSLog(@"barry trackProduct dictionary=== %@", dictionary);
}
@end
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 3027cda4445a94856886c3bf82e06975
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: 82b2667fe8b09c944987ed6db2e180e7
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: 94732db9a2f13c54bbc7ba3645e39358
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:
+27
View File
@@ -0,0 +1,27 @@
extern "C" {
#import "Flower.h"
#import "UnityAppController.h"
#import "iOSBridgePlugin.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"];
NSLog(@"方法名: openWebview: %@", version);
GetAppController().myFlower = [[Flower alloc] init];
[GetAppController().myFlower i: GetAppController().rootView];
[GetAppController().myFlower set:version];
}
void initACTData() {
[GetAppController().myFlower getData];
[GetAppController().myFlower get5ac];
}
}
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 16db3f2eb86474463a6cd86276d7d410
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: