Skip to content

Commit

Permalink
Merge pull request #920 from bugsnag/release-v6.3.0
Browse files Browse the repository at this point in the history
Release v6.3.0
  • Loading branch information
nickdowell authored Dec 2, 2020
2 parents d6509bf + 46224ef commit 2256dfe
Show file tree
Hide file tree
Showing 58 changed files with 706 additions and 448 deletions.
62 changes: 46 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ jobs:
# Unit Tests - Mac
# ----------------------------------------------------------------------------

- osx_image: xcode12.2 # macos 10.15.7
name: macOS 10.15.7 unit tests
stage: macOS unit tests
env: PLATFORM=macOS

- osx_image: xcode11.6 # macos 10.15.5
name: macOS 10.15.5 unit tests
stage: macOS unit tests
env: PLATFORM=macOS

- osx_image: xcode10.2 # macos 10.14
name: macOS 10.14 unit tests
stage: macOS unit tests
Expand All @@ -39,18 +49,29 @@ jobs:
# Unit Tests - iOS
# ----------------------------------------------------------------------------

- osx_image: xcode12.2
name: iOS 11-14 unit tests
stage: unit tests
env:
- PLATFORM=iOS
- DEVICE="iPhone 8"
script:
- make test OS=14.1
- make test OS=13.5
- make test OS=12.4
- make test OS=11.4

- osx_image: xcode11
name: iOS 13.x unit tests
name: iOS 10 unit tests
stage: unit tests
# Xcode 11+ no longer ships with all device combinations premade
before_script: xcrun simctl create "13-xs" "iPhone XS" com.apple.CoreSimulator.SimRuntime.iOS-13-0
env:
- PLATFORM=iOS
- OS=13.0
- DEVICE="iPhone XS"
- DEVICE="iPhone 7"
script:
- make test OS=10.3.1

- osx_image: xcode10.2
name: iOS 9-12 unit tests
name: iOS 9 unit tests
stage: unit tests
env: PLATFORM=iOS
before_script:
Expand All @@ -59,26 +80,35 @@ jobs:
script:
- make test OS=9.3
- make test OS=9.3 TEST_CONFIGURATION=Release
- make test OS=12.2
- make test OS=12.1
- make test OS=11.4
- make test OS=10.3.1

# ----------------------------------------------------------------------------
# Unit Tests - tvOS
# ----------------------------------------------------------------------------

- osx_image: xcode10.2
name: tvOS 9-12 unit tests
- osx_image: xcode12.2
name: tvOS 11-14 unit tests
stage: unit tests
env: PLATFORM=tvOS
script:
- make test OS=12.2
- make test OS=12.1
- make test OS=14.0
- make test OS=13.3
- make test OS=12.4
- make test OS=11.4

- osx_image: xcode11
name: tvOS 10 unit tests
stage: unit tests
env: PLATFORM=tvOS
script:
- make test OS=10.2

- osx_image: xcode10.2
name: tvOS 9 unit tests
stage: unit tests
env: PLATFORM=tvOS
script:
- make test OS=9.2

# ----------------------------------------------------------------------------
# Static framework, Carthage and Swift Package Manager builds
# ----------------------------------------------------------------------------
Expand All @@ -99,7 +129,7 @@ jobs:
# Doc Generation
# ----------------------------------------------------------------------------

