forked from sensorsdata/sa-sdk-ios
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
789 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/SACellClickDynamicSubclassPlugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// SANewCellClickPlugin.h | ||
// SensorsAnalyticsSDK | ||
// | ||
// Created by 陈玉国 on 2021/11/8. | ||
// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import "SAEventTrackerPlugin.h" | ||
#import "SAEventTrackerPluginProtocol.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SACellClickDynamicSubclassPlugin : SAEventTrackerPlugin <SAEventTrackerPluginProtocol> | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
59 changes: 59 additions & 0 deletions
59
SensorsAnalyticsSDK/AutoTrack/AppClick/Cell/SACellClickDynamicSubclassPlugin.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// SANewCellClickPlugin.m | ||
// SensorsAnalyticsSDK | ||
// | ||
// Created by 陈玉国 on 2021/11/8. | ||
// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#if ! __has_feature(objc_arc) | ||
#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. | ||
#endif | ||
|
||
#import "SACellClickDynamicSubclassPlugin.h" | ||
#import "SASwizzle.h" | ||
#import <UIKit/UIKit.h> | ||
|
||
static NSString *const kSAEventTrackerPluginType = @"AppClick+ScrollView"; | ||
|
||
@implementation SACellClickDynamicSubclassPlugin | ||
|
||
- (void)install { | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
[self swizzleMethod]; | ||
}); | ||
self.enable = YES; | ||
} | ||
|
||
- (void)uninstall { | ||
self.enable = NO; | ||
} | ||
|
||
- (NSString *)type { | ||
return kSAEventTrackerPluginType; | ||
} | ||
|
||
- (void)swizzleMethod { | ||
SEL selector = NSSelectorFromString(@"sensorsdata_setDelegate:"); | ||
[UITableView sa_swizzleMethod:@selector(setDelegate:) | ||
withMethod:selector | ||
error:NULL]; | ||
[UICollectionView sa_swizzleMethod:@selector(setDelegate:) | ||
withMethod:selector | ||
error:NULL]; | ||
} | ||
|
||
@end |
30 changes: 30 additions & 0 deletions
30
SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/SAGesturePlugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// SAGesturePlugin.h | ||
// SensorsAnalyticsSDK | ||
// | ||
// Created by 陈玉国 on 2021/11/10. | ||
// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import "SAEventTrackerPlugin.h" | ||
#import "SAEventTrackerPluginProtocol.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SAGesturePlugin : SAEventTrackerPlugin <SAEventTrackerPluginProtocol> | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
63 changes: 63 additions & 0 deletions
63
SensorsAnalyticsSDK/AutoTrack/AppClick/Gesture/SAGesturePlugin.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// SAGesturePlugin.m | ||
// SensorsAnalyticsSDK | ||
// | ||
// Created by 陈玉国 on 2021/11/10. | ||
// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#if ! __has_feature(objc_arc) | ||
#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. | ||
#endif | ||
|
||
#import "SAGesturePlugin.h" | ||
#import "SASwizzle.h" | ||
#import "UIGestureRecognizer+SAAutoTrack.h" | ||
#import <UIKit/UIKit.h> | ||
|
||
static NSString *const kSAEventTrackerPluginType = @"AppClick+UIGestureRecognizer"; | ||
|
||
@implementation SAGesturePlugin | ||
|
||
- (void)install { | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
[self swizzleMethod]; | ||
}); | ||
self.enable = YES; | ||
} | ||
|
||
- (void)uninstall { | ||
self.enable = NO; | ||
} | ||
|
||
- (NSString *)type { | ||
return kSAEventTrackerPluginType; | ||
} | ||
|
||
- (void)swizzleMethod { | ||
// Gesture | ||
[UIGestureRecognizer sa_swizzleMethod:@selector(initWithTarget:action:) | ||
withMethod:@selector(sensorsdata_initWithTarget:action:) | ||
error:NULL]; | ||
[UIGestureRecognizer sa_swizzleMethod:@selector(addTarget:action:) | ||
withMethod:@selector(sensorsdata_addTarget:action:) | ||
error:NULL]; | ||
[UIGestureRecognizer sa_swizzleMethod:@selector(removeTarget:action:) | ||
withMethod:@selector(sensorsdata_removeTarget:action:) | ||
error:NULL]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
SensorsAnalyticsSDK/Core/EventTrackerPlugin/SAEventTrackerPlugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// SAEventTrackerPlugin.h | ||
// SensorsAnalyticsSDK | ||
// | ||
// Created by 陈玉国 on 2021/11/8. | ||
// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SAEventTrackerPlugin : NSObject | ||
|
||
@property (nonatomic, readonly) NSString *type; | ||
@property (nonatomic, assign) BOOL enable; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
29 changes: 29 additions & 0 deletions
29
SensorsAnalyticsSDK/Core/EventTrackerPlugin/SAEventTrackerPlugin.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// SAEventTrackerPlugin.m | ||
// SensorsAnalyticsSDK | ||
// | ||
// Created by 陈玉国 on 2021/11/8. | ||
// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#if ! __has_feature(objc_arc) | ||
#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. | ||
#endif | ||
|
||
#import "SAEventTrackerPlugin.h" | ||
|
||
@implementation SAEventTrackerPlugin | ||
|
||
@end |
43 changes: 43 additions & 0 deletions
43
SensorsAnalyticsSDK/Core/EventTrackerPlugin/SAEventTrackerPluginManager.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// SAEventTrackerPluginManager.h | ||
// SensorsAnalyticsSDK | ||
// | ||
// Created by 陈玉国 on 2021/11/8. | ||
// Copyright © 2021 Sensors Data Co., Ltd. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "SAEventTrackerPlugin.h" | ||
#import "SAEventTrackerPluginProtocol.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SAEventTrackerPluginManager : NSObject | ||
|
||
+ (instancetype)defaultManager; | ||
|
||
//register plugin and install | ||
- (void)registerPlugin:(SAEventTrackerPlugin<SAEventTrackerPluginProtocol> *)plugin; | ||
- (void)unregisterPlugin:(Class)pluginClass; | ||
- (void)unregisterAllPlugins; | ||
|
||
- (void)enableAllPlugins; | ||
- (void)disableAllPlugins; | ||
|
||
- (SAEventTrackerPlugin<SAEventTrackerPluginProtocol> *)pluginWithType:(NSString *)pluginType; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.