Skip to content

Commit

Permalink
Renamed RollbarCrash interface to RollbarCrashHandler (#330)
Browse files Browse the repository at this point in the history
When integrating the SDK as a Framework through SPM, Swift has trouble understanding the difference between the RollbarCrash module and RollbarCrash interface
  • Loading branch information
matux authored Aug 2, 2023
1 parent 811acc2 commit 6601540
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// THE SOFTWARE.
//

#import "RollbarCrash.h"
#import "RollbarCrashHandler.h"
#import "RollbarCrashMonitor_NSException.h"
#import "RollbarCrashStackCursor_Backtrace.h"
#include "RollbarCrashMonitorContext.h"
Expand Down Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// RollbarCrash.m
// RollbarCrashHandler.m
//
// Created by Karl Stenerud on 2012-01-28.
//
Expand All @@ -25,7 +25,7 @@
//


#import "RollbarCrash.h"
#import "RollbarCrashHandler.h"

#import "RollbarCrashC.h"
#import "RollbarCrashDoctor.h"
Expand All @@ -50,7 +50,7 @@
#pragma mark - Globals -
// ============================================================================

@interface RollbarCrash ()
@interface RollbarCrashHandler ()

@property(nonatomic,readwrite,retain) NSString* bundleName;
@property(nonatomic,readwrite,retain) NSString* basePath;
Expand Down Expand Up @@ -89,7 +89,7 @@ @interface RollbarCrash ()
}


@implementation RollbarCrash
@implementation RollbarCrashHandler

// ============================================================================
#pragma mark - Properties -
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -318,7 +318,7 @@ - (void) setOnCrash:(RollbarCrashReportWriteCallback)onCrash

- (void) install
{
RollbarCrash* handler = [RollbarCrash sharedInstance];
RollbarCrashHandler* handler = [RollbarCrashHandler sharedInstance];
@synchronized(handler)
{
g_crashHandlerData = self.crashHandlerData;
Expand Down Expand Up @@ -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];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// RollbarCrash.h
// RollbarCrashHandler.h
//
// Created by Karl Stenerud on 2012-01-28.
//
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 7 additions & 6 deletions RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6601540

Please sign in to comment.