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

Add Device time of report capture to JSON payload #315

Merged
merged 8 commits into from
Oct 31, 2018
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

## 5.17.1 (TBD)

### Bug Fixes

* Add Device time of report capture to JSON payload
[#315](https://github.com/bugsnag/bugsnag-cocoa/pull/315)

## 5.17.0 (2018-09-25)

### Enhancements
Expand Down
1 change: 1 addition & 0 deletions Source/BugsnagKSCrashSysInfoParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
[report valueForKeyPath:@"system.memory.free"],
@"freeMemory");

BSGDictSetSafeObject(device, [report valueForKeyPath:@"report.timestamp"], @"time");

NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(
Expand Down
6 changes: 4 additions & 2 deletions Tests/BugsnagSinkTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ - (void)testEventDevice {
NSDictionary *device = event[@"device"];
XCTAssertNotNil(device);
#if TARGET_OS_IPHONE || TARGET_OS_TV || TARGET_IPHONE_SIMULATOR
XCTAssertEqual(18, device.count);
XCTAssertEqual(19, device.count);
#else
XCTAssertEqual(17, device.count);
XCTAssertEqual(18, device.count);
#endif

XCTAssertEqualObjects(device[@"id"], @"f6d519a74213a57f8d052c53febfeee6f856d062");
Expand All @@ -277,6 +277,8 @@ - (void)testEventDevice {
XCTAssertEqualObjects(device[@"jailbroken"], @YES);
XCTAssertEqualObjects(device[@"freeMemory"], @742920192);
XCTAssertEqualObjects(device[@"orientation"], @"unknown");
XCTAssertEqualObjects(device[@"time"], @"2014-12-02T01:56:13Z");

#if defined(__LP64__)
XCTAssertEqualObjects(device[@"wordSize"], @64);
#else
Expand Down
1 change: 1 addition & 0 deletions features/crashprobe.feature
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Scenario: Throw a NSException
And the "method" of stack frame 0 equals "__exceptionPreprocess"
And the "method" of stack frame 1 equals "objc_exception_throw"
And the "method" of stack frame 2 equals "-[ObjCExceptionScenario run]"
And the payload field "events.0.device.time" is not null

Scenario: Access a non-object as an object
When I set environment variable "BUGSNAG_API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
Expand Down
1 change: 1 addition & 0 deletions features/handled_errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Scenario: Override errorClass and message from a notifyError() callback
And the request is a valid for the error reporting API
And the exception "errorClass" equals "Bar"
And the exception "message" equals "Foo"
And the payload field "events.0.device.time" is not null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to verify the format of this field and also that it is the current time.


Scenario: Reporting an NSError
When I run "HandledErrorScenario" with the defaults on "iPhone8-11.2"
Expand Down