diff --git a/CHANGELOG.md b/CHANGELOG.md index 76552471e..175a57036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Source/BugsnagKSCrashSysInfoParser.m b/Source/BugsnagKSCrashSysInfoParser.m index 59a5a5ea0..354f8a784 100644 --- a/Source/BugsnagKSCrashSysInfoParser.m +++ b/Source/BugsnagKSCrashSysInfoParser.m @@ -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"); diff --git a/Tests/BugsnagSinkTests.m b/Tests/BugsnagSinkTests.m index b783f0c8b..bddbc6e13 100644 --- a/Tests/BugsnagSinkTests.m +++ b/Tests/BugsnagSinkTests.m @@ -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"); diff --git a/features/runtime_versions.feature b/features/runtime_versions.feature new file mode 100644 index 000000000..1fa7adafb --- /dev/null +++ b/features/runtime_versions.feature @@ -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