Skip to content
This repository was archived by the owner on Sep 14, 2020. It is now read-only.

Commit 28cee20

Browse files
committed
Release v2.9.5
2 parents 741dcca + 79b2ebe commit 28cee20

23 files changed

Lines changed: 215 additions & 123 deletions

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
Changelog
22
=========
33

4+
## 2.9.5 (2018-05-31)
5+
6+
### Bug fixes
7+
8+
* (android) Upgrade bugsnag-android dependency to v4.4.1:
9+
* Refine automatically collected breadcrumbs to a commonly useful set by default
10+
[bugsnag-android#321](https://github.com/bugsnag/bugsnag-android/pull/321)
11+
* Ensure that unhandled error reports are always sent immediately on launch for Android P and in situations with no connectivity.
12+
[bugsnag-android#319](https://github.com/bugsnag/bugsnag-android/pull/319)
13+
14+
* (iOS) Upgrade bugsnag-cocoa dependency to v5.15.6:
15+
* Ensure device data is attached to minimal reports
16+
[bugsnag-cocoa#279](https://github.com/bugsnag/bugsnag-cocoa/pull/279)
17+
* Enforce requiring API key to initialise notifier
18+
[bugsnag-cocoa#280](https://github.com/bugsnag/bugsnag-cocoa/pull/280)
19+
20+
421
## 2.9.4 (2018-05-02)
522

623
* Enable nativeSerializer to handle Error objects by extracting the stack and message from a given Error class before serialising it. [#239](https://github.com/bugsnag/bugsnag-react-native/issues/239) [#240](https://github.com/bugsnag/bugsnag-react-native/pull/240) [daisy1754](https://github.com/daisy1754) [Cawllec](https://github.com/Cawllec)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Bugsnag exception reporter for React Native
2-
[![Documentation](https://img.shields.io/badge/documentation-2.9.4-blue.svg)](http://docs.bugsnag.com/platforms/react-native/)
2+
[![Documentation](https://img.shields.io/badge/documentation-2.9.5-blue.svg)](http://docs.bugsnag.com/platforms/react-native/)
33

44
Automatic [React Native crash reporting](https://www.bugsnag.com/platforms/react-native-error-reporting/) with Bugsnag helps you detect both native OS and JavaScript errors in your React Native apps.
55

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ android {
88
minSdkVersion 16
99
targetSdkVersion 23
1010
versionCode 4
11-
versionName '2.9.4'
11+
versionName '2.9.5'
1212
}
1313
}
1414

1515
dependencies {
16-
compile 'com.bugsnag:bugsnag-android:4.3.4'
16+
compile 'com.bugsnag:bugsnag-android:4.4.1'
1717
compile 'com.facebook.react:react-native:+'
1818
}

cocoa/vendor/bugsnag-cocoa/Source/BSG_KSCrashReportWriter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ typedef struct BSG_KSCrashReportWriter {
215215
typedef void (*BSG_KSReportWriteCallback)(
216216
const BSG_KSCrashReportWriter *writer);
217217

218+
typedef void (*BSGReportCallback)(
219+
const BSG_KSCrashReportWriter *writer, int type);
220+
218221
#ifdef __cplusplus
219222
}
220223
#endif

cocoa/vendor/bugsnag-cocoa/Source/Bugsnag.m

Lines changed: 102 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ + (void)startBugsnagWithApiKey:(NSString *)apiKey {
5151

5252
+ (void)startBugsnagWithConfiguration:(BugsnagConfiguration *)configuration {
5353
@synchronized(self) {
54-
bsg_g_bugsnag_notifier =
55-
[[BugsnagNotifier alloc] initWithConfiguration:configuration];
56-
[bsg_g_bugsnag_notifier start];
54+
if ([configuration hasValidApiKey]) {
55+
bsg_g_bugsnag_notifier =
56+
[[BugsnagNotifier alloc] initWithConfiguration:configuration];
57+
[bsg_g_bugsnag_notifier start];
58+
} else {
59+
bsg_log_err(@"Bugsnag not initialized - a valid API key must be supplied.");
60+
}
5761
}
5862
}
5963

@@ -73,75 +77,87 @@ + (BugsnagNotifier *)notifier {
7377
}
7478

7579
+ (void)notify:(NSException *)exception {
76-
[self.notifier notifyException:exception
77-
block:^(BugsnagCrashReport *_Nonnull report) {
78-
report.depth += 2;
79-
}];
80+
if ([self bugsnagStarted]) {
81+
[self.notifier notifyException:exception
82+
block:^(BugsnagCrashReport *_Nonnull report) {
83+
report.depth += 2;
84+
}];
85+
}
8086
}
8187

8288
+ (void)notify:(NSException *)exception block:(BugsnagNotifyBlock)block {
83-
[[self notifier] notifyException:exception
84-
block:^(BugsnagCrashReport *_Nonnull report) {
85-
report.depth += 2;
86-
87-
if (block) {
88-
block(report);
89-
}
90-
}];
89+
if ([self bugsnagStarted]) {
90+
[[self notifier] notifyException:exception
91+
block:^(BugsnagCrashReport *_Nonnull report) {
92+
report.depth += 2;
93+
94+
if (block) {
95+
block(report);
96+
}
97+
}];
98+
}
9199
}
92100

93101
+ (void)notifyError:(NSError *)error {
94-
[self.notifier notifyError:error
95-
block:^(BugsnagCrashReport *_Nonnull report) {
96-
report.depth += 2;
97-
}];
102+
if ([self bugsnagStarted]) {
103+
[self.notifier notifyError:error
104+
block:^(BugsnagCrashReport *_Nonnull report) {
105+
report.depth += 2;
106+
}];
107+
}
98108
}
99109

100110
+ (void)notifyError:(NSError *)error block:(BugsnagNotifyBlock)block {
101-
[[self notifier] notifyError:error
102-
block:^(BugsnagCrashReport *_Nonnull report) {
103-
report.depth += 2;
104-
105-
if (block) {
106-
block(report);
107-
}
108-
}];
111+
if ([self bugsnagStarted]) {
112+
[[self notifier] notifyError:error
113+
block:^(BugsnagCrashReport *_Nonnull report) {
114+
report.depth += 2;
115+
116+
if (block) {
117+
block(report);
118+
}
119+
}];
120+
}
109121
}
110122

111123
+ (void)notify:(NSException *)exception withData:(NSDictionary *)metaData {
112-
113-
[[self notifier]
114-
notifyException:exception
115-
block:^(BugsnagCrashReport *_Nonnull report) {
116-
report.depth += 2;
117-
report.metaData = [metaData
118-
BSG_mergedInto:[self.notifier.configuration
119-
.metaData toDictionary]];
120-
}];
124+
if ([self bugsnagStarted]) {
125+
[[self notifier]
126+
notifyException:exception
127+
block:^(BugsnagCrashReport *_Nonnull report) {
128+
report.depth += 2;
129+
report.metaData = [metaData
130+
BSG_mergedInto:[self.notifier.configuration
131+
.metaData toDictionary]];
132+
}];
133+
}
121134
}
122135

123136
+ (void)notify:(NSException *)exception
124137
withData:(NSDictionary *)metaData
125138
atSeverity:(NSString *)severity {
126-
127-
[[self notifier]
128-
notifyException:exception
129-
atSeverity:BSGParseSeverity(severity)
130-
block:^(BugsnagCrashReport *_Nonnull report) {
131-
report.depth += 2;
132-
report.metaData = [metaData
133-
BSG_mergedInto:[self.notifier.configuration
134-
.metaData toDictionary]];
135-
report.severity = BSGParseSeverity(severity);
136-
}];
139+
if ([self bugsnagStarted]) {
140+
[[self notifier]
141+
notifyException:exception
142+
atSeverity:BSGParseSeverity(severity)
143+
block:^(BugsnagCrashReport *_Nonnull report) {
144+
report.depth += 2;
145+
report.metaData = [metaData
146+
BSG_mergedInto:[self.notifier.configuration
147+
.metaData toDictionary]];
148+
report.severity = BSGParseSeverity(severity);
149+
}];
150+
}
137151
}
138152

139153
+ (void)internalClientNotify:(NSException *_Nonnull)exception
140154
withData:(NSDictionary *_Nullable)metaData
141155
block:(BugsnagNotifyBlock _Nullable)block {
142-
[self.notifier internalClientNotify:exception
143-
withData:metaData
144-
block:block];
156+
if ([self bugsnagStarted]) {
157+
[self.notifier internalClientNotify:exception
158+
withData:metaData
159+
block:block];
160+
}
145161
}
146162

147163
+ (void)addAttribute:(NSString *)attributeName
@@ -161,7 +177,7 @@ + (void)clearTabWithName:(NSString *)tabName {
161177
}
162178

163179
+ (BOOL)bugsnagStarted {
164-
if (self.notifier == nil) {
180+
if (!self.notifier.started) {
165181
bsg_log_err(@"Ensure you have started Bugsnag with startWithApiKey: "
166182
@"before calling any other Bugsnag functions.");
167183

@@ -171,31 +187,43 @@ + (BOOL)bugsnagStarted {
171187
}
172188

173189
+ (void)leaveBreadcrumbWithMessage:(NSString *)message {
174-
[self leaveBreadcrumbWithBlock:^(BugsnagBreadcrumb *_Nonnull crumbs) {
175-
crumbs.metadata = @{BSGKeyMessage : message};
176-
}];
190+
if ([self bugsnagStarted]) {
191+
[self leaveBreadcrumbWithBlock:^(BugsnagBreadcrumb *_Nonnull crumbs) {
192+
crumbs.metadata = @{BSGKeyMessage: message};
193+
}];
194+
}
177195
}
178196

179197
+ (void)leaveBreadcrumbWithBlock:
180198
(void (^_Nonnull)(BugsnagBreadcrumb *_Nonnull))block {
181-
[self.notifier addBreadcrumbWithBlock:block];
199+
if ([self bugsnagStarted]) {
200+
[self.notifier addBreadcrumbWithBlock:block];
201+
}
182202
}
183203

184204
+ (void)leaveBreadcrumbForNotificationName:
185205
(NSString *_Nonnull)notificationName {
186-
[self.notifier crumbleNotification:notificationName];
206+
if ([self bugsnagStarted]) {
207+
[self.notifier crumbleNotification:notificationName];
208+
}
187209
}
188210

189211
+ (void)setBreadcrumbCapacity:(NSUInteger)capacity {
190-
self.notifier.configuration.breadcrumbs.capacity = capacity;
212+
if ([self bugsnagStarted]) {
213+
self.notifier.configuration.breadcrumbs.capacity = capacity;
214+
}
191215
}
192216

193217
+ (void)clearBreadcrumbs {
194-
[self.notifier clearBreadcrumbs];
218+
if ([self bugsnagStarted]) {
219+
[self.notifier clearBreadcrumbs];
220+
}
195221
}
196222

197223
+ (void)startSession {
198-
[self.notifier startSession];
224+
if ([self bugsnagStarted]) {
225+
[self.notifier startSession];
226+
}
199227
}
200228

201229
+ (NSDateFormatter *)payloadDateFormatter {
@@ -209,23 +237,31 @@ + (NSDateFormatter *)payloadDateFormatter {
209237
}
210238

211239
+ (void)setSuspendThreadsForUserReported:(BOOL)suspendThreadsForUserReported {
212-
[[BSG_KSCrash sharedInstance]
213-
setSuspendThreadsForUserReported:suspendThreadsForUserReported];
240+
if ([self bugsnagStarted]) {
241+
[[BSG_KSCrash sharedInstance]
242+
setSuspendThreadsForUserReported:suspendThreadsForUserReported];
243+
}
214244
}
215245

216246
+ (void)setReportWhenDebuggerIsAttached:(BOOL)reportWhenDebuggerIsAttached {
217-
[[BSG_KSCrash sharedInstance]
218-
setReportWhenDebuggerIsAttached:reportWhenDebuggerIsAttached];
247+
if ([self bugsnagStarted]) {
248+
[[BSG_KSCrash sharedInstance]
249+
setReportWhenDebuggerIsAttached:reportWhenDebuggerIsAttached];
250+
}
219251
}
220252

221253
+ (void)setThreadTracingEnabled:(BOOL)threadTracingEnabled {
222-
[[BSG_KSCrash sharedInstance] setThreadTracingEnabled:threadTracingEnabled];
254+
if ([self bugsnagStarted]) {
255+
[[BSG_KSCrash sharedInstance] setThreadTracingEnabled:threadTracingEnabled];
256+
}
223257
}
224258

225259
+ (void)setWriteBinaryImagesForUserReported:
226260
(BOOL)writeBinaryImagesForUserReported {
227-
[[BSG_KSCrash sharedInstance]
228-
setWriteBinaryImagesForUserReported:writeBinaryImagesForUserReported];
261+
if ([self bugsnagStarted]) {
262+
[[BSG_KSCrash sharedInstance]
263+
setWriteBinaryImagesForUserReported:writeBinaryImagesForUserReported];
264+
}
229265
}
230266

231267
@end

cocoa/vendor/bugsnag-cocoa/Source/BugsnagConfiguration.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ BugsnagBreadcrumbs *breadcrumbs;
132132
*/
133133
@property void (*_Nullable onCrashHandler)
134134
(const BSG_KSCrashReportWriter *_Nonnull writer);
135+
135136
/**
136137
* YES if uncaught exceptions should be reported automatically
137138
*/
@@ -193,4 +194,6 @@ BugsnagBreadcrumbs *breadcrumbs;
193194
@property(nullable) NSString *codeBundleId;
194195
@property(nullable) NSString *notifierType;
195196

197+
- (BOOL)hasValidApiKey;
198+
196199
@end

cocoa/vendor/bugsnag-cocoa/Source/BugsnagConfiguration.m

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#import "BSG_RFC3339DateTool.h"
3232
#import "BugsnagUser.h"
3333
#import "BugsnagSessionTracker.h"
34+
#import "BugsnagLogger.h"
3435

3536
static NSString *const kHeaderApiPayloadVersion = @"Bugsnag-Payload-Version";
3637
static NSString *const kHeaderApiKey = @"Bugsnag-Api-Key";
@@ -199,6 +200,22 @@ - (void)setAppVersion:(NSString *)newVersion {
199200
}
200201
}
201202

203+
@synthesize apiKey = _apiKey;
204+
205+
- (NSString *)apiKey {
206+
return _apiKey;
207+
}
208+
209+
- (void)setApiKey:(NSString *)apiKey {
210+
if ([apiKey length] > 0) {
211+
[self willChangeValueForKey:NSStringFromSelector(@selector(apiKey))];
212+
_apiKey = apiKey;
213+
[self didChangeValueForKey:NSStringFromSelector(@selector(apiKey))];
214+
} else {
215+
bsg_log_err(@"Attempted to override non-null API key with nil - ignoring.");
216+
}
217+
}
218+
202219
@synthesize shouldAutoCaptureSessions = _shouldAutoCaptureSessions;
203220

204221
- (BOOL)shouldAutoCaptureSessions {
@@ -231,4 +248,9 @@ - (NSDictionary *)sessionApiHeaders {
231248
kHeaderApiSentAt: [BSG_RFC3339DateTool stringFromDate:[NSDate new]]
232249
};
233250
}
251+
252+
- (BOOL)hasValidApiKey {
253+
return [_apiKey length] > 0;
254+
}
255+
234256
@end

cocoa/vendor/bugsnag-cocoa/Source/BugsnagCrashReport.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,6 @@ - (instancetype)initWithKSReport:(NSDictionary *)report {
235235
}
236236
_binaryImages = report[@"binary_images"];
237237
_breadcrumbs = BSGParseBreadcrumbs(report);
238-
_severity = BSGParseSeverity(
239-
[report valueForKeyPath:@"user.state.crash.severity"]);
240-
_depth = [[report valueForKeyPath:@"user.state.crash.depth"]
241-
unsignedIntegerValue];
242238
_dsymUUID = [report valueForKeyPath:@"system.app_uuid"];
243239
_deviceAppHash = [report valueForKeyPath:@"system.device_app_hash"];
244240
_metaData =
@@ -259,6 +255,10 @@ - (instancetype)initWithKSReport:(NSDictionary *)report {
259255
if (recordedState) {
260256
_handledState =
261257
[[BugsnagHandledState alloc] initWithDictionary:recordedState];
258+
259+
// only makes sense to use serialised value for handled exceptions
260+
_depth = [[report valueForKeyPath:@"user.state.crash.depth"]
261+
unsignedIntegerValue];
262262
} else { // the event was unhandled.
263263
BOOL isSignal = [BSGKeySignal isEqualToString:_errorType];
264264
SeverityReasonType severityReason =
@@ -267,6 +267,7 @@ - (instancetype)initWithKSReport:(NSDictionary *)report {
267267
handledStateWithSeverityReason:severityReason
268268
severity:BSGSeverityError
269269
attrValue:_errorClass];
270+
_depth = 0;
270271
}
271272
_severity = _handledState.currentSeverity;
272273

0 commit comments

Comments
 (0)