From 3bf80c9551e9c9bc93d475eca2b91878c8844550 Mon Sep 17 00:00:00 2001 From: Delisa Mason Date: Wed, 6 Jul 2016 16:37:31 -0700 Subject: [PATCH] Make block intent clearer These callbacks are invoked before the reports are sent, rather than at crash time, like other Bugsnag libraries. Changing the name better reflects this behavior. --- Source/BugsnagConfiguration.h | 6 +++--- Source/BugsnagConfiguration.m | 8 ++++---- Source/BugsnagSink.m | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/BugsnagConfiguration.h b/Source/BugsnagConfiguration.h index 6c87886fe..fdeed4616 100644 --- a/Source/BugsnagConfiguration.h +++ b/Source/BugsnagConfiguration.h @@ -48,7 +48,7 @@ typedef void (^BugsnagNotifyBlock)(BugsnagCrashReport *_Nonnull report); * * @return YES if the report should be sent */ -typedef bool (^BugsnagBeforeNotifyBlock)( +typedef bool (^BugsnagBeforeSendBlock)( NSDictionary *_Nonnull rawEventData, BugsnagCrashReport *_Nonnull reports); @@ -108,7 +108,7 @@ typedef NSDictionary *_Nullable (^BugsnagBeforeNotifyHook)( * Hooks for modifying crash reports before it is sent to Bugsnag */ @property(nonatomic, readonly, strong, nullable) - NSArray * beforeNotifyBlocks; + NSArray * beforeSendBlocks; /** * Optional handler invoked when a crash or fatal signal occurs */ @@ -136,7 +136,7 @@ typedef NSDictionary *_Nullable (^BugsnagBeforeNotifyHook)( * * @param block A block which returns YES if the report should be sent */ -- (void)addBeforeNotifyBlock:(BugsnagBeforeNotifyBlock _Nonnull)block; +- (void)addBeforeSendBlock:(BugsnagBeforeSendBlock _Nonnull)block; /** * Whether reports shoould be sent, based on release stage options diff --git a/Source/BugsnagConfiguration.m b/Source/BugsnagConfiguration.m index b585341d3..e59997bfb 100644 --- a/Source/BugsnagConfiguration.m +++ b/Source/BugsnagConfiguration.m @@ -32,7 +32,7 @@ @interface BugsnagConfiguration () @property(nonatomic, readwrite, strong) NSMutableArray *beforeNotifyHooks; -@property(nonatomic, readwrite, strong) NSMutableArray *beforeNotifyBlocks; +@property(nonatomic, readwrite, strong) NSMutableArray *BugsnagBeforeSendBlock; @end @implementation BugsnagConfiguration @@ -45,7 +45,7 @@ - (id)init { _autoNotify = true; _notifyURL = [NSURL URLWithString:@"https://notify.bugsnag.com/"]; _beforeNotifyHooks = [NSMutableArray new]; - _beforeNotifyBlocks = [NSMutableArray new]; + _BugsnagBeforeSendBlock = [NSMutableArray new]; _notifyReleaseStages = nil; _breadcrumbs = [BugsnagBreadcrumbs new]; #if DEBUG @@ -72,8 +72,8 @@ - (void)setUser:(NSString *)userId toTabWithName:@"user"]; } -- (void)addBeforeNotifyBlock:(BugsnagBeforeNotifyBlock)block { - [(NSMutableArray *)self.beforeNotifyBlocks addObject:[block copy]]; +- (void)addBeforeSendBlock:(BugsnagBeforeSendBlock)block { + [(NSMutableArray *)self.beforeSendBlocks addObject:[block copy]]; } - (void)addBeforeNotifyHook:(BugsnagBeforeNotifyHook)hook { diff --git a/Source/BugsnagSink.m b/Source/BugsnagSink.m index 84712e5f2..7951323d4 100644 --- a/Source/BugsnagSink.m +++ b/Source/BugsnagSink.m @@ -55,7 +55,7 @@ - (void)filterReports:(NSArray*) reports if (![bugsnagReport shouldBeSent]) continue; BOOL shouldSend = YES; - for (BugsnagBeforeNotifyBlock block in configuration.beforeNotifyBlocks) { + for (BugsnagBeforeSendBlock block in configuration.beforeSendBlocks) { shouldSend = block(report, bugsnagReport); if (!shouldSend) break;