Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-8732] Send queued sessions when connection regained #1445

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Bugsnag/BugsnagSessionTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#import <Bugsnag/BugsnagConfiguration.h>
#import <Bugsnag/BugsnagSession.h>

#import "BSGSessionUploader.h"

NS_ASSUME_NONNULL_BEGIN

@interface BugsnagSessionTracker : NSObject
Expand Down Expand Up @@ -82,6 +84,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nullable, readonly, nonatomic) BugsnagSession *runningSession;

@property (strong, nonatomic) BSGSessionUploader *sessionUploader;

- (void)addRuntimeVersionInfo:(NSString *)info
withKey:(NSString *)key;

Expand Down
2 changes: 0 additions & 2 deletions Bugsnag/BugsnagSessionTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#import "BSGAppKit.h"
#import "BSGDefines.h"
#import "BSGSessionUploader.h"
#import "BSGUIKit.h"
#import "BSGWatchKit.h"
#import "BSG_KSSystemInfo.h"
Expand All @@ -31,7 +30,6 @@
@interface BugsnagSessionTracker ()
@property (strong, nonatomic) BugsnagConfiguration *config;
@property (weak, nonatomic) BugsnagClient *client;
@property (strong, nonatomic) BSGSessionUploader *sessionUploader;
@property (strong, nonatomic) NSDate *backgroundStartTime;
@property (nonatomic) NSMutableDictionary *extraRuntimeInfo;
@end
Expand Down
1 change: 1 addition & 0 deletions Bugsnag/Client/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ - (void)setupConnectivityListener {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (connected) {
[strongSelf.eventUploader uploadStoredEvents];
[strongSelf.sessionTracker.sessionUploader processStoredSessions];
}

[strongSelf addAutoBreadcrumbOfType:BSGBreadcrumbTypeState
Expand Down
3 changes: 3 additions & 0 deletions Bugsnag/Delivery/BSGSessionUploader.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ NS_ASSUME_NONNULL_BEGIN

- (instancetype)initWithConfig:(BugsnagConfiguration *)configuration notifier:(BugsnagNotifier *)notifier;

/// Scans previously persisted sessions and either discards or attempts upload.
- (void)processStoredSessions;

- (void)uploadSession:(BugsnagSession *)session;

@property (copy, nonatomic) NSString *codeBundleId;
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog

### Bug fixes

* Attempt to send sessions stored on disk when connection regained.
[#1445](https://github.com/bugsnag/bugsnag-cocoa/pull/1445)

* Set `user.id` to to `device.id` for all events and sessions if `BugsnagClient.user.id` is set to nil.
To prevent collection, set it to an empty string or update it in `OnSendError` / `OnSession`.
[#1442](https://github.com/bugsnag/bugsnag-cocoa/pull/1442)
Expand Down