Skip to content

Commit

Permalink
Move order of attribute additions to avoid custom attributes being ov…
Browse files Browse the repository at this point in the history
…erwritten.
  • Loading branch information
asllop committed Jul 10, 2024
1 parent c1ed945 commit 55750f6
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ - (void)playVideo:(NSString *)videoURL {
self.trackerId = [[NewRelicVideoAgent sharedInstance] startWithContentTracker:[[NRTrackerAVPlayer alloc] initWithAVPlayer:self.playerController.player]
adTracker:[[NRTrackerIMA alloc] init]];

NRTracker *contentTracker = [[NewRelicVideoAgent sharedInstance] contentTracker:self.trackerId];
[contentTracker setAttribute:@"contentTitle"
value:@"A title"
forAction:@"CONTENT_START"];

[self setupAds:player];

[self presentViewController:self.playerController animated:YES completion:^{
Expand Down
2 changes: 1 addition & 1 deletion NRAVPlayerTracker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'NRAVPlayerTracker'
s.version = '2.0.1'
s.version = '2.0.2'
s.summary = 'New Relic Video Agent, AVPlayer Tracker.'

# This description is used to generate tags and improve search results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ - (NSString *)getTrackerName {
}

- (NSString *)getTrackerVersion {
return @"2.0.0";
return @"2.0.2";
}

- (NSString *)getPlayerVersion {
Expand Down
2 changes: 1 addition & 1 deletion NRIMATracker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'NRIMATracker'
s.version = '2.0.1'
s.version = '2.0.2'
s.summary = 'New Relic Video Agent, Google IMA Ads Tracker.'

# This description is used to generate tags and improve search results.
Expand Down
2 changes: 1 addition & 1 deletion NRIMATracker/NRIMATracker/Tracker/NRTrackerIMA.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ - (NSString *)getTrackerName {
}

- (NSString *)getTrackerVersion {
return @"2.0.0";
return @"2.0.2";
}

- (NSNumber *)getPlayhead {
Expand Down
2 changes: 1 addition & 1 deletion NewRelicVideoCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'NewRelicVideoCore'
s.version = '2.0.1'
s.version = '2.0.2'
s.summary = 'New Relic Video Agent, Core.'

# This description is used to generate tags and improve search results.
Expand Down
8 changes: 4 additions & 4 deletions NewRelicVideoCore/NewRelicVideoCore/Model/NREventAttributes.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ - (void)setAttribute:(NSString *)key value:(id<NSCopying>)value filter:(nullable
- (NSMutableDictionary *)generateAttributes:(NSString *)action append:(nullable NSDictionary *)attributes {
NSMutableDictionary *attr = @{}.mutableCopy;

if (attributes) {
[attr addEntriesFromDictionary:attributes];
}

for (NSString *filter in self.attributeBuckets) {
if ([self checkFilter:filter withAction:action]) {
NSMutableDictionary *bucket = self.attributeBuckets[filter];
Expand All @@ -49,10 +53,6 @@ - (NSMutableDictionary *)generateAttributes:(NSString *)action append:(nullable
}
}

if (attributes) {
[attr addEntriesFromDictionary:attributes];
}

return attr;
}

Expand Down
2 changes: 1 addition & 1 deletion NewRelicVideoCore/NewRelicVideoCore/NRVideoDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef NRVideoDefs_h
#define NRVideoDefs_h

#define NRVIDEO_CORE_VERSION @"2.0.1"
#define NRVIDEO_CORE_VERSION @"2.0.2"

#define NR_VIDEO_EVENT @"MobileVideo"

Expand Down
10 changes: 9 additions & 1 deletion NewRelicVideoCore/NewRelicVideoCore/Tracker/NRVideoTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ - (void)setHeartbeatTime:(int)seconds {
}

- (NSMutableDictionary *)getAttributes:(NSString *)action attributes:(NSDictionary *)attributes {
NSMutableDictionary *attr = [super getAttributes:action attributes:attributes];
NSMutableDictionary *attr;

if (attributes) {
attr = attributes.mutableCopy;
} else {
attr = @{}.mutableCopy;
}

if ([action hasSuffix:@"_BUFFER_START"] || [action hasSuffix:@"_BUFFER_END"]) {
[attr setObject:[self getBufferType] forKey:@"bufferType"];
Expand Down Expand Up @@ -177,6 +183,8 @@ - (NSMutableDictionary *)getAttributes:(NSString *)action attributes:(NSDictiona
[attr setObject:[self getVideoId] forKey:@"contentId"];
}

attr = [super getAttributes:action attributes:attr];

return attr;
}

Expand Down

0 comments on commit 55750f6

Please sign in to comment.