From cf3cb13144d3c97c443e34ea60934ed2b335e992 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Wed, 9 Jun 2021 13:57:53 +0100 Subject: [PATCH 1/2] Remove unused BSG_mergedInto --- Bugsnag/Bugsnag.m | 55 ---------------------------------- Bugsnag/Client/BugsnagClient.m | 4 --- Bugsnag/Payload/BugsnagEvent.m | 7 +---- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/Bugsnag/Bugsnag.m b/Bugsnag/Bugsnag.m index c05458746..2519caa6e 100644 --- a/Bugsnag/Bugsnag.m +++ b/Bugsnag/Bugsnag.m @@ -41,10 +41,6 @@ static BugsnagClient *bsg_g_bugsnag_client = NULL; -@interface NSDictionary (BSGKSMerge) -- (NSDictionary *)BSG_mergedInto:(NSDictionary *)dest; -@end - @implementation Bugsnag + (BugsnagClient *_Nonnull)start { @@ -357,54 +353,3 @@ + (void)removeOnBreadcrumbBlock:(BugsnagOnBreadcrumbBlock _Nonnull)block { } @end - -// -// NSDictionary+Merge.m -// -// Created by Karl Stenerud on 2012-10-01. -// -// Copyright (c) 2012 Karl Stenerud. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall remain in place -// in this source code. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -@implementation NSDictionary (BSGKSMerge) - -- (NSDictionary *)BSG_mergedInto:(NSDictionary *)dest { - if ([dest count] == 0) { - return self; - } - if ([self count] == 0) { - return dest; - } - - NSMutableDictionary *dict = [dest mutableCopy]; - for (id key in [self allKeys]) { - id srcEntry = self[key]; - id dstEntry = dest[key]; - if ([dstEntry isKindOfClass:[NSDictionary class]] && - [srcEntry isKindOfClass:[NSDictionary class]]) { - srcEntry = [srcEntry BSG_mergedInto:dstEntry]; - } - dict[key] = srcEntry; - } - return dict; -} - -@end diff --git a/Bugsnag/Client/BugsnagClient.m b/Bugsnag/Client/BugsnagClient.m index 747ccd6d4..642ea6326 100644 --- a/Bugsnag/Client/BugsnagClient.m +++ b/Bugsnag/Client/BugsnagClient.m @@ -112,10 +112,6 @@ static NSUInteger unhandledCount; static bool hasRecordedSessions; -@interface NSDictionary (BSGKSMerge) -- (NSDictionary *)BSG_mergedInto:(NSDictionary *)dest; -@end - /** * Handler executed when the application crashes. Writes information about the * current application state using the crash report writer. diff --git a/Bugsnag/Payload/BugsnagEvent.m b/Bugsnag/Payload/BugsnagEvent.m index 214765d60..a5633fb50 100644 --- a/Bugsnag/Payload/BugsnagEvent.m +++ b/Bugsnag/Payload/BugsnagEvent.m @@ -129,12 +129,7 @@ id BSGLoadConfigValue(NSDictionary *report, NSString *valueName) { return nil; } -// MARK: - BugsnagEvent implementation - -@interface NSDictionary (BSGKSMerge) -- (NSDictionary *)BSG_mergedInto:(NSDictionary *)dest; -@end - +// MARK: - @implementation BugsnagEvent From f4bf34c656a57d50a7a19ee4f23f4900fce315a7 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Wed, 9 Jun 2021 14:24:11 +0100 Subject: [PATCH 2/2] Remove old category headers --- Bugsnag.xcodeproj/project.pbxproj | 18 ---------------- Bugsnag/Client/BugsnagClient+AppHangs.h | 24 ---------------------- Bugsnag/Client/BugsnagClient+OutOfMemory.h | 21 ------------------- Bugsnag/Client/BugsnagClient+Private.h | 7 +++++++ Bugsnag/Client/BugsnagClient.m | 10 ++++----- Bugsnag/Helpers/BSGAppHangDetector.m | 1 - Bugsnag/Payload/BugsnagThread+Private.h | 4 ++++ Bugsnag/Payload/BugsnagThread+Recording.h | 21 ------------------- Bugsnag/Payload/BugsnagThread.m | 11 +++++----- Tests/BugsnagThreadTests.m | 1 - 10 files changed, 20 insertions(+), 98 deletions(-) delete mode 100644 Bugsnag/Client/BugsnagClient+AppHangs.h delete mode 100644 Bugsnag/Client/BugsnagClient+OutOfMemory.h delete mode 100644 Bugsnag/Payload/BugsnagThread+Recording.h diff --git a/Bugsnag.xcodeproj/project.pbxproj b/Bugsnag.xcodeproj/project.pbxproj index b483f2937..f3c87fab9 100644 --- a/Bugsnag.xcodeproj/project.pbxproj +++ b/Bugsnag.xcodeproj/project.pbxproj @@ -601,9 +601,6 @@ 010FF28825ED2A8D00E4F2B0 /* BSGAppHangDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 010FF28325ED2A8D00E4F2B0 /* BSGAppHangDetector.m */; }; 010FF28925ED2A8D00E4F2B0 /* BSGAppHangDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 010FF28325ED2A8D00E4F2B0 /* BSGAppHangDetector.m */; }; 010FF28A25ED2A8D00E4F2B0 /* BSGAppHangDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 010FF28325ED2A8D00E4F2B0 /* BSGAppHangDetector.m */; }; - 011ADCE326049A3600B20D72 /* BugsnagClient+OutOfMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 011ADCE126049A3600B20D72 /* BugsnagClient+OutOfMemory.h */; }; - 011ADCE426049A3600B20D72 /* BugsnagClient+OutOfMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 011ADCE126049A3600B20D72 /* BugsnagClient+OutOfMemory.h */; }; - 011ADCE526049A3600B20D72 /* BugsnagClient+OutOfMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 011ADCE126049A3600B20D72 /* BugsnagClient+OutOfMemory.h */; }; 012482A325627B51003F7243 /* UIKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 012482A225627B51003F7243 /* UIKitTests.m */; }; 0126DF1B257A92860031A70C /* BugsnagSession+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 0126DF1A257A92860031A70C /* BugsnagSession+Private.h */; }; 0126DF1C257A92860031A70C /* BugsnagSession+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 0126DF1A257A92860031A70C /* BugsnagSession+Private.h */; }; @@ -636,9 +633,6 @@ 0126F7BF25DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0126F7BA25DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.m */; }; 0126F7C025DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0126F7BA25DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.m */; }; 0126F7C125DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0126F7BA25DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.m */; }; - 0127149225F6171000D3500A /* BugsnagClient+AppHangs.h in Headers */ = {isa = PBXBuildFile; fileRef = 0127149025F6171000D3500A /* BugsnagClient+AppHangs.h */; }; - 0127149325F6171000D3500A /* BugsnagClient+AppHangs.h in Headers */ = {isa = PBXBuildFile; fileRef = 0127149025F6171000D3500A /* BugsnagClient+AppHangs.h */; }; - 0127149425F6171000D3500A /* BugsnagClient+AppHangs.h in Headers */ = {isa = PBXBuildFile; fileRef = 0127149025F6171000D3500A /* BugsnagClient+AppHangs.h */; }; 0140D29A25767C9A00FD0306 /* BugsnagApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9103632502320A00E9D1E2 /* BugsnagApiClientTest.m */; }; 01447605256684500018AB94 /* BugsnagApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CB9103632502320A00E9D1E2 /* BugsnagApiClientTest.m */; }; 01468F5225876DC1002B0519 /* BSGNotificationBreadcrumbs.h in Headers */ = {isa = PBXBuildFile; fileRef = 01468F5025876DC1002B0519 /* BSGNotificationBreadcrumbs.h */; }; @@ -1283,8 +1277,6 @@ 00E636C324878FFC006CBF1A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 010FF28225ED2A8D00E4F2B0 /* BSGAppHangDetector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BSGAppHangDetector.h; sourceTree = ""; }; 010FF28325ED2A8D00E4F2B0 /* BSGAppHangDetector.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BSGAppHangDetector.m; sourceTree = ""; }; - 011ADCE126049A3600B20D72 /* BugsnagClient+OutOfMemory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagClient+OutOfMemory.h"; sourceTree = ""; }; - 01210B7C25CD661800D683BB /* BugsnagThread+Recording.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagThread+Recording.h"; sourceTree = ""; }; 012482A225627B51003F7243 /* UIKitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIKitTests.m; sourceTree = ""; }; 0126DED7257A87F40031A70C /* BugsnagAppWithState+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagAppWithState+Private.h"; sourceTree = ""; }; 0126DEDF257A89490031A70C /* BugsnagBreadcrumb+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagBreadcrumb+Private.h"; sourceTree = ""; }; @@ -1300,7 +1292,6 @@ 0126F7AA25DD5118008483C2 /* BSGEventUploadFileOperation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BSGEventUploadFileOperation.m; sourceTree = ""; }; 0126F7B925DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BSGEventUploadKSCrashReportOperation.h; sourceTree = ""; }; 0126F7BA25DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BSGEventUploadKSCrashReportOperation.m; sourceTree = ""; }; - 0127149025F6171000D3500A /* BugsnagClient+AppHangs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagClient+AppHangs.h"; sourceTree = ""; }; 0134524A256BCF7C0088C548 /* BugsnagError+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagError+Private.h"; sourceTree = ""; }; 0134524B256BD00A0088C548 /* BugsnagThread+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagThread+Private.h"; sourceTree = ""; }; 0140D24725765F8F00FD0306 /* BSGUIKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BSGUIKit.h; sourceTree = ""; }; @@ -1780,8 +1771,6 @@ isa = PBXGroup; children = ( 008967BB2486DA1900DC48C2 /* BugsnagClient.m */, - 0127149025F6171000D3500A /* BugsnagClient+AppHangs.h */, - 011ADCE126049A3600B20D72 /* BugsnagClient+OutOfMemory.h */, 008967BC2486DA1900DC48C2 /* BugsnagClient+Private.h */, ); path = Client; @@ -1895,7 +1884,6 @@ 008968582486DA9500DC48C2 /* BugsnagStateEvent.m */, 008968612486DA9500DC48C2 /* BugsnagThread.m */, 0134524B256BD00A0088C548 /* BugsnagThread+Private.h */, - 01210B7C25CD661800D683BB /* BugsnagThread+Recording.h */, 0089685F2486DA9500DC48C2 /* BugsnagUser.m */, 0126DF34257A94740031A70C /* BugsnagUser+Private.h */, ); @@ -2040,7 +2028,6 @@ 0126F7BB25DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.h in Headers */, 008968DE2486DAA700DC48C2 /* BugsnagPluginClient.h in Headers */, 008969EA2486DAD100DC48C2 /* BSG_KSCrashReport.h in Headers */, - 011ADCE326049A3600B20D72 /* BugsnagClient+OutOfMemory.h in Headers */, 008969F02486DAD100DC48C2 /* BSG_KSCrashReportFields.h in Headers */, 00896A2F2486DAD100DC48C2 /* BSG_KSCrashIdentifier.h in Headers */, 008969FC2486DAD100DC48C2 /* BSG_KSCrashAdvanced.h in Headers */, @@ -2057,7 +2044,6 @@ 008968F42486DAB800DC48C2 /* BugsnagSessionFileStore.h in Headers */, 008968882486DA9600DC48C2 /* BugsnagHandledState.h in Headers */, CBCF77A325010648004AF22A /* BSGJSONSerialization.h in Headers */, - 0127149225F6171000D3500A /* BugsnagClient+AppHangs.h in Headers */, 00896A082486DAD100DC48C2 /* BSG_KSCrashSentry_Private.h in Headers */, 008969722486DAD000DC48C2 /* BSG_KSSignalInfo.h in Headers */, 008967C22486DA1900DC48C2 /* BugsnagClient+Private.h in Headers */, @@ -2144,7 +2130,6 @@ 0126F7BC25DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.h in Headers */, 008968DF2486DAA700DC48C2 /* BugsnagPluginClient.h in Headers */, 008969EB2486DAD100DC48C2 /* BSG_KSCrashReport.h in Headers */, - 011ADCE426049A3600B20D72 /* BugsnagClient+OutOfMemory.h in Headers */, 008969F12486DAD100DC48C2 /* BSG_KSCrashReportFields.h in Headers */, 00896A302486DAD100DC48C2 /* BSG_KSCrashIdentifier.h in Headers */, 008969FD2486DAD100DC48C2 /* BSG_KSCrashAdvanced.h in Headers */, @@ -2161,7 +2146,6 @@ 0126F79C25DD510E008483C2 /* BSGEventUploadObjectOperation.h in Headers */, 008968892486DA9600DC48C2 /* BugsnagHandledState.h in Headers */, 00896A092486DAD100DC48C2 /* BSG_KSCrashSentry_Private.h in Headers */, - 0127149325F6171000D3500A /* BugsnagClient+AppHangs.h in Headers */, CBCF77A425010648004AF22A /* BSGJSONSerialization.h in Headers */, 008969732486DAD000DC48C2 /* BSG_KSSignalInfo.h in Headers */, 008967C32486DA1900DC48C2 /* BugsnagClient+Private.h in Headers */, @@ -2248,7 +2232,6 @@ 0126F7BD25DD512B008483C2 /* BSGEventUploadKSCrashReportOperation.h in Headers */, 008968E02486DAA700DC48C2 /* BugsnagPluginClient.h in Headers */, 008969EC2486DAD100DC48C2 /* BSG_KSCrashReport.h in Headers */, - 011ADCE526049A3600B20D72 /* BugsnagClient+OutOfMemory.h in Headers */, 008969F22486DAD100DC48C2 /* BSG_KSCrashReportFields.h in Headers */, 00896A312486DAD100DC48C2 /* BSG_KSCrashIdentifier.h in Headers */, 008969FE2486DAD100DC48C2 /* BSG_KSCrashAdvanced.h in Headers */, @@ -2265,7 +2248,6 @@ 0126F79D25DD510E008483C2 /* BSGEventUploadObjectOperation.h in Headers */, 0089688A2486DA9600DC48C2 /* BugsnagHandledState.h in Headers */, 00896A0A2486DAD100DC48C2 /* BSG_KSCrashSentry_Private.h in Headers */, - 0127149425F6171000D3500A /* BugsnagClient+AppHangs.h in Headers */, CBCF77A525010648004AF22A /* BSGJSONSerialization.h in Headers */, 008969742486DAD100DC48C2 /* BSG_KSSignalInfo.h in Headers */, 008967C42486DA1900DC48C2 /* BugsnagClient+Private.h in Headers */, diff --git a/Bugsnag/Client/BugsnagClient+AppHangs.h b/Bugsnag/Client/BugsnagClient+AppHangs.h deleted file mode 100644 index 40d540781..000000000 --- a/Bugsnag/Client/BugsnagClient+AppHangs.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// BugsnagClient+AppHangs.h -// Bugsnag -// -// Created by Nick Dowell on 08/03/2021. -// Copyright © 2021 Bugsnag Inc. All rights reserved. -// - -#import "BugsnagClient+Private.h" - -#import "BSGAppHangDetector.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BugsnagClient (AppHangs) - -/// @return A `BugsnagEvent` if the last run ended with a fatal app hang, `nil` otherwise. -- (nullable BugsnagEvent *)loadFatalAppHangEvent; - -- (void)startAppHangDetector; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Bugsnag/Client/BugsnagClient+OutOfMemory.h b/Bugsnag/Client/BugsnagClient+OutOfMemory.h deleted file mode 100644 index c210e7cfc..000000000 --- a/Bugsnag/Client/BugsnagClient+OutOfMemory.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// BugsnagClient+OutOfMemory.h -// Bugsnag -// -// Created by Nick Dowell on 19/03/2021. -// Copyright © 2021 Bugsnag Inc. All rights reserved. -// - -#import - -@class BugsnagEvent; - -NS_ASSUME_NONNULL_BEGIN - -@interface BugsnagClient (OutOfMemory) - -- (BugsnagEvent *)generateOutOfMemoryEvent; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Bugsnag/Client/BugsnagClient+Private.h b/Bugsnag/Client/BugsnagClient+Private.h index ea91a26e3..d1f80f7f5 100644 --- a/Bugsnag/Client/BugsnagClient+Private.h +++ b/Bugsnag/Client/BugsnagClient+Private.h @@ -134,6 +134,11 @@ NS_ASSUME_NONNULL_BEGIN - (BugsnagDeviceWithState *)generateDeviceWithState:(NSDictionary *)systemInfo; +- (BugsnagEvent *)generateOutOfMemoryEvent; + +/// @return A `BugsnagEvent` if the last run ended with a fatal app hang, `nil` otherwise. +- (nullable BugsnagEvent *)loadFatalAppHangEvent; + - (void)notifyInternal:(BugsnagEvent *)event block:(nullable BugsnagOnErrorBlock)block; - (void)removeObserverWithBlock:(BugsnagObserverBlock)block; // Used in BugsnagReactNative @@ -142,6 +147,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)start; +- (void)startAppHangDetector; + @end NS_ASSUME_NONNULL_END diff --git a/Bugsnag/Client/BugsnagClient.m b/Bugsnag/Client/BugsnagClient.m index 642ea6326..ed59a983b 100644 --- a/Bugsnag/Client/BugsnagClient.m +++ b/Bugsnag/Client/BugsnagClient.m @@ -28,6 +28,7 @@ #import "BugsnagClient+Private.h" +#import "BSGAppHangDetector.h" #import "BSGConnectivity.h" #import "BSGEventUploader.h" #import "BSGFileLocations.h" @@ -48,8 +49,6 @@ #import "BugsnagAppWithState+Private.h" #import "BugsnagBreadcrumb+Private.h" #import "BugsnagBreadcrumbs.h" -#import "BugsnagClient+AppHangs.h" -#import "BugsnagClient+OutOfMemory.h" #import "BugsnagCollections.h" #import "BugsnagConfiguration+Private.h" #import "BugsnagCrashSentry.h" @@ -71,7 +70,6 @@ #import "BugsnagStateEvent.h" #import "BugsnagSystemState.h" #import "BugsnagThread+Private.h" -#import "BugsnagThread+Recording.h" #import "BugsnagUser+Private.h" #if BSG_PLATFORM_IOS || BSG_PLATFORM_TVOS @@ -209,7 +207,7 @@ void BSGWriteSessionCrashData(BugsnagSession *session) { // MARK: - -@interface BugsnagClient () +@interface BugsnagClient () @property (nonatomic) BSGNotificationBreadcrumbs *notificationBreadcrumbs; @@ -1211,7 +1209,7 @@ - (void)updateCrashDetectionSettings { // OOMs are controlled by config.autoDetectErrors so don't require any further action } -#pragma mark BugsnagClient+AppHangs +// MARK: - App Hangs - (void)startAppHangDetector { [NSFileManager.defaultManager removeItemAtPath:BSGFileLocations.current.appHangEvent error:nil]; @@ -1301,7 +1299,7 @@ - (nullable BugsnagEvent *)loadFatalAppHangEvent { return event; } -#pragma mark BugsnagClient+OutOfMemory +// MARK: - OOMs - (BugsnagEvent *)generateOutOfMemoryEvent { NSDictionary *appDict = self.systemState.lastLaunchState[SYSTEMSTATE_KEY_APP]; diff --git a/Bugsnag/Helpers/BSGAppHangDetector.m b/Bugsnag/Helpers/BSGAppHangDetector.m index 5a0eac529..b0faf6175 100644 --- a/Bugsnag/Helpers/BSGAppHangDetector.m +++ b/Bugsnag/Helpers/BSGAppHangDetector.m @@ -15,7 +15,6 @@ #import "BSG_KSMach.h" #import "BugsnagCollections.h" #import "BugsnagLogger.h" -#import "BugsnagThread+Recording.h" #import "BugsnagThread+Private.h" #if TARGET_OS_IOS diff --git a/Bugsnag/Payload/BugsnagThread+Private.h b/Bugsnag/Payload/BugsnagThread+Private.h index 7d0f32f8e..e43dde0cd 100644 --- a/Bugsnag/Payload/BugsnagThread+Private.h +++ b/Bugsnag/Payload/BugsnagThread+Private.h @@ -20,6 +20,8 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithThread:(NSDictionary *)thread binaryImages:(NSArray *)binaryImages; ++ (NSArray *)allThreads:(BOOL)allThreads callStackReturnAddresses:(NSArray *)callStackReturnAddresses; + + (instancetype)threadFromJson:(NSDictionary *)json; @property (readonly, nullable, nonatomic) NSString *crashInfoMessage; @@ -30,6 +32,8 @@ NS_ASSUME_NONNULL_BEGIN depth:(NSUInteger)depth errorType:(nullable NSString *)errorType; ++ (nullable instancetype)mainThread; + + (NSMutableArray *)serializeThreads:(nullable NSArray *)threads; + (NSMutableArray *)threadsFromArray:(NSArray *)threads diff --git a/Bugsnag/Payload/BugsnagThread+Recording.h b/Bugsnag/Payload/BugsnagThread+Recording.h deleted file mode 100644 index ccc664504..000000000 --- a/Bugsnag/Payload/BugsnagThread+Recording.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// BugsnagThread+Recording.h -// Bugsnag -// -// Created by Nick Dowell on 05/02/2021. -// Copyright © 2021 Bugsnag Inc. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface BugsnagThread (Recording) - -+ (NSArray *)allThreads:(BOOL)allThreads callStackReturnAddresses:(NSArray *)callStackReturnAddresses; - -+ (nullable instancetype)mainThread; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Bugsnag/Payload/BugsnagThread.m b/Bugsnag/Payload/BugsnagThread.m index 4ae8f00ab..e43384317 100644 --- a/Bugsnag/Payload/BugsnagThread.m +++ b/Bugsnag/Payload/BugsnagThread.m @@ -8,16 +8,15 @@ #import "BugsnagThread+Private.h" +#import "BSG_KSBacktrace_Private.h" #import "BSG_KSCrashReportFields.h" +#import "BSG_KSCrashSentry_Private.h" +#import "BSG_KSMach.h" #import "BugsnagCollections.h" +#import "BugsnagKeys.h" #import "BugsnagStackframe+Private.h" #import "BugsnagStacktrace.h" -#import "BugsnagKeys.h" -#import "BugsnagThread+Recording.h" #import "BugsnagThread+Private.h" -#include "BSG_KSBacktrace_Private.h" -#include "BSG_KSCrashSentry_Private.h" -#include "BSG_KSMach.h" #include @@ -195,7 +194,7 @@ + (NSDictionary *)enhanceThreadInfo:(NSDictionary *)thread return thread; } -#pragma mark BugsnagThread+Recording +// MARK: - Recording + (NSArray *)allThreads:(BOOL)allThreads callStackReturnAddresses:(NSArray *)callStackReturnAddresses { struct backtrace_t backtrace; diff --git a/Tests/BugsnagThreadTests.m b/Tests/BugsnagThreadTests.m index 73d92fe9d..b6e1f629a 100644 --- a/Tests/BugsnagThreadTests.m +++ b/Tests/BugsnagThreadTests.m @@ -11,7 +11,6 @@ #import "BSG_KSMachHeaders.h" #import "BugsnagStackframe+Private.h" #import "BugsnagThread+Private.h" -#import "BugsnagThread+Recording.h" #include