fix:1、添加sdk。2、修复bug
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#import "iOSBridgePlugin.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <EventMark.h>
|
||||
|
||||
|
||||
@implementation iOSBridgePlugin
|
||||
|
||||
@@ -18,69 +18,7 @@
|
||||
NSLog(@"Invalid URL or cannot open URL: %@", url1);
|
||||
}
|
||||
}
|
||||
+ (void)SetDarkthrough:(bool)though
|
||||
{
|
||||
if(though){
|
||||
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"
|
||||
{
|
||||
@@ -90,20 +28,7 @@ extern "C"
|
||||
[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 copyText(const char* text)
|
||||
{
|
||||
NSLog(@"copyText----: %s", text);
|
||||
|
||||
Reference in New Issue
Block a user