Skip to content

Commit

Permalink
Rename trackEvent to trackString
Browse files Browse the repository at this point in the history
  • Loading branch information
leandroalonso committed Mar 12, 2020
1 parent f30da4d commit 6389e9e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
8 changes: 4 additions & 4 deletions WordPressShared/Core/Analytics/WPAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,8 @@ extern NSString *const WPAnalyticsStatEditorPublishedPostPropertyVideo;
+ (void)endTimerForStat:(WPAnalyticsStat)stat withProperties:(NSDictionary *)properties;
+ (void)track:(WPAnalyticsStat)stat;
+ (void)track:(WPAnalyticsStat)stat withProperties:(NSDictionary *)properties;
+ (void)trackEvent:(NSString *)event;
+ (void)trackEvent:(NSString *)event withProperties:(NSDictionary *)properties;
+ (void)trackString:(NSString *)event;
+ (void)trackString:(NSString *)event withProperties:(NSDictionary *)properties;
+ (void)endSession;
+ (void)clearQueuedEvents;

Expand All @@ -612,8 +612,8 @@ extern NSString *const WPAnalyticsStatEditorPublishedPostPropertyVideo;

- (void)track:(WPAnalyticsStat)stat;
- (void)track:(WPAnalyticsStat)stat withProperties:(NSDictionary *)properties;
- (void)trackEvent:(NSString *)event;
- (void)trackEvent:(NSString *)event withProperties:(NSDictionary *)properties;
- (void)trackString:(NSString *)event;
- (void)trackString:(NSString *)event withProperties:(NSDictionary *)properties;

@optional
- (void)beginSession;
Expand Down
8 changes: 4 additions & 4 deletions WordPressShared/Core/Analytics/WPAnalytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ + (void)track:(WPAnalyticsStat)stat withProperties:(NSDictionary *)properties
}
}

+ (void)trackEvent:(NSString *)event
+ (void)trackString:(NSString *)event
{
for (id<WPAnalyticsTracker> tracker in [self trackers]) {
[tracker trackEvent:event];
[tracker trackString:event];
}
}

+ (void)trackEvent:(NSString *)event withProperties:(NSDictionary *)properties
+ (void)trackString:(NSString *)event withProperties:(NSDictionary *)properties
{
NSParameterAssert(properties != nil);
for (id<WPAnalyticsTracker> tracker in [self trackers]) {
[tracker trackEvent:event withProperties:properties];
[tracker trackString:event withProperties:properties];
}
}

Expand Down
10 changes: 10 additions & 0 deletions WordPressSharedTests/TestAnalyticsTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@ - (void)refreshMetadata
// No-op
}

- (void)trackString:(NSString *)event {
// No-op
}


- (void)trackString:(NSString *)event withProperties:(NSDictionary *)properties {
// No-op
}


@end
12 changes: 6 additions & 6 deletions WordPressSharedTests/WPAnalyticsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,20 @@
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
});

describe(@"trackEvent:", ^{
NSMethodSignature *signature = [TestAnalyticsTracker instanceMethodSignatureForSelector:@selector(trackEvent:)];
describe(@"trackString:", ^{
NSMethodSignature *signature = [TestAnalyticsTracker instanceMethodSignatureForSelector:@selector(trackString:)];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setSelector:@selector(trackEvent:)];
[invocation setSelector:@selector(trackString:)];
NSString *event = @"my_event";
[invocation setArgument:&event atIndex:2];

itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
});

describe(@"trackEvent:withProperties:", ^{
NSMethodSignature *signature = [TestAnalyticsTracker instanceMethodSignatureForSelector:@selector(trackEvent:withProperties:)];
describe(@"trackString:withProperties:", ^{
NSMethodSignature *signature = [TestAnalyticsTracker instanceMethodSignatureForSelector:@selector(trackString:withProperties:)];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setSelector:@selector(trackEvent:withProperties:)];
[invocation setSelector:@selector(trackString:withProperties:)];

NSString *event = @"my_event";
NSDictionary *dict = @{};
Expand Down

0 comments on commit 6389e9e

Please sign in to comment.