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

Remove BSG***InsertIfNotNil #926

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions Bugsnag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
008966F72486D43700DC48C2 /* RegisterErrorDataTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966A92486D43400DC48C2 /* RegisterErrorDataTest.m */; };
008966F82486D43700DC48C2 /* RegisterErrorDataTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966A92486D43400DC48C2 /* RegisterErrorDataTest.m */; };
008966F92486D43700DC48C2 /* RegisterErrorDataTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966A92486D43400DC48C2 /* RegisterErrorDataTest.m */; };
008966FA2486D43700DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966AA2486D43400DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m */; };
008966FB2486D43700DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966AA2486D43400DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m */; };
008966FC2486D43700DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966AA2486D43400DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m */; };
008966FD2486D43700DC48C2 /* BugsnagOnBreadcrumbTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966AB2486D43500DC48C2 /* BugsnagOnBreadcrumbTest.m */; };
008966FE2486D43700DC48C2 /* BugsnagOnBreadcrumbTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966AB2486D43500DC48C2 /* BugsnagOnBreadcrumbTest.m */; };
008966FF2486D43700DC48C2 /* BugsnagOnBreadcrumbTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966AB2486D43500DC48C2 /* BugsnagOnBreadcrumbTest.m */; };
Expand Down Expand Up @@ -655,9 +652,8 @@
00AD1F302486A17900A27979 /* BugsnagSessionTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 00AD1F012486A17900A27979 /* BugsnagSessionTracker.m */; };
00AD1F312486A17900A27979 /* BugsnagSessionTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 00AD1F012486A17900A27979 /* BugsnagSessionTracker.m */; };
00E636C224878D84006CBF1A /* BSG_RFC3339DateTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 008969142486DAD000DC48C2 /* BSG_RFC3339DateTool.m */; };
0140D29A25767C9A00FD0306 /* BugsnagApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9103632502320A00E9D1E2 /* BugsnagApiClientTest.m */; };
012482A325627B51003F7243 /* UIKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 012482A225627B51003F7243 /* UIKitTests.m */; };
014475FD2566844F0018AB94 /* BugsnagApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9103632502320A00E9D1E2 /* BugsnagApiClientTest.m */; };
0140D29A25767C9A00FD0306 /* BugsnagApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9103632502320A00E9D1E2 /* BugsnagApiClientTest.m */; };
01447605256684500018AB94 /* BugsnagApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9103632502320A00E9D1E2 /* BugsnagApiClientTest.m */; };
0187D464255BD7B800C503D9 /* BugsnagApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9103632502320A00E9D1E2 /* BugsnagApiClientTest.m */; };
01B14C56251CE55F00118748 /* report-react-native-promise-rejection.json in Resources */ = {isa = PBXBuildFile; fileRef = 01B14C55251CE55F00118748 /* report-react-native-promise-rejection.json */; };
Expand Down Expand Up @@ -1054,7 +1050,6 @@
008966A72486D43400DC48C2 /* BugsnagThreadTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagThreadTest.m; sourceTree = "<group>"; };
008966A82486D43400DC48C2 /* BugsnagTestConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BugsnagTestConstants.h; sourceTree = "<group>"; };
008966A92486D43400DC48C2 /* RegisterErrorDataTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RegisterErrorDataTest.m; sourceTree = "<group>"; };
008966AA2486D43400DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagCollectionsBSGDictInsertIfNotNilTest.m; sourceTree = "<group>"; };
008966AB2486D43500DC48C2 /* BugsnagOnBreadcrumbTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagOnBreadcrumbTest.m; sourceTree = "<group>"; };
008966AC2486D43500DC48C2 /* BugsnagEventPersistLoadTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagEventPersistLoadTest.m; sourceTree = "<group>"; };
008966AD2486D43500DC48C2 /* BugsnagThreadSerializationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagThreadSerializationTest.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1659,7 +1654,6 @@
008966CA2486D43600DC48C2 /* BugsnagClientMirrorTest.m */,
008966A52486D43400DC48C2 /* BugsnagClientPayloadInfoTest.m */,
008966BE2486D43500DC48C2 /* BugsnagClientTests.m */,
008966AA2486D43400DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m */,
008966B42486D43500DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m */,
008966CE2486D43600DC48C2 /* BugsnagCollectionsBSGDictSetSafeObjectTest.m */,
00896A432486DBF000DC48C2 /* BugsnagConfigurationTests.m */,
Expand Down Expand Up @@ -2584,7 +2578,6 @@
0089679F2486D43700DC48C2 /* KSCrashSentry_Tests.m in Sources */,
008967872486D43700DC48C2 /* KSCrashSentry_NSException_Tests.m in Sources */,
0089679C2486D43700DC48C2 /* KSFileUtils_Tests.m in Sources */,
008966FA2486D43700DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m in Sources */,
008966EE2486D43700DC48C2 /* BugsnagClientPayloadInfoTest.m in Sources */,
008967782486D43700DC48C2 /* KSMachHeader_Tests.m in Sources */,
0089673F2486D43700DC48C2 /* BugsnagAppTest.m in Sources */,
Expand Down Expand Up @@ -2712,7 +2705,6 @@
008967882486D43700DC48C2 /* KSCrashSentry_NSException_Tests.m in Sources */,
0140D29A25767C9A00FD0306 /* BugsnagApiClientTest.m in Sources */,
E701FAA02490EF4A008D842F /* BugsnagApiValidationTest.m in Sources */,
008966FB2486D43700DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m in Sources */,
0089677F2486D43700DC48C2 /* KSLogger_Tests.m in Sources */,
008967342486D43700DC48C2 /* BugsnagClientTests.m in Sources */,
008967222486D43700DC48C2 /* BugsnagErrorReportSinkTests.m in Sources */,
Expand Down Expand Up @@ -2872,7 +2864,6 @@
buildActionMask = 2147483647;
files = (
008967892486D43700DC48C2 /* KSCrashSentry_NSException_Tests.m in Sources */,
008966FC2486D43700DC48C2 /* BugsnagCollectionsBSGDictInsertIfNotNilTest.m in Sources */,
008967802486D43700DC48C2 /* KSLogger_Tests.m in Sources */,
008967352486D43700DC48C2 /* BugsnagClientTests.m in Sources */,
008967232486D43700DC48C2 /* BugsnagErrorReportSinkTests.m in Sources */,
Expand Down
17 changes: 0 additions & 17 deletions Bugsnag/Helpers/BugsnagCollections.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,6 @@ void BSGDictSetSafeObject(NSMutableDictionary *dict, id object, id<NSCopying> ke
*/
void BSGArrayAddSafeObject(NSMutableArray *array, id object);

/**
* Insert an object into a collection only if not nil
*
* @param dict a mutable dictionary
* @param object an object or nil
* @param key the key of the object
*/
void BSGDictInsertIfNotNil(NSMutableDictionary *dict, id object, id<NSCopying> key);

/**
* Insert an object into a collection only if not nil
*
* @param array a mutable array
* @param object an object or nil
*/
void BSGArrayInsertIfNotNil(NSMutableArray *array, id object);

/**
* Merge values from source dictionary with destination
*
Expand Down
13 changes: 0 additions & 13 deletions Bugsnag/Helpers/BugsnagCollections.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,6 @@ void BSGArrayAddSafeObject(NSMutableArray *array, id object) {
[array addObject:object ?: [NSNull null]];
}

void BSGDictInsertIfNotNil(NSMutableDictionary *dict, id object,
id<NSCopying> key) {
if (object && key) {
dict[key] = object;
}
}

void BSGArrayInsertIfNotNil(NSMutableArray *array, id object) {
if (object) {
[array addObject:object];
}
}

NSDictionary *BSGDictMerge(NSDictionary *source, NSDictionary *destination) {
if ([destination count] == 0) {
return source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ - (NSDictionary *)fileWithId:(NSString *)fileId {
NSMutableDictionary *fileContents = [NSMutableDictionary new];
NSMutableDictionary *recrashReport =
[self readFile:[self pathToRecrashReportWithID:fileId] error:&error];
BSGDictInsertIfNotNil(fileContents, recrashReport, @BSG_KSCrashField_RecrashReport);
fileContents[@BSG_KSCrashField_RecrashReport] = recrashReport;
return fileContents;
}
}
Expand All @@ -103,7 +103,7 @@ - (NSMutableDictionary *)fixupCrashReport:(NSDictionary *)report {
NSMutableDictionary *mutableReport = [report mutableCopy];
NSMutableDictionary *mutableInfo =
[report[@BSG_KSCrashField_Report] mutableCopy];
BSGDictInsertIfNotNil(mutableReport, mutableInfo, @BSG_KSCrashField_Report);
mutableReport[@BSG_KSCrashField_Report] = mutableInfo;

// Timestamp gets stored as a unix timestamp. Convert it to rfc3339.
[self convertTimestamp:@BSG_KSCrashField_Timestamp inReport:mutableInfo];
Expand All @@ -118,9 +118,9 @@ - (NSMutableDictionary *)fixupCrashReport:(NSDictionary *)report {

NSMutableDictionary *crashReport =
[report[@BSG_KSCrashField_Crash] mutableCopy];
BSGDictInsertIfNotNil(mutableReport, crashReport, @BSG_KSCrashField_Crash);
mutableReport[@BSG_KSCrashField_Crash] = crashReport;
BSG_KSCrashDoctor *doctor = [BSG_KSCrashDoctor doctor];
BSGDictInsertIfNotNil(crashReport, [doctor diagnoseCrash:report], @BSG_KSCrashField_Diagnosis);
crashReport[@BSG_KSCrashField_Diagnosis] = [doctor diagnoseCrash:report];

return mutableReport;
}
Expand All @@ -144,7 +144,7 @@ - (void)mergeDictWithKey:(NSString *)srcKey
return;
}

BSGDictInsertIfNotNil(report, BSGDictMerge(srcDict, dstDict), dstKey);
report[dstKey] = BSGDictMerge(srcDict, dstDict);
[report removeObjectForKey:srcKey];
}

Expand Down
17 changes: 7 additions & 10 deletions Bugsnag/Payload/BugsnagApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,13 @@ + (void)populateFields:(BugsnagApp *)app
- (NSDictionary *)toDict
{
NSMutableDictionary *dict = [NSMutableDictionary new];
BSGDictInsertIfNotNil(dict, self.bundleVersion, @"bundleVersion");
BSGDictInsertIfNotNil(dict, self.codeBundleId, @"codeBundleId");
BSGDictInsertIfNotNil(dict, self.id, @"id");
BSGDictInsertIfNotNil(dict, self.releaseStage, @"releaseStage");
BSGDictInsertIfNotNil(dict, self.type, @"type");
BSGDictInsertIfNotNil(dict, self.version, @"version");

if (self.dsymUuid != nil) {
BSGDictInsertIfNotNil(dict, @[self.dsymUuid], @"dsymUUIDs");
}
dict[@"bundleVersion"] = self.bundleVersion;
dict[@"codeBundleId"] = self.codeBundleId;
dict[@"dsymUUIDs"] = self.dsymUuid ? @[self.dsymUuid] : nil;
dict[@"id"] = self.id;
dict[@"releaseStage"] = self.releaseStage;
dict[@"type"] = self.type;
dict[@"version"] = self.version;
return dict;
}

Expand Down
6 changes: 3 additions & 3 deletions Bugsnag/Payload/BugsnagAppWithState.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ + (BugsnagAppWithState *)appWithDictionary:(NSDictionary *)event
- (NSDictionary *)toDict
{
NSMutableDictionary *dict = (NSMutableDictionary *) [super toDict];
BSGDictInsertIfNotNil(dict, self.duration, @"duration");
BSGDictInsertIfNotNil(dict, self.durationInForeground, @"durationInForeground");
BSGDictInsertIfNotNil(dict, @(self.inForeground), @"inForeground");
dict[@"duration"] = self.duration;
dict[@"durationInForeground"] = self.durationInForeground;
dict[@"inForeground"] = @(self.inForeground);
return dict;
}

Expand Down
20 changes: 10 additions & 10 deletions Bugsnag/Payload/BugsnagDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ + (void)populateFields:(BugsnagDevice *)device

- (NSDictionary *)toDictionary {
NSMutableDictionary *dict = [NSMutableDictionary new];
BSGDictInsertIfNotNil(dict, @(self.jailbroken), @"jailbroken");
BSGDictInsertIfNotNil(dict, self.id, @"id");
BSGDictInsertIfNotNil(dict, self.locale, @"locale");
BSGDictInsertIfNotNil(dict, self.manufacturer, @"manufacturer");
BSGDictInsertIfNotNil(dict, self.model, @"model");
BSGDictInsertIfNotNil(dict, self.modelNumber, @"modelNumber");
BSGDictInsertIfNotNil(dict, self.osName, @"osName");
BSGDictInsertIfNotNil(dict, self.osVersion, @"osVersion");
BSGDictInsertIfNotNil(dict, self.runtimeVersions, @"runtimeVersions");
BSGDictInsertIfNotNil(dict, self.totalMemory, @"totalMemory");
dict[@"jailbroken"] = @(self.jailbroken);
dict[@"id"] = self.id;
dict[@"locale"] = self.locale;
dict[@"manufacturer"] = self.manufacturer;
dict[@"model"] = self.model;
dict[@"modelNumber"] = self.modelNumber;
dict[@"osName"] = self.osName;
dict[@"osVersion"] = self.osVersion;
dict[@"runtimeVersions"] = self.runtimeVersions;
dict[@"totalMemory"] = self.totalMemory;
return dict;
}

Expand Down
16 changes: 6 additions & 10 deletions Bugsnag/Payload/BugsnagDeviceWithState.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
NSMutableDictionary *device = [NSMutableDictionary new];
NSDictionary *state = [event valueForKeyPath:@"user.state.deviceState"];
[device addEntriesFromDictionary:state];
BSGDictInsertIfNotNil(device, [event valueForKeyPath:@"system.time_zone"], @"timezone");
device[@"timezone"] = [event valueForKeyPath:@"system.time_zone"];

#if BSG_PLATFORM_SIMULATOR
BSGDictSetSafeObject(device, @YES, @"simulator");
Expand Down Expand Up @@ -128,15 +128,11 @@ + (BugsnagDeviceWithState *)deviceWithDictionary:(NSDictionary *)event {
}

- (NSDictionary *)toDictionary {
NSMutableDictionary *dict = (NSMutableDictionary *)
[super toDictionary];
BSGDictInsertIfNotNil(dict, self.freeDisk, @"freeDisk");
BSGDictInsertIfNotNil(dict, self.freeMemory, @"freeMemory");
BSGDictInsertIfNotNil(dict, self.orientation, @"orientation");

if (self.time != nil) {
BSGDictInsertIfNotNil(dict, [BSG_RFC3339DateTool stringFromDate:self.time], @"time");
}
NSMutableDictionary *dict = [[super toDictionary] mutableCopy];
dict[@"freeDisk"] = self.freeDisk;
dict[@"freeMemory"] = self.freeMemory;
dict[@"orientation"] = self.orientation;
dict[@"time"] = self.time ? [BSG_RFC3339DateTool stringFromDate:self.time] : nil;
return dict;
}

Expand Down
6 changes: 3 additions & 3 deletions Bugsnag/Payload/BugsnagError.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ - (NSDictionary *)findErrorReportingThread:(NSDictionary *)event {

- (NSDictionary *)toDictionary {
NSMutableDictionary *dict = [NSMutableDictionary new];
BSGDictInsertIfNotNil(dict, self.errorClass, BSGKeyErrorClass);
BSGDictInsertIfNotNil(dict, self.errorMessage, BSGKeyMessage);
BSGDictInsertIfNotNil(dict, BSGSerializeErrorType(self.type), BSGKeyType);
dict[BSGKeyErrorClass] = self.errorClass;
dict[BSGKeyMessage] = self.errorMessage;
dict[BSGKeyType] = BSGSerializeErrorType(self.type);

NSMutableArray *frames = [NSMutableArray new];
for (BugsnagStackframe *frame in self.stacktrace) {
Expand Down
6 changes: 3 additions & 3 deletions Bugsnag/Payload/BugsnagEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ - (NSDictionary *)toJson {
BSGDictSetSafeObject(event, [self.app toDict], BSGKeyApp);

BSGDictSetSafeObject(event, [self context], BSGKeyContext);
BSGDictInsertIfNotNil(event, self.groupingHash, BSGKeyGroupingHash);
event[BSGKeyGroupingHash] = self.groupingHash;


BSGDictSetSafeObject(event, @(self.handledState.unhandled), BSGKeyUnhandled);
Expand All @@ -713,10 +713,10 @@ - (NSDictionary *)toJson {
// Inserted into `context` property
[metadata removeObjectForKey:BSGKeyContext];
// Build metadata
BSGDictInsertIfNotNil(metadata, self.error, BSGKeyError);
metadata[BSGKeyError] = self.error;

// add user
BSGDictInsertIfNotNil(event, [self.user toJson], BSGKeyUser);
event[BSGKeyUser] = [self.user toJson];

if (self.session) {
BSGDictSetSafeObject(event, [self generateSessionDict], BSGKeySession);
Expand Down
10 changes: 5 additions & 5 deletions Bugsnag/Payload/BugsnagSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ - (_Nonnull instancetype)initWithId:(NSString *_Nonnull)sessionId

- (NSDictionary *)toJson {
NSMutableDictionary *dict = [NSMutableDictionary new];
BSGDictInsertIfNotNil(dict, self.id, kBugsnagSessionId);
BSGDictInsertIfNotNil(dict, [BSG_RFC3339DateTool stringFromDate:self.startedAt], kBugsnagStartedAt);
dict[kBugsnagSessionId] = self.id;
dict[kBugsnagStartedAt] = [BSG_RFC3339DateTool stringFromDate:self.startedAt];

if (self.user) {
BSGDictInsertIfNotNil(dict, [self.user toJson], kBugsnagUser);
dict[kBugsnagUser] = [self.user toJson];
}

BSGDictInsertIfNotNil(dict, [self.app toDict], BSGKeyApp);
BSGDictInsertIfNotNil(dict, [self.device toDictionary], BSGKeyDevice);
dict[BSGKeyApp] = [self.app toDict];
dict[BSGKeyDevice] = [self.device toDictionary];
return [NSDictionary dictionaryWithDictionary:dict];
}

Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagSessionTrackingPayload.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ - (NSMutableDictionary *)toJson
for (BugsnagSession *session in self.sessions) {
[sessionData addObject:[session toDictionary]];
}
BSGDictInsertIfNotNil(dict, sessionData, @"sessions");
dict[@"sessions"] = sessionData;
BSGDictSetSafeObject(dict, [[Bugsnag client].notifier toDict], BSGKeyNotifier);

// app/device data collection relies on KSCrash reports,
Expand Down
6 changes: 3 additions & 3 deletions Bugsnag/Payload/BugsnagStackframe.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ - (NSString *)description {

- (NSDictionary *)toDictionary {
NSMutableDictionary *dict = [NSMutableDictionary new];
BSGDictInsertIfNotNil(dict, self.machoFile, BSGKeyMachoFile);
BSGDictInsertIfNotNil(dict, self.method, BSGKeyMethod);
BSGDictInsertIfNotNil(dict, self.machoUuid, BSGKeyMachoUUID);
dict[BSGKeyMachoFile] = self.machoFile;
dict[BSGKeyMethod] = self.method;
dict[BSGKeyMachoUUID] = self.machoUuid;

if (self.frameAddress != nil) {
NSString *frameAddr = [NSString stringWithFormat:BSGKeyFrameAddrFormat, [self.frameAddress unsignedLongValue]];
Expand Down
6 changes: 3 additions & 3 deletions Bugsnag/Payload/BugsnagThread.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ - (instancetype)initWithThread:(NSDictionary *)thread binaryImages:(NSArray *)bi

- (NSDictionary *)toDictionary {
NSMutableDictionary *dict = [NSMutableDictionary new];
BSGDictInsertIfNotNil(dict, self.id, @"id");
BSGDictInsertIfNotNil(dict, self.name, @"name");
dict[@"id"] = self.id;
dict[@"name"] = self.name;
BSGDictSetSafeObject(dict, @(self.errorReportingThread), @"errorReportingThread");
BSGDictSetSafeObject(dict, BSGSerializeThreadType(self.type), @"type");
BSGDictSetSafeObject(dict, @(self.errorReportingThread), @"errorReportingThread");
Expand Down Expand Up @@ -155,7 +155,7 @@ + (NSDictionary *)enhanceThreadInfo:(NSDictionary *)thread
if (seen == 2 && !stackOverflow && [@[BSGKeySignal, BSGKeyMach] containsObject:errorType]) {
BSGDictSetSafeObject(mutableFrame, @YES, BSGKeyIsLR);
}
BSGArrayInsertIfNotNil(stacktrace, mutableFrame);
[stacktrace addObject:mutableFrame];
}
}
NSMutableDictionary *copy = [NSMutableDictionary dictionaryWithDictionary:thread];
Expand Down
6 changes: 3 additions & 3 deletions Bugsnag/Payload/BugsnagUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ + (instancetype)userWithUserId:(NSString *)userId name:(NSString *)name emailAdd

- (NSDictionary *)toJson {
NSMutableDictionary *dict = [NSMutableDictionary new];
BSGDictInsertIfNotNil(dict, self.id, @"id");
BSGDictInsertIfNotNil(dict, self.email, @"email");
BSGDictInsertIfNotNil(dict, self.name, @"name");
dict[@"id"] = self.id;
dict[@"email"] = self.email;
dict[@"name"] = self.name;
return [NSDictionary dictionaryWithDictionary:dict];
}

Expand Down
40 changes: 0 additions & 40 deletions Tests/BugsnagCollectionsBSGDictInsertIfNotNilTest.m

This file was deleted.