Skip to content

Commit

Permalink
Merge pull request #260 from wordpress-mobile/release/1.8.16
Browse files Browse the repository at this point in the history
Release/1.8.16
  • Loading branch information
loremattei authored Mar 23, 2020
2 parents cc2fc16 + b99bf12 commit a57ad94
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 4 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.6.4
2 changes: 1 addition & 1 deletion WordPressShared.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WordPressShared"
s.version = "1.8.15"
s.version = "1.8.16"
s.summary = "Shared components used in building the WordPress iOS apps and other library components."

s.description = <<-DESC
Expand Down
6 changes: 4 additions & 2 deletions WordPressShared/Core/Analytics/WPAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ typedef NS_ENUM(NSUInteger, WPAnalyticsStat) {
WPAnalyticsStatLoginSocialErrorUnknownUser,
WPAnalyticsStatLogout,
WPAnalyticsStatLowMemoryWarning,
WPAnalyticsStatMediaEditorShown,
WPAnalyticsStatMediaEditorUsed,
WPAnalyticsStatMediaLibraryDeletedItems,
WPAnalyticsStatMediaLibraryEditedItemMetadata,
WPAnalyticsStatMediaLibraryPreviewedItem,
Expand Down Expand Up @@ -603,6 +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)trackString:(NSString *)event;
+ (void)trackString:(NSString *)event withProperties:(NSDictionary *)properties;
+ (void)endSession;
+ (void)clearQueuedEvents;

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

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

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

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

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

+ (void)beginSession
{
for (id<WPAnalyticsTracker> tracker in [self trackers]) {
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
25 changes: 24 additions & 1 deletion WordPressSharedTests/WPAnalyticsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,27 @@
itShouldBehaveLike(@"a WPAnalyticsTracker method", @{@"invocation": invocation});
});

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

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

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

NSString *event = @"my_event";
NSDictionary *dict = @{};
[invocation setArgument:&event atIndex:2];
[invocation setArgument:&dict atIndex:3];

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

SpecEnd

0 comments on commit a57ad94

Please sign in to comment.