Skip to content

Commit

Permalink
Merge pull request #506 from bugsnag/v6-session
Browse files Browse the repository at this point in the history
Remove unused APIs from BugsnagSession interface
  • Loading branch information
fractalwrench authored Mar 30, 2020
2 parents 2526dbb + deb183e commit 22fc982
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Bugsnag Notifiers on other platforms.

## Enhancements

* Remove unused APIs from `BugsnagSession` interface
[#506](https://github.com/bugsnag/bugsnag-cocoa/pull/506)

* Rename setUser/user interface on `Bugsnag` and `BugsnagConfiguration`
[#505](https://github.com/bugsnag/bugsnag-cocoa/pull/505)

Expand Down
5 changes: 5 additions & 0 deletions Source/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
static NSUInteger unhandledCount;
static bool hasRecordedSessions;

@interface BugsnagSession ()
@property NSUInteger unhandledCount;
@property NSUInteger handledCount;
@end

/**
* Handler executed when the application crashes. Writes information about the
* current application state using the crash report writer.
Expand Down
5 changes: 5 additions & 0 deletions Source/BugsnagEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ - (BOOL)shouldSendReports;
@property(readonly, strong, nullable) BugsnagBreadcrumbs *breadcrumbs;
@end

@interface BugsnagSession ()
@property NSUInteger unhandledCount;
@property NSUInteger handledCount;
@end

@interface BugsnagEvent ()

/**
Expand Down
18 changes: 0 additions & 18 deletions Source/BugsnagSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,8 @@
handledCount:(NSUInteger)handledCount
unhandledCount:(NSUInteger)unhandledCount;

/**
* Representation used in report payloads
*/
- (NSDictionary *_Nonnull)toJson;

/**
* Full representation of a session suitable for creating an identical session
* using initWithDictionary
*/
- (NSDictionary *_Nonnull)toDictionary;
- (void)stop;
- (void)resume;

@property(readonly) NSString *_Nonnull sessionId;
@property(readonly) NSDate *_Nonnull startedAt;
@property(readonly) BugsnagUser *_Nullable user;
@property(readonly) BOOL autoCaptured;
@property(readonly, getter=isStopped) BOOL stopped;

@property NSUInteger unhandledCount;
@property NSUInteger handledCount;

@end
16 changes: 16 additions & 0 deletions Source/BugsnagSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@

@interface BugsnagSession ()
@property(readwrite, getter=isStopped) BOOL stopped;
@property(readonly) BOOL autoCaptured;
@property NSUInteger unhandledCount;
@property NSUInteger handledCount;

/**
* Representation used in report payloads
*/
- (NSDictionary *_Nonnull)toJson;

/**
* Full representation of a session suitable for creating an identical session
* using initWithDictionary
*/
- (NSDictionary *_Nonnull)toDictionary;
- (void)stop;
- (void)resume;
@end

@implementation BugsnagSession
Expand Down
4 changes: 4 additions & 0 deletions Source/BugsnagSessionFileStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

static NSString *const kSessionStoreSuffix = @"-Session-";

@interface BugsnagSession ()
- (NSDictionary *)toJson;
@end

@implementation BugsnagSessionFileStore

+ (BugsnagSessionFileStore *)storeWithPath:(NSString *)path {
Expand Down
10 changes: 10 additions & 0 deletions Source/BugsnagSessionTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@

NSString *const BSGSessionUpdateNotification = @"BugsnagSessionChanged";

@interface BugsnagSession ()

@property(readwrite, getter=isStopped) BOOL stopped;
@property NSUInteger unhandledCount;
@property NSUInteger handledCount;
- (NSDictionary *_Nonnull)toDictionary;
- (void)stop;
- (void)resume;
@end

@interface BugsnagConfiguration ()
@property(readonly, retain, nullable) NSURL *sessionURL;
@end
Expand Down
4 changes: 4 additions & 0 deletions Source/BugsnagSessionTrackingPayload.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#import "BugsnagKSCrashSysInfoParser.h"
#import "Private.h"

@interface BugsnagSession ()
- (NSDictionary *)toJson;
@end

@interface Bugsnag ()
+ (BugsnagClient *)client;
@end
Expand Down
5 changes: 5 additions & 0 deletions Tests/BugsnagEventTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#import "BugsnagTestConstants.h"
#import "BugsnagTestsDummyClass.h"

@interface BugsnagSession ()
@property NSUInteger unhandledCount;
@property NSUInteger handledCount;
@end

@interface Bugsnag ()
+ (BugsnagConfiguration *)configuration;
@end
Expand Down
7 changes: 7 additions & 0 deletions Tests/BugsnagSessionTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
#import "BugsnagSession.h"
#import "BSG_RFC3339DateTool.h"

@interface BugsnagSession ()
@property NSUInteger unhandledCount;
@property NSUInteger handledCount;
- (NSDictionary *_Nonnull)toJson;
- (NSDictionary *_Nonnull)toDictionary;
@end

@interface BugsnagSessionTest : XCTestCase
@end

Expand Down
5 changes: 5 additions & 0 deletions Tests/BugsnagSessionTrackerStopTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#import "BugsnagSessionTracker.h"
#import "BugsnagTestConstants.h"

@interface BugsnagSession ()
@property NSUInteger unhandledCount;
@property NSUInteger handledCount;
@end

@interface BugsnagSessionTrackerStopTest : XCTestCase
@property BugsnagConfiguration *configuration;
@property BugsnagSessionTracker *tracker;
Expand Down
6 changes: 6 additions & 0 deletions Tests/BugsnagSessionTrackerTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
#import "BugsnagSessionTrackingApiClient.h"
#import "BugsnagTestConstants.h"

@interface BugsnagSession ()
@property NSUInteger unhandledCount;
@property NSUInteger handledCount;
@property(readonly) BOOL autoCaptured;
@end

@interface BugsnagConfiguration ()
- (void)deletePersistedUserData;
@end
Expand Down
14 changes: 14 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,18 @@ of the removed `addAttribute`:
- event.depth
- event.error
- event.isIncomplete

### `BugsnagSession` class

#### Removals

```diff
- toJson
- toDictionary
- stop
- resume
- autoCaptured
- handledCount
- unhandledCount
- stopped
```

0 comments on commit 22fc982

Please sign in to comment.