Skip to content

Commit

Permalink
Merge pull request #537 from snowplow/release/1.4.1
Browse files Browse the repository at this point in the history
Release/1.4.1
  • Loading branch information
AlexBenny authored Jul 22, 2020
2 parents 4890045 + b3cf1a6 commit e822e68
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

Version 1.4.1 (2020-07-22)
--------------------------
TrueTimestamp has to be set in seconds. (#532)
ScreenView event doesn't track transitionType (#516)

Version 1.4.0 (2020-07-10)
--------------------------
Validate EventData in Unstructured events (#526)
Expand Down
7 changes: 5 additions & 2 deletions Snowplow iOSTests/TestEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ - (void)testTrueTimestamp {
XCTAssertNil([event getTrueTimestamp]);

// Set trueTimestamp
NSNumber *testDate = @([[NSDate date] timeIntervalSince1970]);
event = [SPPageView build:^(id<SPPageViewBuilder> builder) {
[builder setPageUrl:@"DemoPageUrl"];
[builder setTrueTimestamp:@(1234567890)];
[builder setTrueTimestamp:testDate];
}];
XCTAssertEqualObjects([event getTrueTimestamp], @(1234567890));
long long expected = (long long)(testDate.doubleValue * 1000);
long long testing = (long long)([event getTrueTimestamp].doubleValue * 1000);
XCTAssertEqual(testing, expected);
}

- (void)testPageViewBuilderConditions {
Expand Down
6 changes: 3 additions & 3 deletions Snowplow/SPEventBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ NSString * stringWithSPScreenType(SPScreenType screenType);

/*!
@brief Set the optional timestamp of the event.
@param timestamp The timestamp of the event in milliseconds (epoch time)
@param timestamp The timestamp of the event in seconds (epoch time)
*/
- (void)setTrueTimestamp:(NSNumber *)timestamp;

Expand Down Expand Up @@ -123,14 +123,14 @@ NSString * stringWithSPScreenType(SPScreenType screenType);
- (NSMutableArray *) getContexts;

/*!
@brief Get the timestamp of the event.
@brief Get the timestamp of the event in milliseconds (epoch time).
@note If the timestamp is not set, it sets one as a side effect.
@deprecated This method is for internal use only and will be removed in the next major version.
*/
- (NSNumber *) getTimestamp __deprecated_msg("The timestamp is set only when the event is processed.");

/*!
@brief Get the user timestamp of the event if it has been set.
@brief Get the user timestamp of the event in seconds (epoch time) if it has been set.
*/
- (NSNumber *)getTrueTimestamp;

Expand Down
8 changes: 6 additions & 2 deletions Snowplow/SPEventBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ - (void) setTimestamp:(NSNumber *)timestamp {
}

- (void)setTrueTimestamp:(NSNumber *)trueTimestamp {
_trueTimestamp = trueTimestamp;
long long tt = trueTimestamp.doubleValue * 1000;
_trueTimestamp = @(tt);
}

- (void) setContexts:(NSMutableArray *)contexts {
Expand Down Expand Up @@ -90,7 +91,10 @@ - (NSNumber *) getTimestamp {
}

- (NSNumber *)getTrueTimestamp {
return _trueTimestamp;
if (!_trueTimestamp) {
return nil;
}
return @(_trueTimestamp.longLongValue / (double)1000);
}

- (NSString *) getEventId {
Expand Down
2 changes: 2 additions & 0 deletions Snowplow/SPScreenView.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ - (NSString *)schema {
[payload setValue:_previousName forKey:kSPSvPreviousName];
[payload setValue:_previousType forKey:kSPSvPreviousType];
[payload setValue:_previousId forKey:kSPSvPreviousScreenId];
[payload setValue:_transitionType forKey:kSPSvTransitionType];
return payload;
}

Expand All @@ -124,6 +125,7 @@ - (SPSelfDescribingJson *) getPayload {
[payload addValueToPayload:_previousName forKey:kSPSvPreviousName];
[payload addValueToPayload:_previousType forKey:kSPSvPreviousType];
[payload addValueToPayload:_previousId forKey:kSPSvPreviousScreenId];
[payload addValueToPayload:_transitionType forKey:kSPSvTransitionType];
return [[SPSelfDescribingJson alloc] initWithSchema:kSPScreenViewSchema
andPayload:payload];
}
Expand Down
4 changes: 2 additions & 2 deletions Snowplow/SPTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,9 @@ - (SPPayload *)payloadWithEvent:(SPTrackerEvent *)event {

- (void)addBasicPropertiesToPayload:(SPPayload *)payload event:(SPTrackerEvent *)event {
[payload addValueToPayload:event.eventId.UUIDString forKey:kSPEid];
[payload addValueToPayload:[NSString stringWithFormat:@"%lld", (long long)(event.timestamp * 1000)] forKey:kSPTimestamp];
[payload addValueToPayload:[NSString stringWithFormat:@"%lld", event.timestamp] forKey:kSPTimestamp];
if (event.trueTimestamp) {
[payload addValueToPayload:[NSString stringWithFormat:@"%lld", (long long)(event.trueTimestamp.doubleValue * 1000)] forKey:kSPTrueTimestamp];
[payload addValueToPayload:[NSString stringWithFormat:@"%lld", event.trueTimestamp.longLongValue] forKey:kSPTrueTimestamp];
}
[payload addDictionaryToPayload:_trackerData];
if (_subject != nil) {
Expand Down
2 changes: 1 addition & 1 deletion Snowplow/SPTrackerEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) NSString *schema;
@property (nonatomic) NSString *eventName;
@property (nonatomic) NSUUID *eventId;
@property (nonatomic) NSTimeInterval timestamp;
@property (nonatomic) long long timestamp;
@property (nonatomic) NSNumber *trueTimestamp;
@property (nonatomic) NSMutableArray<SPSelfDescribingJson *> *contexts;

Expand Down
4 changes: 2 additions & 2 deletions Snowplow/SPTrackerEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ - (instancetype)initWithEvent:(SPEvent *)event {
self.eventId = [NSUUID UUID];
}
if (event.timestamp) {
self.timestamp = event.timestamp.doubleValue / 1000;
self.timestamp = event.timestamp.longLongValue;
} else {
self.timestamp = [[[NSDate alloc] init] timeIntervalSince1970];
self.timestamp = (long long)([[[NSDate alloc] init] timeIntervalSince1970] * 1000);
}
self.trueTimestamp = event.trueTimestamp;
self.contexts = [event.contexts mutableCopy];
Expand Down
8 changes: 4 additions & 4 deletions Snowplow/Snowplow.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ @implementation Snowplow
// --- Version

#if SNOWPLOW_TARGET_IOS
NSString * const kSPVersion = @"ios-1.4.0";
NSString * const kSPVersion = @"ios-1.4.1";
#elif SNOWPLOW_TARGET_TV
NSString * const kSPVersion = @"tvos-1.4.0";
NSString * const kSPVersion = @"tvos-1.4.1";
#elif SNOWPLOW_TARGET_WATCHOS
NSString * const kSPVersion = @"watchos-1.4.0";
NSString * const kSPVersion = @"watchos-1.4.1";
#else
NSString * const kSPVersion = @"osx-1.4.0";
NSString * const kSPVersion = @"osx-1.4.1";
#endif

// --- Emitter
Expand Down
2 changes: 1 addition & 1 deletion SnowplowTracker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SnowplowTracker"
s.version = "1.4.0"
s.version = "1.4.1"
s.summary = "Snowplow event tracker for iOS, macOS, tvOS, watchOS for apps and games."
s.description = <<-DESC
Snowplow is a mobile and event analytics platform with a difference: rather than tell our users how they should analyze their data, we deliver their event-level data in their own data warehouse, on their own Amazon Redshift or Postgres database, so they can analyze it any way they choose. Snowplow mobile is used by data-savvy games companies and app developers to better understand their users and how they engage with their games and applications. Snowplow is open source using the business-friendly Apache License, Version 2.0 and scales horizontally to many billions of events.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.4.1

0 comments on commit e822e68

Please sign in to comment.