Ta android + ios

This commit is contained in:
LYP
2024-08-07 20:22:28 +08:00
parent 69fee08c61
commit 76458664d8
722 changed files with 41709 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIApplication (AutoTrack)
- (BOOL)td_sendAction:(SEL)action
to:(nullable id)to
from:(nullable id)from
forEvent:(nullable UIEvent *)event;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 76827556b4c29d74b9d9866d1532361a
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:

View File

@@ -0,0 +1,24 @@
#import "UIApplication+AutoTrack.h"
#import "TDAutoTrackManager.h"
@implementation UIApplication (AutoTrack)
- (BOOL)td_sendAction:(SEL)action to:(id)to from:(id)from forEvent:(UIEvent *)event {
if ([from isKindOfClass:[UIControl class]]) {
if (([from isKindOfClass:[UISwitch class]] ||
[from isKindOfClass:[UISegmentedControl class]] ||
[from isKindOfClass:[UIStepper class]])) {
[[TDAutoTrackManager sharedManager] trackEventView:from];
}
else if ([event isKindOfClass:[UIEvent class]] &&
event.type == UIEventTypeTouches &&
[[[event allTouches] anyObject] phase] == UITouchPhaseEnded) {
[[TDAutoTrackManager sharedManager] trackEventView:from];
}
}
return [self td_sendAction:action to:to from:from forEvent:event];
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 2e342b8a785318f428bfd623fa57d1da
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:

View File

@@ -0,0 +1,51 @@
//
// UIView+ThinkingAnalytics.h
// ThinkingSDK
//
// Created by Yangxiongon 2022/7/1.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIView (ThinkingAnalytics)
/**
Set the control element ID
*/
@property (copy,nonatomic) NSString *thinkingAnalyticsViewID;
/**
Configure the control element ID of APPID
*/
@property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewIDWithAppid;
/**
Ignore the click event of a control
*/
@property (nonatomic,assign) BOOL thinkingAnalyticsIgnoreView;
/**
Configure APPID to ignore the click event of a control
*/
@property (strong,nonatomic) NSDictionary *thinkingAnalyticsIgnoreViewWithAppid;
/**
Properties of custom control click event
*/
@property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewProperties;
/**
Configure the properties of the APPID custom control click event
*/
@property (strong,nonatomic) NSDictionary *thinkingAnalyticsViewPropertiesWithAppid;
/**
thinkingAnalyticsDelegate
*/
@property (nonatomic, weak, nullable) id thinkingAnalyticsDelegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: c67fc5d11c1b49f48b6d63493119861d
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:

View File

@@ -0,0 +1,77 @@
//
// UIView+ThinkingAnalytics.m
// ThinkingSDK
//
// Created by Yangxiongon 2022/7/1.
//
#import "UIView+ThinkingAnalytics.h"
#import <objc/runtime.h>
static char TD_AUTOTRACK_VIEW_ID;
static char TD_AUTOTRACK_VIEW_ID_APPID;
static char TD_AUTOTRACK_VIEW_IGNORE;
static char TD_AUTOTRACK_VIEW_IGNORE_APPID;
static char TD_AUTOTRACK_VIEW_PROPERTIES;
static char TD_AUTOTRACK_VIEW_PROPERTIES_APPID;
static char TD_AUTOTRACK_VIEW_DELEGATE;
@implementation UIView (ThinkingAnalytics)
- (NSString *)thinkingAnalyticsViewID {
return objc_getAssociatedObject(self, &TD_AUTOTRACK_VIEW_ID);
}
- (void)setThinkingAnalyticsViewID:(NSString *)thinkingAnalyticsViewID {
objc_setAssociatedObject(self, &TD_AUTOTRACK_VIEW_ID, thinkingAnalyticsViewID, OBJC_ASSOCIATION_COPY_NONATOMIC);
}
- (BOOL)thinkingAnalyticsIgnoreView {
return [objc_getAssociatedObject(self, &TD_AUTOTRACK_VIEW_IGNORE) boolValue];
}
- (void)setThinkingAnalyticsIgnoreView:(BOOL)thinkingAnalyticsIgnoreView {
objc_setAssociatedObject(self, &TD_AUTOTRACK_VIEW_IGNORE, [NSNumber numberWithBool:thinkingAnalyticsIgnoreView], OBJC_ASSOCIATION_ASSIGN);
}
- (NSDictionary *)thinkingAnalyticsIgnoreViewWithAppid {
return objc_getAssociatedObject(self, &TD_AUTOTRACK_VIEW_IGNORE_APPID);
}
- (void)setThinkingAnalyticsIgnoreViewWithAppid:(NSDictionary *)thinkingAnalyticsViewProperties {
objc_setAssociatedObject(self, &TD_AUTOTRACK_VIEW_IGNORE_APPID, thinkingAnalyticsViewProperties, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSDictionary *)thinkingAnalyticsViewIDWithAppid {
return objc_getAssociatedObject(self, &TD_AUTOTRACK_VIEW_ID_APPID);
}
- (void)setThinkingAnalyticsViewIDWithAppid:(NSDictionary *)thinkingAnalyticsViewProperties {
objc_setAssociatedObject(self, &TD_AUTOTRACK_VIEW_ID_APPID, thinkingAnalyticsViewProperties, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSDictionary *)thinkingAnalyticsViewProperties {
return objc_getAssociatedObject(self, &TD_AUTOTRACK_VIEW_PROPERTIES);
}
- (void)setThinkingAnalyticsViewProperties:(NSDictionary *)thinkingAnalyticsViewProperties {
objc_setAssociatedObject(self, &TD_AUTOTRACK_VIEW_PROPERTIES, thinkingAnalyticsViewProperties, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSDictionary *)thinkingAnalyticsViewPropertiesWithAppid {
return objc_getAssociatedObject(self, &TD_AUTOTRACK_VIEW_PROPERTIES_APPID);
}
- (void)setThinkingAnalyticsViewPropertiesWithAppid:(NSDictionary *)thinkingAnalyticsViewProperties {
objc_setAssociatedObject(self, &TD_AUTOTRACK_VIEW_PROPERTIES_APPID, thinkingAnalyticsViewProperties, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (id)thinkingAnalyticsDelegate {
return objc_getAssociatedObject(self, &TD_AUTOTRACK_VIEW_DELEGATE);
}
- (void)setThinkingAnalyticsDelegate:(id)thinkingAnalyticsDelegate {
objc_setAssociatedObject(self, &TD_AUTOTRACK_VIEW_DELEGATE, thinkingAnalyticsDelegate, OBJC_ASSOCIATION_ASSIGN);
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: a3caba30b926a2441ae7a9a0b657b4e5
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:

View File

@@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>
@interface UIViewController (AutoTrack)
- (void)td_autotrack_viewWillAppear:(BOOL)animated;
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: c7a1ed12078ed9c4ba5c3e3587346e4e
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:

View File

@@ -0,0 +1,16 @@
#import "UIViewController+AutoTrack.h"
#import "TDAutoTrackManager.h"
#import "TDLogging.h"
@implementation UIViewController (AutoTrack)
- (void)td_autotrack_viewWillAppear:(BOOL)animated {
@try {
[[TDAutoTrackManager sharedManager] viewControlWillAppear:self];
} @catch (NSException *exception) {
TDLogError(@"%@ error: %@", self, exception);
}
[self td_autotrack_viewWillAppear:animated];
}
@end

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 081cc82a073a6aa489fa263acf6f362a
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: