Skip to content

Commit

Permalink
fix: tvOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannisj committed Nov 15, 2024
1 parent b98b7c7 commit eb0cecc
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions PostHog/PostHogContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,12 @@ class PostHogContext {

private func registerNotifications() {
#if os(iOS) || os(tvOS)
NotificationCenter.default.addObserver(self,
selector: #selector(cacheScreenSize),
name: UIDevice.orientationDidChangeNotification,
object: nil)
#if os(iOS)
NotificationCenter.default.addObserver(self,
selector: #selector(cacheScreenSize),
name: UIDevice.orientationDidChangeNotification,
object: nil)
#endif
NotificationCenter.default.addObserver(self,
selector: #selector(cacheScreenSize),
name: UIWindow.didBecomeKeyNotification,
Expand Down Expand Up @@ -192,12 +194,15 @@ class PostHogContext {

private func unregisterNotifications() {
#if os(iOS) || os(tvOS)
NotificationCenter.default.removeObserver(self,
name: UIDevice.orientationDidChangeNotification,
object: nil)
#if os(iOS)
NotificationCenter.default.removeObserver(self,
name: UIDevice.orientationDidChangeNotification,
object: nil)
#endif
NotificationCenter.default.removeObserver(self,
name: UIWindow.didBecomeKeyNotification,
object: nil)

#elseif os(macOS)
NotificationCenter.default.removeObserver(self,
name: NSWindow.didBecomeKeyNotification,
Expand Down

0 comments on commit eb0cecc

Please sign in to comment.