Skip to content

Commit

Permalink
Merge pull request #1360 from bugsnag/release-v6.17.0
Browse files Browse the repository at this point in the history
Release v6.17.0
  • Loading branch information
nickdowell authored May 11, 2022
2 parents 450d217 + b928db4 commit f3baf6c
Show file tree
Hide file tree
Showing 66 changed files with 1,103 additions and 1,522 deletions.
2 changes: 2 additions & 0 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ steps:
- xcodebuild -allowProvisioningUpdates -workspace objective-c-ios.xcworkspace -scheme objective-c-ios -configuration Release -destination generic/platform=iOS -derivedDataPath DerivedData -quiet build GCC_TREAT_WARNINGS_AS_ERRORS=YES
- echo "+++ Build Debug iOS Simulator"
- xcodebuild -allowProvisioningUpdates -workspace objective-c-ios.xcworkspace -scheme objective-c-ios -configuration Debug -destination generic/platform=iOS\ Simulator -derivedDataPath DerivedData -quiet build GCC_TREAT_WARNINGS_AS_ERRORS=YES
- echo "+++ Build Debug Mac Catalyst"
- xcodebuild -allowProvisioningUpdates -workspace objective-c-ios.xcworkspace -scheme objective-c-ios -configuration Debug -destination generic/platform=macOS -derivedDataPath DerivedData -quiet build

