Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加图片埋点的内容元素 #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SensorsAnalyticsSDK/AutoTrack/AppClick/UIView+SAAutoTrack.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ @implementation UIImageView (AutoTrack)

- (NSString *)sensorsdata_elementContent {
NSString *imageName = self.image.sensorsAnalyticsImageName;
if (imageName.length == 0) {
imageName = self.image.sensorsAnalyticsAssetName;
}
if (imageName.length > 0) {
return [NSString stringWithFormat:@"%@", imageName];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ - (void)setSensorsAnalyticsImageName:(NSString *)sensorsAnalyticsImageName {
objc_setAssociatedObject(self, @"sensorsAnalyticsImageName", sensorsAnalyticsImageName, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

- (NSString *)sensorsAnalyticsAssetName {
return [[self imageAsset] valueForKey:@"assetName"];
}

@end

#pragma mark -
Expand Down
2 changes: 2 additions & 0 deletions SensorsAnalyticsSDK/UIRelated/UIVIew+SensorsAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, copy) NSString* sensorsAnalyticsImageName;

@property (nonatomic, copy, readonly) NSString* sensorsAnalyticsAssetName;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions SensorsAnalyticsSDK/UIRelated/UIVIew+SensorsAnalytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,8 @@ - (void)setSensorsAnalyticsImageName:(NSString *)sensorsAnalyticsImageName {
objc_setAssociatedObject(self, kSASensorsAnalyticsImageNameKey, sensorsAnalyticsImageName, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

- (NSString *)sensorsAnalyticsAssetName {
return [[self imageAsset] valueForKey:@"assetName"];
}

@end
3 changes: 3 additions & 0 deletions SensorsAnalyticsSDK/UIRelated/UIView+SAElementContent.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ @implementation UIImageView (SAElementContent)

- (NSString *)sensorsdata_elementContent {
NSString *imageName = self.image.sensorsAnalyticsImageName;
if (imageName.length == 0) {
imageName = self.image.sensorsAnalyticsAssetName;
}
if (imageName.length > 0) {
return [NSString stringWithFormat:@"%@", imageName];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ @implementation UIImageView (PropertiesContent)

- (NSString *)sensorsdata_propertyContent {
NSString *imageName = self.image.sensorsAnalyticsImageName;
if (imageName.length == 0) {
imageName = self.image.sensorsAnalyticsAssetName;
}
if (imageName.length > 0) {
return [NSString stringWithFormat:@"%@", imageName];
}
Expand Down