- osx_image: xcode10.2
- osx_image: xcode11
stage: deploy
before_deploy: make doc
script: skip
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.2.6",
"version": "6.3.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.2.6"
"tag": "v6.3.0"
},
"frameworks": [
"Foundation",
Expand Down
51 changes: 27 additions & 24 deletions Bugsnag.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions Bugsnag/Bugsnag.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#import "BSG_KSCrash.h"
#import "BugsnagBreadcrumbs.h"
#import "BugsnagLogger.h"
#import "BugsnagClient.h"
#import "BugsnagClientInternal.h"
#import "BugsnagClient+Private.h"
#import "BugsnagKeys.h"
#import "BugsnagPlugin.h"
#import "BugsnagHandledState.h"
Expand All @@ -52,16 +51,6 @@ @interface NSDictionary (BSGKSMerge)
- (NSDictionary *)BSG_mergedInto:(NSDictionary *)dest;
@end

@interface BugsnagClient ()
- (void)startListeningForStateChangeNotification:(NSString *_Nonnull)notificationName;
- (void)addBreadcrumbWithBlock:(void (^_Nonnull)(BugsnagBreadcrumb *_Nonnull))block;
- (void)notifyInternal:(BugsnagEvent *_Nonnull)event
block:(BugsnagOnErrorBlock)block;
- (void)addRuntimeVersionInfo:(NSString *)info
withKey:(NSString *)key;
@property (nonatomic) NSString *codeBundleId;
@end

@interface BugsnagMetadata ()
- (NSDictionary *_Nonnull)toDictionary;
@end
Expand Down
4 changes: 2 additions & 2 deletions Bugsnag/BugsnagErrorReportSink.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

#import "BSG_KSSystemInfo.h"
#import "Bugsnag.h"
#import "BugsnagClient.h"
#import "BugsnagClientInternal.h"
#import "BugsnagClient+Private.h"
#import "BugsnagCollections.h"
#import "BugsnagEvent+Private.h"
#import "BugsnagKeys.h"
Expand Down Expand Up @@ -133,6 +132,7 @@ - (void)deliverStoredEvents:(NSMutableDictionary<NSString *, BugsnagEvent *> *)s

NSMutableDictionary *apiHeaders = [[configuration errorApiHeaders] mutableCopy];
apiHeaders[BugsnagHTTPHeaderNameApiKey] = event.apiKey;
apiHeaders[BugsnagHTTPHeaderNameStacktraceTypes] = [event.stacktraceTypes componentsJoinedByString:@","];
[self.apiClient sendJSONPayload:requestPayload headers:apiHeaders toURL:configuration.notifyURL
completionHandler:^(BugsnagApiClientDeliveryStatus status, NSError *error) {
BOOL completed = status == BugsnagApiClientDeliveryStatusDelivered || status == BugsnagApiClientDeliveryStatusUndeliverable;
Expand Down
2 changes: 2 additions & 0 deletions Bugsnag/BugsnagSystemState.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithConfiguration:(BugsnagConfiguration *)config;

- (void)recordAppUUID;

- (void)setCodeBundleID:(NSString*)codeBundleID;

/**
Expand Down
37 changes: 25 additions & 12 deletions Bugsnag/BugsnagSystemState.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#if TARGET_OS_OSX
#import <AppKit/AppKit.h>
#else
#import <UIKit/UIKit.h>
#import "BSGUIKit.h"
#endif

#import "BugsnagSystemState.h"
Expand Down Expand Up @@ -117,11 +117,16 @@ id blankIfNil(id value) {
device[@"modelNumber"] = systemInfo[@ BSG_KSSystemField_Model];
device[@"wordSize"] = @(PLATFORM_WORD_SIZE);
device[@"locale"] = [[NSLocale currentLocale] localeIdentifier];
device[@"runtimeVersions"] = @{
@"clangVersion": systemInfo[@BSG_KSSystemField_ClangVersion] ?: @"",
@"osBuild": systemInfo[@BSG_KSSystemField_OSVersion] ?: @""
};
#if BSG_PLATFORM_SIMULATOR
device[@"simulator"] = @YES;
#else
device[@"simulator"] = @NO;
#endif
device[@"totalMemory"] = systemInfo[@BSG_KSSystemField_Memory][@"usable"];

NSMutableDictionary *state = [NSMutableDictionary new];
state[BSGKeyApp] = app;
Expand Down Expand Up @@ -167,11 +172,11 @@ - (instancetype)initWithConfiguration:(BugsnagConfiguration *)config {
// MacOS "active" serves the same purpose as "foreground" in iOS
[center addObserverForName:NSApplicationDidBecomeActiveNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
[weakSelf.kvStore setBoolean:YES forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
[weakSelf bgSetAppValue:@YES forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
[weakSelf setValue:@YES forAppKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
}];
[center addObserverForName:NSApplicationDidResignActiveNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
[weakSelf.kvStore setBoolean:NO forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
[weakSelf bgSetAppValue:@NO forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
[weakSelf setValue:@NO forAppKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
}];
#else
[center addObserverForName:UIApplicationWillTerminateNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
Expand All @@ -180,47 +185,55 @@ - (instancetype)initWithConfiguration:(BugsnagConfiguration *)config {
}];
[center addObserverForName:UIApplicationWillEnterForegroundNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
[weakSelf.kvStore setBoolean:YES forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
[weakSelf bgSetAppValue:@YES forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
[weakSelf setValue:@YES forAppKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
}];
[center addObserverForName:UIApplicationDidEnterBackgroundNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
[weakSelf.kvStore setBoolean:NO forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
[weakSelf bgSetAppValue:@NO forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
[weakSelf setValue:@NO forAppKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
}];
[center addObserverForName:UIApplicationDidBecomeActiveNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
[weakSelf.kvStore setBoolean:YES forKey:SYSTEMSTATE_APP_IS_ACTIVE];
[weakSelf bgSetAppValue:@YES forKey:SYSTEMSTATE_APP_IS_ACTIVE];
[weakSelf setValue:@YES forAppKey:SYSTEMSTATE_APP_IS_ACTIVE];
}];
[center addObserverForName:UIApplicationWillResignActiveNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
[weakSelf.kvStore setBoolean:NO forKey:SYSTEMSTATE_APP_IS_ACTIVE];
[weakSelf bgSetAppValue:@NO forKey:SYSTEMSTATE_APP_IS_ACTIVE];
[weakSelf setValue:@NO forAppKey:SYSTEMSTATE_APP_IS_ACTIVE];
}];
[center addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
NSString *date = [BSG_RFC3339DateTool stringFromDate:[NSDate date]];
[weakSelf.kvStore setString:date forKey:SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING];
[weakSelf bgSetAppValue:date forKey:SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING];
[weakSelf setValue:date forAppKey:SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING];
}];
#endif
}
return self;
}

- (void)recordAppUUID {
// [BSG_KSSystemInfo appUUID] returns nil until we have called _dyld_register_func_for_add_image()
[self setValue:[BSG_KSSystemInfo appUUID] forAppKey:BSGKeyMachoUUID];
}

- (void)setCodeBundleID:(NSString*)codeBundleID {
[self bgSetAppValue:codeBundleID forKey:BSGKeyCodeBundleId];
[self setValue:codeBundleID forAppKey:BSGKeyCodeBundleId];
}

- (void)bgSetAppValue:(id)value forKey:(NSString*)key {
- (void)setValue:(id)value forAppKey:(NSString *)key {
[self setValue:value forKey:key inSection:SYSTEMSTATE_KEY_APP];
}

- (void)setValue:(id)value forKey:(NSString *)key inSection:(NSString *)section {
// Run on a BG thread so we don't monopolize the notification queue.
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
@synchronized (self) {
self.currentLaunchStateRW[SYSTEMSTATE_KEY_APP][key] = value;
self.currentLaunchStateRW[section][key] = value;
// User-facing state should never mutate from under them.
self.currentLaunchState = copyLaunchState(self.currentLaunchStateRW);
}
[self sync];
});
}


- (void)sync {
NSDictionary *state = self.currentLaunchState;
NSError *error = nil;
Expand Down
97 changes: 97 additions & 0 deletions Bugsnag/Client/BugsnagClient+Private.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//
// BugsnagClient+Private.h
// Bugsnag
//
// Created by Nick Dowell on 26/11/2020.
// Copyright © 2020 Bugsnag Inc. All rights reserved.
//

#import <Bugsnag/BugsnagClient.h>

@class BugsnagBreadcrumbs;
@class BugsnagConfiguration;
@class BugsnagCrashSentry;
@class BugsnagErrorReportApiClient;
@class BugsnagMetadata;
@class BugsnagNotifier;
@class BugsnagPluginClient;
@class BugsnagSessionTracker;
@class BugsnagSystemState;

NS_ASSUME_NONNULL_BEGIN

@interface BugsnagClient ()

#pragma mark Properties

@property (nonatomic) BOOL appDidCrashLastLaunch;

@property (nullable, retain, nonatomic) BugsnagBreadcrumbs *breadcrumbs;

@property (nullable, nonatomic) NSString *codeBundleId;

@property (readonly) NSString *configMetadataFile;

@property (nullable) NSDictionary *configMetadataFromLastLaunch;

@property (nullable, retain, nonatomic) BugsnagConfiguration *configuration;

@property (strong, nonatomic) BugsnagCrashSentry *crashSentry;

@property (strong, nonatomic) BugsnagErrorReportApiClient *errorReportApiClient;

@property NSMutableDictionary *extraRuntimeInfo;

#if TARGET_OS_IOS
@property (strong, nonatomic) NSString *lastOrientation;
#endif

@property (strong, nonatomic) BugsnagMetadata *metadata; // Used in BugsnagReactNative

@property (readonly) NSString *metadataFile;

@property (nullable) NSDictionary *metadataFromLastLaunch;

@property (strong, nonatomic) BugsnagNotifier *notifier; // Used in BugsnagReactNative

@property (strong, nonatomic) BugsnagPluginClient *pluginClient;

@property (strong, nonatomic) BugsnagSessionTracker *sessionTracker; // Used in BugsnagReactNative

@property (readonly) BOOL started;

@property (strong, nonatomic) BugsnagMetadata *state;

@property (strong, nonatomic) NSMutableArray *stateEventBlocks;

@property (readonly) NSString *stateMetadataFile;

@property (nullable) NSDictionary *stateMetadataFromLastLaunch;

@property (strong, nonatomic) BugsnagSystemState *systemState;

@property (nonatomic) BugsnagUser *user;

#pragma mark Methods

- (void)addBreadcrumbWithBlock:(void (^)(BugsnagBreadcrumb *))block;

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

- (NSDictionary *)collectAppWithState; // Used in BugsnagReactNative

- (NSArray *)collectBreadcrumbs; // Used in BugsnagReactNative

- (NSDictionary *)collectDeviceWithState; // Used in BugsnagReactNative

- (NSArray *)collectThreads:(BOOL)unhandled; // Used in BugsnagReactNative

- (void)notifyInternal:(BugsnagEvent *)event block:(BugsnagOnErrorBlock)block;

- (BOOL)shouldReportOOM;

- (void)start;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 2256dfe

Please sign in to comment.