Skip to content

Commit

Permalink
Merge pull request #340 from bugsnag/runtime-versions
Browse files Browse the repository at this point in the history
Migrate version information to device.runtimeVersions
  • Loading branch information
fractalwrench authored Apr 24, 2019
2 parents c0403d2 + 39685c1 commit d6ea1b5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Source/BugsnagKSCrashSysInfoParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@
BSGDictSetSafeObject(deviceState, report[@"machine"], @"model");
BSGDictSetSafeObject(deviceState, report[@"system_name"], @"osName");
BSGDictSetSafeObject(deviceState, report[@"system_version"], @"osVersion");
BSGDictSetSafeObject(deviceState, report[@"os_version"], @"osBuild");

NSString *osVersion = report[@"os_version"];

if (osVersion != nil) {
BSGDictSetSafeObject(deviceState, @{@"osBuild": osVersion}, @"runtimeVersions");
}

BSGDictSetSafeObject(deviceState, @(PLATFORM_WORD_SIZE), @"wordSize");
BSGDictSetSafeObject(deviceState, @"Apple", @"manufacturer");
BSGDictSetSafeObject(deviceState, report[@"jailbroken"], @"jailbroken");
Expand Down
2 changes: 1 addition & 1 deletion Tests/BugsnagSinkTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ - (void)testEventDevice {
XCTAssertEqualObjects(device[@"modelNumber"], @"MacBookPro11,3");
XCTAssertEqualObjects(device[@"osName"], @"iPhone OS");
XCTAssertEqualObjects(device[@"osVersion"], @"8.1");
XCTAssertEqualObjects(device[@"osBuild"], @"14B25");
XCTAssertEqualObjects(device[@"runtimeVersions"][@"osBuild"], @"14B25");
XCTAssertEqualObjects(device[@"totalMemory"], @15065522176);
XCTAssertNotNil(device[@"freeDisk"]);
XCTAssertEqualObjects(device[@"timezone"], @"PST");
Expand Down
14 changes: 14 additions & 0 deletions features/runtime_versions.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Feature: Runtime versions are included in all requests

Scenario: Runtime versions included in Cocoa error
When I run "HandledErrorScenario"
Then I should receive a request
And the request is valid for the error reporting API
And the payload field "events.0.device.runtimeVersions.osBuild" is not null

Scenario: Runtime versions included in Cocoa session
When I run "ManualSessionScenario"
And I wait for 10 seconds
Then I should receive a request
And the request is a valid for the session tracking API
And the payload field "device.runtimeVersions.osBuild" is not null

0 comments on commit d6ea1b5

Please sign in to comment.