Skip to content

Commit

Permalink
refactor: Migrate version information to device.runtimeVersions (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench authored and kattrali committed May 1, 2019
1 parent 6207b5b commit 7118e54
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog

### Enhancements

* Add internal api for mutating session payload before sending
[#341](https://github.com/bugsnag/bugsnag-cocoa/pull/341)

* Persist breadcrumbs on disk to allow reading upon next boot in the event of an
uncatchable app termination.
* Add `+[Bugsnag appDidCrashLastLaunch]` as a helper to determine if the
Expand Down
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 7118e54

Please sign in to comment.