- label: 'examples/objective-c-osx'
timeout_in_minutes: 30
Expand Down
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ author_url: "https://www.bugsnag.com"
author: "Bugsnag Inc"
clean: false # avoid deleting docs/.git
framework_root: "Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.16.8/Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.17.0/Bugsnag"
github_url: "https://github.com/bugsnag/bugsnag-cocoa"
hide_documentation_coverage: true
module: "Bugsnag"
module_version: "6.16.8"
module_version: "6.17.0"
objc: true
output: "docs"
readme: "README.md"
Expand Down
4 changes: 2 additions & 2 deletions Bugsnag.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Bugsnag",
"version": "6.16.8",
"version": "6.17.0",
"summary": "The Bugsnag crash reporting framework for Apple platforms.",
"homepage": "https://bugsnag.com",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/bugsnag/bugsnag-cocoa.git",
"tag": "v6.16.8"
"tag": "v6.17.0"
},
"frameworks": [
"Foundation",
Expand Down
64 changes: 20 additions & 44 deletions Bugsnag.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions Bugsnag/Breadcrumbs/BSGNotificationBreadcrumbs.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ - (instancetype)initWithConfiguration:(BugsnagConfiguration *)configuration
#endif
_breadcrumbSink = breadcrumbSink;
_notificationNameMap = @{
@"NSProcessInfoThermalStateDidChangeNotification" : @"Thermal State Changed", // Using string to avoid availability issues
NSUndoManagerDidRedoChangeNotification : @"Redo Operation",
NSUndoManagerDidUndoChangeNotification : @"Undo Operation",
#if TARGET_OS_TV
Expand Down Expand Up @@ -227,6 +228,20 @@ - (void)start {
object:nil];
}
#endif

#if TARGET_OS_IOS
[self.notificationCenter addObserver:self
selector:@selector(orientationDidChange:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
#endif

if (@available(iOS 11.0, tvOS 11.0, *)) {
[self.notificationCenter addObserver:self
selector:@selector(thermalStateDidChange:)
name:NSProcessInfoThermalStateDidChangeNotification
object:nil];
}
}

// Navigation events
Expand Down Expand Up @@ -375,4 +390,47 @@ - (void)addBreadcrumbForControlNotification:(__attribute__((unused)) NSNotificat
#endif
}

#pragma mark -

#if TARGET_OS_IOS

- (void)orientationDidChange:(NSNotification *)notification {
UIDevice *device = notification.object;

static UIDeviceOrientation previousOrientation;
if (device.orientation == UIDeviceOrientationUnknown ||
device.orientation == previousOrientation) {
return;
}

NSMutableDictionary *metadata = [NSMutableDictionary dictionary];
metadata[@"from"] = BSGStringFromDeviceOrientation(previousOrientation);
metadata[@"to"] = BSGStringFromDeviceOrientation(device.orientation);
previousOrientation = device.orientation;

[self addBreadcrumbWithType:BSGBreadcrumbTypeState
forNotificationName:notification.name
metadata:metadata];
}

#endif

- (void)thermalStateDidChange:(NSNotification *)notification API_AVAILABLE(ios(11.0), tvos(11.0)) {
NSProcessInfo *processInfo = notification.object;

static NSProcessInfoThermalState previousThermalState;
if (processInfo.thermalState == previousThermalState) {
return;
}

NSMutableDictionary *metadata = [NSMutableDictionary dictionary];
metadata[@"from"] = BSGStringFromThermalState(previousThermalState);
metadata[@"to"] = BSGStringFromThermalState(processInfo.thermalState);
previousThermalState = processInfo.thermalState;

[self addBreadcrumbWithType:BSGBreadcrumbTypeState
forNotificationName:notification.name
metadata:metadata];
}

@end
5 changes: 1 addition & 4 deletions Bugsnag/BugsnagSessionTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@

NS_ASSUME_NONNULL_BEGIN

typedef void (^SessionTrackerCallback)(BugsnagSession *_Nullable session);

@interface BugsnagSessionTracker : NSObject

/**
Create a new session tracker
@param config The Bugsnag configuration to use
@param callback A callback invoked each time a new session is started
@return A new session tracker
*/
- (instancetype)initWithConfig:(BugsnagConfiguration *)config client:(nullable BugsnagClient *)client callback:(SessionTrackerCallback)callback;
- (instancetype)initWithConfig:(BugsnagConfiguration *)config client:(nullable BugsnagClient *)client;

- (void)startWithNotificationCenter:(NSNotificationCenter *)notificationCenter isInForeground:(BOOL)isInForeground;

Expand Down
19 changes: 6 additions & 13 deletions Bugsnag/BugsnagSessionTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,16 @@ @interface BugsnagSessionTracker ()
@property (weak, nonatomic) BugsnagClient *client;
@property (strong, nonatomic) BSGSessionUploader *sessionUploader;
@property (strong, nonatomic) NSDate *backgroundStartTime;

/**
* Called when a session is altered
*/
@property (nonatomic, strong, readonly) SessionTrackerCallback callback;

@property (nonatomic) NSMutableDictionary *extraRuntimeInfo;
@end

@implementation BugsnagSessionTracker

- (instancetype)initWithConfig:(BugsnagConfiguration *)config client:(BugsnagClient *)client callback:(SessionTrackerCallback)callback {
- (instancetype)initWithConfig:(BugsnagConfiguration *)config client:(BugsnagClient *)client {
if ((self = [super init])) {
_config = config;
_client = client;
_sessionUploader = [[BSGSessionUploader alloc] initWithConfig:config notifier:client.notifier];
_callback = callback;
_extraRuntimeInfo = [NSMutableDictionary new];
}
return self;
Expand Down Expand Up @@ -118,7 +111,7 @@ - (void)setCodeBundleId:(NSString *)codeBundleId {
- (void)pauseSession {
self.currentSession.stopped = YES;

self.callback(nil);
BSGSessionUpdateRunContext(nil);
}

- (BOOL)resumeSession {
Expand All @@ -130,7 +123,7 @@ - (BOOL)resumeSession {
} else {
BOOL stopped = session.isStopped;
session.stopped = NO;
self.callback(session);
BSGSessionUpdateRunContext(session);
return stopped;
}
}
Expand Down Expand Up @@ -185,7 +178,7 @@ - (void)startNewSession {

self.currentSession = newSession;

self.callback(newSession);
BSGSessionUpdateRunContext(newSession);

[self.sessionUploader uploadSession:newSession];
}
Expand Down Expand Up @@ -213,7 +206,7 @@ - (void)registerExistingSession:(NSString *)sessionId
self.currentSession.handledCount = handledCount;
self.currentSession.unhandledCount = unhandledCount;
}
self.callback(self.currentSession);
BSGSessionUpdateRunContext(self.currentSession);
}

#pragma mark - Handling events
Expand Down Expand Up @@ -243,7 +236,7 @@ - (void)incrementEventCountUnhandled:(BOOL)unhandled {
} else {
session.handledCount++;
}
self.callback(session);
BSGSessionUpdateRunContext(session);
}
}

Expand Down
22 changes: 0 additions & 22 deletions Bugsnag/BugsnagSystemState.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,9 @@

#import "BSGKeys.h"

@class BugsnagSession;

#define SYSTEMSTATE_KEY_APP @"app"
#define SYSTEMSTATE_KEY_DEVICE @"device"

#define SYSTEMSTATE_APP_WAS_TERMINATED @"wasTerminated"
#define SYSTEMSTATE_APP_IS_IN_FOREGROUND @"inForeground"
#define SYSTEMSTATE_APP_IS_LAUNCHING BSGKeyIsLaunching
#define SYSTEMSTATE_APP_VERSION @"version"
#define SYSTEMSTATE_APP_BUNDLE_VERSION @"bundleVersion"
#define SYSTEMSTATE_APP_DEBUGGER_IS_ACTIVE @"debuggerIsActive"

#define SYSTEMSTATE_DEVICE_BOOT_TIME @"bootTime"
#define SYSTEMSTATE_DEVICE_CRITICAL_THERMAL_STATE @"criticalThermalState"

#define PLATFORM_WORD_SIZE sizeof(void*)*8

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -43,21 +31,11 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic) NSUInteger consecutiveLaunchCrashes;

@property (readonly, nonatomic) BOOL lastLaunchCriticalThermalState;

@property (readonly, nonatomic) BOOL lastLaunchTerminatedUnexpectedly;

- (void)markLaunchCompleted;

/**
* Purge all stored system state.
*/
- (void)purge;

- (void)setSession:(nullable BugsnagSession *)session;

- (void)setThermalState:(NSProcessInfoThermalState)thermalState API_AVAILABLE(ios(11.0), tvos(11.0));

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit f3baf6c

Please sign in to comment.