From 6601540d08b8d605a8185767fa04daa4e6e5834f Mon Sep 17 00:00:00 2001 From: Matias Pequeno Date: Wed, 2 Aug 2023 22:27:48 +0200 Subject: [PATCH] Renamed RollbarCrash interface to RollbarCrashHandler (#330) When integrating the SDK as a Framework through SPM, Swift has trouble understanding the difference between the RollbarCrash module and RollbarCrash interface --- .../Monitors/RollbarCrashMonitor_NSException.m | 6 +++--- .../{RollbarCrash.m => RollbarCrashHandler.m} | 14 +++++++------- .../RollbarCrash/RollbarCrashInstallation.m | 8 ++++---- .../{RollbarCrash.h => RollbarCrashHandler.h} | 8 ++++---- .../include/RollbarCrashInstallation.h | 4 ++-- .../RollbarNotifier/RollbarCrashCollector.m | 13 +++++++------ 6 files changed, 27 insertions(+), 26 deletions(-) rename RollbarNotifier/Sources/RollbarCrash/Recording/{RollbarCrash.m => RollbarCrashHandler.m} (98%) rename RollbarNotifier/Sources/RollbarCrash/include/{RollbarCrash.h => RollbarCrashHandler.h} (98%) diff --git a/RollbarNotifier/Sources/RollbarCrash/Monitors/RollbarCrashMonitor_NSException.m b/RollbarNotifier/Sources/RollbarCrash/Monitors/RollbarCrashMonitor_NSException.m index a2ca6270..9306bbe4 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Monitors/RollbarCrashMonitor_NSException.m +++ b/RollbarNotifier/Sources/RollbarCrash/Monitors/RollbarCrashMonitor_NSException.m @@ -24,7 +24,7 @@ // THE SOFTWARE. // -#import "RollbarCrash.h" +#import "RollbarCrashHandler.h" #import "RollbarCrashMonitor_NSException.h" #import "RollbarCrashStackCursor_Backtrace.h" #include "RollbarCrashMonitorContext.h" @@ -135,8 +135,8 @@ static void setEnabled(bool isEnabled) RCLOG_DEBUG(@"Setting new handler."); NSSetUncaughtExceptionHandler(&handleUncaughtException); - RollbarCrash.sharedInstance.uncaughtExceptionHandler = &handleUncaughtException; - RollbarCrash.sharedInstance.currentSnapshotUserReportedExceptionHandler = &handleCurrentSnapshotUserReportedException; + RollbarCrashHandler.sharedInstance.uncaughtExceptionHandler = &handleUncaughtException; + RollbarCrashHandler.sharedInstance.currentSnapshotUserReportedExceptionHandler = &handleCurrentSnapshotUserReportedException; } else { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashHandler.m similarity index 98% rename from RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashHandler.m index 9a081b05..8a864a5f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashHandler.m @@ -1,5 +1,5 @@ // -// RollbarCrash.m +// RollbarCrashHandler.m // // Created by Karl Stenerud on 2012-01-28. // @@ -25,7 +25,7 @@ // -#import "RollbarCrash.h" +#import "RollbarCrashHandler.h" #import "RollbarCrashC.h" #import "RollbarCrashDoctor.h" @@ -50,7 +50,7 @@ #pragma mark - Globals - // ============================================================================ -@interface RollbarCrash () +@interface RollbarCrashHandler () @property(nonatomic,readwrite,retain) NSString* bundleName; @property(nonatomic,readwrite,retain) NSString* basePath; @@ -89,7 +89,7 @@ @interface RollbarCrash () } -@implementation RollbarCrash +@implementation RollbarCrashHandler // ============================================================================ #pragma mark - Properties - @@ -123,18 +123,18 @@ + (void)load + (void)initialize { - if (self == [RollbarCrash class]) { + if (self == [RollbarCrashHandler class]) { [[self class] subscribeToNotifications]; } } + (instancetype) sharedInstance { - static RollbarCrash *sharedInstance = nil; + static RollbarCrashHandler *sharedInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - sharedInstance = [[RollbarCrash alloc] init]; + sharedInstance = [[RollbarCrashHandler alloc] init]; }); return sharedInstance; } diff --git a/RollbarNotifier/Sources/RollbarCrash/RollbarCrashInstallation.m b/RollbarNotifier/Sources/RollbarCrash/RollbarCrashInstallation.m index 3a41ba07..5197ec26 100644 --- a/RollbarNotifier/Sources/RollbarCrash/RollbarCrashInstallation.m +++ b/RollbarNotifier/Sources/RollbarCrash/RollbarCrashInstallation.m @@ -28,7 +28,7 @@ #import "RollbarCrashInstallation.h" #import "RollbarCrashInstallation+Private.h" #import "RollbarCrashReportFilterBasic.h" -#import "RollbarCrash.h" +#import "RollbarCrashHandler.h" #import "RollbarCrashCString.h" #import "RollbarCrashJSONCodecObjC.h" #import "RollbarCrashLogger.h" @@ -198,7 +198,7 @@ - (id) initWithRequiredProperties:(NSArray*) requiredProperties - (void) dealloc { - RollbarCrash* handler = [RollbarCrash sharedInstance]; + RollbarCrashHandler* handler = [RollbarCrashHandler sharedInstance]; @synchronized(handler) { if(g_crashHandlerData == self.crashHandlerData) @@ -318,7 +318,7 @@ - (void) setOnCrash:(RollbarCrashReportWriteCallback)onCrash - (void) install { - RollbarCrash* handler = [RollbarCrash sharedInstance]; + RollbarCrashHandler* handler = [RollbarCrashHandler sharedInstance]; @synchronized(handler) { g_crashHandlerData = self.crashHandlerData; @@ -350,7 +350,7 @@ - (void) sendAllReportsWithCompletion:(RollbarCrashReportFilterCompletion) onCom sink = [RollbarCrashReportFilterPipeline filterWithFilters:self.prependedFilters, sink, nil]; - RollbarCrash* handler = [RollbarCrash sharedInstance]; + RollbarCrashHandler* handler = [RollbarCrashHandler sharedInstance]; handler.sink = sink; [handler sendAllReportsWithCompletion:onCompletion]; } diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashHandler.h similarity index 98% rename from RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashHandler.h index 396175c4..b379dfcd 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashHandler.h @@ -1,5 +1,5 @@ // -// RollbarCrash.h +// RollbarCrashHandler.h // // Created by Karl Stenerud on 2012-01-28. // @@ -43,11 +43,11 @@ typedef enum * * The crash reports will be located in $APP_HOME/Library/Caches/RollbarCrashReports */ -@interface RollbarCrash : NSObject +@interface RollbarCrashHandler : NSObject #pragma mark - Configuration - -/** Init RollbarCrash instance with custom base path. */ +/** Init RollbarCrashHandler instance with custom base path. */ - (id) initWithBasePath:(NSString *)basePath; /** A dictionary containing any info you'd like to appear in crash reports. Must @@ -210,7 +210,7 @@ typedef enum /** Get the singleton instance of the crash reporter. */ -+ (RollbarCrash*) sharedInstance; ++ (RollbarCrashHandler*) sharedInstance; /** Install the crash reporter. * The reporter will record crashes, but will not send any crash reports unless diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h index 9444867f..71456f69 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h @@ -47,12 +47,12 @@ */ @property(atomic,readwrite,assign) RollbarCrashReportWriteCallback onCrash; -/** Install this installation. Call this instead of -[RollbarCrash install] to install +/** Install this installation. Call this instead of -[RollbarCrashHandler install] to install * with everything needed for your particular backend. */ - (void) install; -/** Convenience method to call -[RollbarCrash sendAllReportsWithCompletion:]. +/** Convenience method to call -[RollbarCrashHandler sendAllReportsWithCompletion:]. * This method will set the RollbarCrash sink and then send all outstanding reports. * * Note: Pay special attention to RollbarCrash's "deleteBehaviorAfterSendAll" property. diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m index 88f68aa8..4655e592 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m @@ -67,12 +67,13 @@ - (void)install { & ~(RollbarCrashMonitorTypeOptional | RollbarCrashMonitorTypeUserReported); - [RollbarCrash.sharedInstance setDeleteBehaviorAfterSendAll:RollbarCrashDeleteOnSucess]; - [RollbarCrash.sharedInstance setMonitoring:monitoring]; - [RollbarCrash.sharedInstance setAddConsoleLogToReport:NO]; - [RollbarCrash.sharedInstance setCatchZombies:NO]; - [RollbarCrash.sharedInstance setIntrospectMemory:YES]; - [RollbarCrash.sharedInstance setSearchQueueNames:NO]; + RollbarCrashHandler *handler = RollbarCrashHandler.sharedInstance; + [handler setDeleteBehaviorAfterSendAll:RollbarCrashDeleteOnSucess]; + [handler setMonitoring:monitoring]; + [handler setAddConsoleLogToReport:NO]; + [handler setCatchZombies:NO]; + [handler setIntrospectMemory:YES]; + [handler setSearchQueueNames:NO]; } - (void)sendAllReports {