Skip to content

Commit

Permalink
[visionOS] Add support for Firebase Performance on visionOS (#11950)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard authored Oct 17, 2023
1 parent 54d4d70 commit ffe63c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#import <TargetConditionals.h>
#import <UIKit/UIKit.h>

#import "FirebasePerformance/Sources/AppActivity/FPRScreenTraceTracker+Private.h"
Expand Down Expand Up @@ -68,9 +69,12 @@ void InstrumentViewDidAppear(FPRUIViewControllerInstrument *instrument,

// This has to be called on the main thread and so it's done here instead of in
// FPRScreenTraceTracker.
// TODO: Replace keyWindow usage (deprecated in iOS and unavailable in visionOS).
#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
if ([((UIViewController *)_self).view isDescendantOfView:FPRSharedApplication().keyWindow]) {
[[FPRScreenTraceTracker sharedInstance] viewControllerDidAppear:_self];
}
#endif
}];
}

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ let package = Package(
.target(
name: "FirebasePerformanceTarget",
dependencies: [.target(name: "FirebasePerformance",
condition: .when(platforms: [.iOS, .tvOS]))],
condition: .when(platforms: [.iOS, .tvOS, .firebaseVisionOS]))],
path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
),
.target(
Expand Down

0 comments on commit ffe63c9

Please sign in to comment.