fix: conditionals for tv to build / run

This commit is contained in:
Fredrik Burmester
2026-01-16 08:04:09 +01:00
parent 36304ad58e
commit 4ad103acb6
11 changed files with 249 additions and 48 deletions

View File

@@ -219,7 +219,7 @@ final class MPVLayerRenderer {
DispatchQueue.main.async { [weak self] in
guard let self else { return }
if #available(iOS 18.0, *) {
if #available(iOS 18.0, tvOS 17.0, *) {
self.displayLayer.sampleBufferRenderer.flush(removingDisplayedImage: true, completionHandler: nil)
} else {
self.displayLayer.flushAndRemoveImage()

View File

@@ -72,9 +72,11 @@ class MpvPlayerView: ExpoView {
displayLayer.frame = bounds
displayLayer.videoGravity = .resizeAspect
#if !os(tvOS)
if #available(iOS 17.0, *) {
displayLayer.wantsExtendedDynamicRangeContent = true
}
#endif
displayLayer.backgroundColor = UIColor.black.cgColor
videoContainer.layer.addSublayer(displayLayer)

View File

@@ -1,13 +1,19 @@
import ExpoModulesCore
#if !os(tvOS)
import NetworkExtension
import SystemConfiguration.CaptiveNetwork
#endif
public class WifiSsidModule: Module {
public func definition() -> ModuleDefinition {
Name("WifiSsid")
// Get current WiFi SSID using NEHotspotNetwork (iOS 14+)
// Not available on tvOS
AsyncFunction("getSSID") { () -> String? in
#if os(tvOS)
return nil
#else
return await withCheckedContinuation { continuation in
NEHotspotNetwork.fetchCurrent { network in
if let ssid = network?.ssid {
@@ -21,14 +27,21 @@ public class WifiSsidModule: Module {
}
}
}
#endif
}
// Synchronous version using only CNCopyCurrentNetworkInfo
// Not available on tvOS
Function("getSSIDSync") { () -> String? in
#if os(tvOS)
return nil
#else
return self.getSSIDViaCNCopy()
#endif
}
}
#if !os(tvOS)
private func getSSIDViaCNCopy() -> String? {
guard let interfaces = CNCopySupportedInterfaces() as? [String] else {
print("[WifiSsid] CNCopySupportedInterfaces returned nil")
@@ -49,4 +62,5 @@ public class WifiSsidModule: Module {
print("[WifiSsid] No SSID found via CNCopyCurrentNetworkInfo")
return nil
}
#endif
}