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

Commit 6746808

Browse files
Merge pull request #318 from bugsnag/next
Next release
2 parents 98045e1 + bd654d6 commit 6746808

52 files changed

Lines changed: 595 additions & 103 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

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

4+
## 2.15.0 (2019-03-07)
5+
6+
* Add stopSession() and resumeSession() to Client [#314](https://github.com/bugsnag/bugsnag-react-native/pull/314)
7+
8+
* (Android) Upgrade to bugsnag-android v4.12.0
9+
10+
### Enhancements
11+
12+
* Add stopSession() and resumeSession() to Client
13+
[#429](https://github.com/bugsnag/bugsnag-android/pull/429)
14+
15+
### Bug fixes
16+
17+
* Prevent overwriting config.projectPackages if already set
18+
[#428](https://github.com/bugsnag/bugsnag-android/pull/428)
19+
20+
* Fix incorrect session handledCount when notifying in quick succession
21+
[#434](https://github.com/bugsnag/bugsnag-android/pull/434)
22+
23+
* (Cocoa) Upgrade to bugsnag-cocoa v5.19.0
24+
25+
Note for Carthage users: this release updates the Xcode configuration to the settings recommended by Xcode 10.
26+
27+
* Update workspace to recommended settings suggested by XCode 10
28+
[#324](https://github.com/bugsnag/bugsnag-cocoa/pull/324)
29+
30+
### Enhancements
31+
32+
* Add stopSession() and resumeSession() to Bugsnag
33+
[#325](https://github.com/bugsnag/bugsnag-cocoa/pull/325)
34+
35+
* Capture basic report diagnostics in the file path in case of crash report
36+
content corruption
37+
[#327](https://github.com/bugsnag/bugsnag-cocoa/pull/327)
38+
439
## 2.14.0 (2019-01-23)
540

641
* (Android) Upgrade to bugsnag-android v4.11.0

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.14.0-blue.svg)](http://docs.bugsnag.com/platforms/react-native/)
2+
[![Documentation](https://img.shields.io/badge/documentation-2.15.0-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
@@ -18,12 +18,12 @@ android {
1818
minSdkVersion safeExtGet('minSdkVersion', 16)
1919
targetSdkVersion safeExtGet('targetSdkVersion', 26)
2020
versionCode 4
21-
versionName '2.14.0'
21+
versionName '2.15.0'
2222
consumerProguardFiles 'proguard-rules.pro'
2323
}
2424
}
2525

2626
dependencies {
27-
compile 'com.bugsnag:bugsnag-android:4.11.0'
27+
compile 'com.bugsnag:bugsnag-android:4.12.0'
2828
compile 'com.facebook.react:react-native:+'
2929
}

android/src/main/java/com/bugsnag/BugsnagReactNative.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ public void startSession() {
8484
Bugsnag.startSession();
8585
}
8686

87+
@ReactMethod
88+
public void stopSession() {
89+
Bugsnag.stopSession();
90+
}
91+
92+
@ReactMethod
93+
public void resumeSession() {
94+
Bugsnag.resumeSession();
95+
}
96+
8797
@ReactMethod
8898
public void startWithOptions(ReadableMap options) {
8999
String apiKey = null;
@@ -278,7 +288,7 @@ private void configureRuntimeOptions(Client client, ReadableMap options) {
278288
// The launch event session is skipped because autoCaptureSessions
279289
// was not set when Bugsnag was first initialized. Manually sending a
280290
// session to compensate.
281-
client.startSession();
291+
client.resumeSession();
282292
}
283293
}
284294
}

cocoa/BugsnagReactNative.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,7 @@
3838
- (void)setUser:(NSDictionary *)userInfo;
3939
- (void)clearUser;
4040
- (void)startSession;
41+
- (void)stopSession;
42+
- (void)resumeSession;
4143

4244
@end

cocoa/BugsnagReactNative.m

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,20 @@ + (void)startWithConfiguration:(BugsnagConfiguration *)config {
209209
[Bugsnag startSession];
210210
}
211211

212+
RCT_EXPORT_METHOD(stopSession) {
213+
if (![Bugsnag bugsnagStarted]) {
214+
return;
215+
}
216+
[Bugsnag stopSession];
217+
}
218+
219+
RCT_EXPORT_METHOD(resumeSession) {
220+
if (![Bugsnag bugsnagStarted]) {
221+
return;
222+
}
223+
[Bugsnag resumeSession];
224+
}
225+
212226
RCT_EXPORT_METHOD(clearUser) {
213227
if (![Bugsnag bugsnagStarted]) {
214228
return;
@@ -280,7 +294,7 @@ + (void)startWithConfiguration:(BugsnagConfiguration *)config {
280294
// The launch event session is skipped because shouldAutoCaptureSessions
281295
// was not set when Bugsnag was first initialized. Manually sending a
282296
// session to compensate.
283-
[Bugsnag startSession];
297+
[Bugsnag resumeSession];
284298
}
285299
}
286300

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

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,60 @@ static NSString *_Nonnull const BugsnagSeverityInfo = @"info";
211211
(BOOL)writeBinaryImagesForUserReported;
212212

213213
/**
214-
* Manually starts tracking a new session.
214+
* Starts tracking a new session.
215215
*
216-
* Sessions automatically start when the application enters the foreground state, and end when the application exits
217-
* the foreground.If you wish to manually start sessions, simply call this method from the relevant part of your
218-
* application. Starting a new session will automatically end the previous one.
216+
* By default, sessions are automatically started when the application enters the foreground.
217+
* If you wish to manually call startSession at
218+
* the appropriate time in your application instead, the default behaviour can be disabled via
219+
* shouldAutoCaptureSessions.
220+
*
221+
* Any errors which occur in an active session count towards your application's
222+
* stability score. You can prevent errors from counting towards your stability
223+
* score by calling stopSession and resumeSession at the appropriate
224+
* time in your application.
225+
*
226+
* @see stopSession:
227+
* @see resumeSession:
219228
*/
220-
221229
+ (void)startSession;
222230

231+
/**
232+
* Stops tracking a session.
233+
*
234+
* When a session is stopped, errors will not count towards your application's
235+
* stability score. This can be advantageous if you do not wish these calculations to
236+
* include a certain type of error, for example, a crash in a background service.
237+
* You should disable automatic session tracking via shouldAutoCaptureSessions if you call this method.
238+
*
239+
* A stopped session can be resumed by calling resumeSession,
240+
* which will make any subsequent errors count towards your application's
241+
* stability score. Alternatively, an entirely new session can be created by calling startSession.
242+
*
243+
* @see startSession:
244+
* @see resumeSession:
245+
*/
246+
+ (void)stopSession;
247+
248+
/**
249+
* Resumes a session which has previously been stopped, or starts a new session if none exists.
250+
*
251+
* If a session has already been resumed or started and has not been stopped, calling this
252+
* method will have no effect. You should disable automatic session tracking via
253+
* shouldAutoCaptureSessions if you call this method.
254+
*
255+
* It's important to note that sessions are stored in memory for the lifetime of the
256+
* application process and are not persisted on disk. Therefore calling this method on app
257+
* startup would start a new session, rather than continuing any previous session.
258+
*
259+
* You should call this at the appropriate time in your application when you wish to
260+
* resume a previously started session. Any subsequent errors which occur in your application
261+
* will be reported to Bugsnag and will count towards your application's stability score.
262+
*
263+
* @see startSession:
264+
* @see stopSession:
265+
*
266+
* @return true if a previous session was resumed, false if a new session was started.
267+
*/
268+
+ (BOOL)resumeSession;
269+
223270
@end

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,20 @@ + (void)startSession {
226226
}
227227
}
228228

229+
+ (void)stopSession {
230+
if ([self bugsnagStarted]) {
231+
[self.notifier stopSession];
232+
}
233+
}
234+
235+
+ (BOOL)resumeSession {
236+
if ([self bugsnagStarted]) {
237+
return [self.notifier resumeSession];
238+
} else {
239+
return false;
240+
}
241+
}
242+
229243
+ (NSDateFormatter *)payloadDateFormatter {
230244
static NSDateFormatter *formatter;
231245
static dispatch_once_t onceToken;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
@class BugsnagConfiguration;
99

10-
typedef void (^RequestCompletion)(id data, BOOL success, NSError *error);
10+
typedef void (^RequestCompletion)(NSUInteger reportCount, BOOL success, NSError *error);
1111

1212
@interface BugsnagApiClient : NSObject
1313

@@ -21,11 +21,11 @@ typedef void (^RequestCompletion)(id data, BOOL success, NSError *error);
2121

2222
- (NSOperation *)deliveryOperation;
2323

24-
- (void)sendData:(id)data
25-
withPayload:(NSDictionary *)payload
26-
toURL:(NSURL *)url
27-
headers:(NSDictionary *)headers
28-
onCompletion:(RequestCompletion)onCompletion;
24+
- (void)sendItems:(NSUInteger)count
25+
withPayload:(NSDictionary *)payload
26+
toURL:(NSURL *)url
27+
headers:(NSDictionary *)headers
28+
onCompletion:(RequestCompletion)onCompletion;
2929

3030
@property(readonly) NSOperationQueue *sendQueue;
3131
@property(readonly) BugsnagConfiguration *config;

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ - (NSOperation *)deliveryOperation {
4949
#pragma mark - Delivery
5050

5151

52-
- (void)sendData:(id)data
53-
withPayload:(NSDictionary *)payload
54-
toURL:(NSURL *)url
55-
headers:(NSDictionary *)headers
56-
onCompletion:(RequestCompletion)onCompletion {
52+
- (void)sendItems:(NSUInteger)count
53+
withPayload:(NSDictionary *)payload
54+
toURL:(NSURL *)url
55+
headers:(NSDictionary *)headers
56+
onCompletion:(RequestCompletion)onCompletion {
5757

5858
@try {
5959
NSError *error = nil;
@@ -64,7 +64,7 @@ - (void)sendData:(id)data
6464

6565
if (jsonData == nil) {
6666
if (onCompletion) {
67-
onCompletion(data, NO, error);
67+
onCompletion(0, NO, error);
6868
}
6969
return;
7070
}
@@ -79,7 +79,7 @@ - (void)sendData:(id)data
7979
NSURLResponse *_Nullable response,
8080
NSError *_Nullable requestErr) {
8181
if (onCompletion) {
82-
onCompletion(data, requestErr == nil, requestErr);
82+
onCompletion(count, requestErr == nil, requestErr);
8383
}
8484
}];
8585
[task resume];
@@ -92,13 +92,13 @@ - (void)sendData:(id)data
9292
returningResponse:&response
9393
error:&error];
9494
if (onCompletion) {
95-
onCompletion(data, error == nil, error);
95+
onCompletion(count, error == nil, error);
9696
}
9797
#pragma clang diagnostic pop
9898
}
9999
} @catch (NSException *exception) {
100100
if (onCompletion) {
101-
onCompletion(data, NO,
101+
onCompletion(count, NO,
102102
[NSError errorWithDomain:exception.reason
103103
code:420
104104
userInfo:@{BSGKeyException: exception}]);

0 commit comments

Comments
 (0)