Skip to content

Commit

Permalink
Merge pull request #1486 from bugsnag/release-v6.23.1
Browse files Browse the repository at this point in the history
Release v6.23.1
  • Loading branch information
nickdowell authored Sep 21, 2022
2 parents 735ed75 + d6d4c80 commit 5314f90
Show file tree
Hide file tree
Showing 22 changed files with 287 additions and 91 deletions.
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.23.0/Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.23.1/Bugsnag"
github_url: "https://github.com/bugsnag/bugsnag-cocoa"
hide_documentation_coverage: true
module: "Bugsnag"
module_version: "6.23.0"
module_version: "6.23.1"
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.23.0",
"version": "6.23.1",
"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.23.0"
"tag": "v6.23.1"
},
"ios": {
"frameworks": [
Expand Down
46 changes: 18 additions & 28 deletions Bugsnag/Breadcrumbs/BSGNotificationBreadcrumbs.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@

#import "BSGNotificationBreadcrumbs.h"

#import "BugsnagBreadcrumbs.h"
#import "BugsnagConfiguration+Private.h"
#import "BSGKeys.h"
#import "BSGUtils.h"
#import "BSGDefines.h"
#import "BSGAppKit.h"
#import "BSGDefines.h"
#import "BSGKeys.h"
#import "BSGUIKit.h"

#define BSG_HAVE_TABLE_VIEW (TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_TV)
#define BSG_HAVE_TEXT_CONTROL (TARGET_OS_OSX || TARGET_OS_IOS )
#import "BSGUtils.h"
#import "BugsnagBreadcrumbs.h"
#import "BugsnagConfiguration+Private.h"

BSG_OBJC_DIRECT_MEMBERS
@interface BSGNotificationBreadcrumbs ()
Expand Down Expand Up @@ -170,30 +167,30 @@ - (instancetype)initWithConfiguration:(BugsnagConfiguration *)configuration
}

- (NSArray<NSNotificationName> *)automaticBreadcrumbControlEvents {
#if !BSG_HAVE_TEXT_CONTROL
return nil;
#elif BSG_HAVE_APPKIT
return @[
NSControlTextDidBeginEditingNotification,
NSControlTextDidEndEditingNotification
];
#else
#if TARGET_OS_IOS
return @[
UITextFieldTextDidBeginEditingNotification,
UITextFieldTextDidEndEditingNotification,
UITextViewTextDidBeginEditingNotification,
UITextViewTextDidEndEditingNotification
];
#elif TARGET_OS_OSX
return @[
NSControlTextDidBeginEditingNotification,
NSControlTextDidEndEditingNotification
];
#else
return nil;
#endif
}

- (NSArray<NSNotificationName> *)automaticBreadcrumbTableItemEvents {
#if !BSG_HAVE_TABLE_VIEW
return @[];
#elif BSG_HAVE_APPKIT
return @[ NSTableViewSelectionDidChangeNotification ];
#if TARGET_OS_IOS || TARGET_OS_TV
return @[UITableViewSelectionDidChangeNotification];
#elif TARGET_OS_OSX
return @[NSTableViewSelectionDidChangeNotification];
#else
return @[ UITableViewSelectionDidChangeNotification ];
return @[];
#endif
}

Expand Down Expand Up @@ -321,8 +318,6 @@ - (BOOL)tryAddSceneNotification:(NSNotification *)notification {
#endif

- (BOOL)tryAddWindowNotification:(NSNotification *)notification {
#if BSG_HAVE_WINDOW

#if TARGET_OS_IOS || TARGET_OS_TV
if ([notification.name hasPrefix:@"UIWindow"] && [notification.object isKindOfClass:UIWINDOW]) {
UIWindow *window = notification.object;
Expand Down Expand Up @@ -365,7 +360,6 @@ - (BOOL)tryAddWindowNotification:(NSNotification *)notification {
}
#endif

#endif
return NO;
}

Expand All @@ -380,8 +374,6 @@ - (void)addBreadcrumbForNotification:(NSNotification *)notification {
}

- (void)addBreadcrumbForTableViewNotification:(__unused NSNotification *)notification {
#if BSG_HAVE_TABLE_VIEW

#if TARGET_OS_IOS || TARGET_OS_TV
NSIndexPath *indexPath = ((UITableView *)notification.object).indexPathForSelectedRow;
[self addBreadcrumbWithType:BSGBreadcrumbTypeNavigation forNotificationName:notification.name metadata:
Expand All @@ -391,8 +383,6 @@ - (void)addBreadcrumbForTableViewNotification:(__unused NSNotification *)notific
[self addBreadcrumbWithType:BSGBreadcrumbTypeNavigation forNotificationName:notification.name metadata:
tableView ? @{@"selectedRow" : @(tableView.selectedRow), @"selectedColumn" : @(tableView.selectedColumn)} : nil];
#endif

#endif
}

- (void)addBreadcrumbForMenuItemNotification:(__unused NSNotification *)notification {
Expand Down
3 changes: 2 additions & 1 deletion Bugsnag/BugsnagInternals.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#import "BugsnagHandledState.h"
#import "BugsnagNotifier.h"

typedef NSMutableArray<BugsnagFeatureFlag *> BSGFeatureFlagStore;
@interface BSGFeatureFlagStore : NSObject <NSCopying>
@end

NS_ASSUME_NONNULL_BEGIN

Expand Down
4 changes: 2 additions & 2 deletions Bugsnag/BugsnagSessionTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ - (void)startWithNotificationCenter:(NSNotificationCenter *)notificationCenter i
bsg_log_debug(@"Not starting session because app is not in the foreground");
}

#if BSG_HAVE_APPKIT
#if TARGET_OS_OSX
[notificationCenter addObserver:self
selector:@selector(handleAppForegroundEvent)
name:NSApplicationWillBecomeActiveNotification
Expand All @@ -81,7 +81,7 @@ - (void)startWithNotificationCenter:(NSNotificationCenter *)notificationCenter i
selector:@selector(handleAppBackgroundEvent)
name:NSApplicationDidResignActiveNotification
object:nil];
#elif BSG_HAVE_WATCHKIT
#elif TARGET_OS_WATCH
[notificationCenter addObserver:self
selector:@selector(handleAppForegroundEvent)
name:WKApplicationWillEnterForegroundNotification
Expand Down
10 changes: 5 additions & 5 deletions Bugsnag/Client/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ - (instancetype)initWithConfiguration:(BugsnagConfiguration *)configuration {
[_configuration setUser:[BSG_KSSystemInfo deviceAndAppHash] withEmail:_configuration.user.email andName:_configuration.user.name];
}

_featureFlagStore = [configuration.featureFlagStore mutableCopy];
_featureFlagStore = [configuration.featureFlagStore copy];

_state = [[BugsnagMetadata alloc] initWithDictionary:@{
BSGKeyClient: @{
Expand Down Expand Up @@ -275,7 +275,7 @@ - (void)start {

[center addObserver:self
selector:@selector(applicationWillTerminate:)
#if BSG_HAVE_APPKIT
#if TARGET_OS_OSX
name:NSApplicationWillTerminateNotification
#else
name:UIApplicationWillTerminateNotification
Expand Down Expand Up @@ -762,7 +762,7 @@ - (void)notifyInternal:(BugsnagEvent *_Nonnull)event
// App hang events will already contain feature flags
if (!event.featureFlagStore.count) {
@synchronized (self.featureFlagStore) {
event.featureFlagStore = [self.featureFlagStore mutableCopy];
event.featureFlagStore = [self.featureFlagStore copy];
}
}

Expand Down Expand Up @@ -976,7 +976,7 @@ - (void)setObserver:(BSGClientObserver)observer {
};

@synchronized (self.featureFlagStore) {
for (BugsnagFeatureFlag *flag in self.featureFlagStore) {
for (BugsnagFeatureFlag *flag in self.featureFlagStore.allFlags) {
observer(BSGClientObserverAddFeatureFlag, flag);
}
}
Expand Down Expand Up @@ -1040,7 +1040,7 @@ - (void)appHangDetectedAtDate:(NSDate *)date withThreads:(NSArray<BugsnagThread
self.appHangEvent.context = self.context;

@synchronized (self.featureFlagStore) {
self.appHangEvent.featureFlagStore = [self.featureFlagStore mutableCopy];
self.appHangEvent.featureFlagStore = [self.featureFlagStore copy];
}

[self.appHangEvent symbolicateIfNeeded];
Expand Down
2 changes: 0 additions & 2 deletions Bugsnag/Helpers/BSGAppKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Copyright © 2021 Bugsnag Inc. All rights reserved.
//

#include "BSGDefines.h"

#if __has_include(<AppKit/AppKit.h>)

#import <AppKit/AppKit.h>
Expand Down
3 changes: 0 additions & 3 deletions Bugsnag/Helpers/BSGDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <TargetConditionals.h>

// Capabilities dependent upon system defines and files
#define BSG_HAVE_APPKIT __has_include(<AppKit/AppKit.h>)
#define BSG_HAVE_BATTERY ( TARGET_OS_IOS || TARGET_OS_WATCH)
#define BSG_HAVE_MACH_EXCEPTIONS (TARGET_OS_OSX || TARGET_OS_IOS )
#define BSG_HAVE_MACH_THREADS (TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_TV )
Expand All @@ -22,8 +21,6 @@
#define BSG_HAVE_SIGALTSTACK (TARGET_OS_OSX || TARGET_OS_IOS )
#define BSG_HAVE_SYSCALL (TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_TV )
#define BSG_HAVE_UIDEVICE __has_include(<UIKit/UIDevice.h>)
#define BSG_HAVE_UIKIT __has_include(<UIKit/UIKit.h>)
#define BSG_HAVE_WATCHKIT __has_include(<WatchKit/WatchKit.h>)
#define BSG_HAVE_WINDOW (TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_TV )

// Capabilities dependent upon previously defined capabilities
Expand Down
21 changes: 21 additions & 0 deletions Bugsnag/Helpers/BSGFeatureFlagStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "BugsnagInternals.h"
#import "BSGDefines.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -20,4 +21,24 @@ NSArray<NSDictionary *> * BSGFeatureFlagStoreToJSON(BSGFeatureFlagStore *store);

BSGFeatureFlagStore * BSGFeatureFlagStoreFromJSON(id _Nullable json);


BSG_OBJC_DIRECT_MEMBERS
@interface BSGFeatureFlagStore ()

@property(nonatomic,nonnull,readonly) NSArray<BugsnagFeatureFlag *> * allFlags;

+ (nonnull BSGFeatureFlagStore *) fromJSON:(nonnull id)json;

- (NSUInteger) count;

- (void) addFeatureFlag:(nonnull NSString *)name withVariant:(nullable NSString *)variant;

- (void) addFeatureFlags:(nonnull NSArray<BugsnagFeatureFlag *> *)featureFlags;

- (void) clear:(nullable NSString *)name;

- (nonnull NSArray<NSDictionary *> *) toJSON;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 5314f90

Please sign in to comment.