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

Fix visionOS support #1565

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Bugsnag/Breadcrumbs/BSGNotificationBreadcrumbs.m
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ - (void)addBreadcrumbForControlNotification:(__unused NSNotification *)notificat

#pragma mark -

#if TARGET_OS_IOS
#if !TARGET_OS_XR && TARGET_OS_IOS

- (void)orientationDidChange:(NSNotification *)notification {
UIDevice *device = notification.object;
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Client/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ - (void)applicationWillTerminate:(__unused NSNotification *)notification {
BSGGetDevice().batteryMonitoringEnabled = FALSE;
#endif

#if TARGET_OS_IOS
#if !TARGET_OS_XR && TARGET_OS_IOS
[[UIDEVICE currentDevice] endGeneratingDeviceOrientationNotifications];
#endif
}
Expand Down
6 changes: 6 additions & 0 deletions Bugsnag/Helpers/BSGDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
#define BSG_HAVE_UIDEVICE __has_include(<UIKit/UIDevice.h>)
#define BSG_HAVE_WINDOW (TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_TV )

// Capabilities from future OS versions to allow this to be merged during visionOS beta

#ifndef TARGET_OS_XR
#define TARGET_OS_XR 0
#endif

// Capabilities dependent upon previously defined capabilities
#define BSG_HAVE_APP_HANG_DETECTION (BSG_HAVE_MACH_THREADS)

Expand Down
4 changes: 2 additions & 2 deletions Bugsnag/Helpers/BSGRunContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static void NoteAppWillTerminate(__unused CFNotificationCenterRef center,

#endif

#if TARGET_OS_IOS
#if !TARGET_OS_XR && TARGET_OS_IOS

static void NoteBatteryLevel(__unused CFNotificationCenterRef center,
__unused void *observer,
Expand Down Expand Up @@ -356,7 +356,7 @@ static void AddObservers(void) {
bsg_runContext->batteryState = BSGGetDevice().batteryState;
#endif

#if TARGET_OS_IOS
#if !TARGET_OS_XR && TARGET_OS_IOS
UIDevice *currentDevice = [UIDEVICE currentDevice];
[currentDevice beginGeneratingDeviceOrientationNotifications];
bsg_runContext->lastKnownOrientation = currentDevice.orientation;
Expand Down