From e79ead5efee8159df0b795db62b57563f60efa80 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Mon, 8 Jan 2024 21:21:14 +0100 Subject: [PATCH] visionOS fix --- IceCubesApp.xcodeproj/project.pbxproj | 25 +++++++++++++++++++ IceCubesApp/App/Main/AppView.swift | 6 +++++ .../MediaUI/MediaUIAttachmentVideoView.swift | 2 ++ Packages/StatusKit/Package.swift | 2 -- .../Editor/Components/AccessoryView.swift | 6 ++--- .../Editor/Components/GIF/GIFPickerView.swift | 2 +- 6 files changed, 37 insertions(+), 6 deletions(-) diff --git a/IceCubesApp.xcodeproj/project.pbxproj b/IceCubesApp.xcodeproj/project.pbxproj index ac4fc3c9..523dafcd 100644 --- a/IceCubesApp.xcodeproj/project.pbxproj +++ b/IceCubesApp.xcodeproj/project.pbxproj @@ -95,6 +95,8 @@ 9FD542E72962D2FF0045321A /* Lists in Frameworks */ = {isa = PBXBuildFile; productRef = 9FD542E62962D2FF0045321A /* Lists */; }; 9FE151A6293C90F900E9683D /* IconSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE151A5293C90F900E9683D /* IconSelectorView.swift */; }; 9FE3DB57296FEFCA00628CB0 /* AppAccount in Frameworks */ = {isa = PBXBuildFile; productRef = 9FE3DB56296FEFCA00628CB0 /* AppAccount */; }; + 9FE4CCAB2B4C848A00DA5F13 /* GiphyUISDK in Frameworks */ = {isa = PBXBuildFile; platformFilters = (ios, maccatalyst, ); productRef = 9FE4CCAA2B4C848A00DA5F13 /* GiphyUISDK */; }; + 9FE4CCAD2B4C849F00DA5F13 /* GiphyUISDK in Frameworks */ = {isa = PBXBuildFile; productRef = 9FE4CCAC2B4C849F00DA5F13 /* GiphyUISDK */; }; 9FFF677C299B7B2C00FE700A /* Notifications in Frameworks */ = {isa = PBXBuildFile; productRef = 9FFF677B299B7B2C00FE700A /* Notifications */; }; 9FFF6780299B7D2B00FE700A /* DesignSystem in Frameworks */ = {isa = PBXBuildFile; productRef = 9FFF677F299B7D2B00FE700A /* DesignSystem */; }; 9FFF6782299B7D3A00FE700A /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 9FFF6781299B7D3A00FE700A /* Account */; }; @@ -281,6 +283,7 @@ 9FAD85A2297456A400496AB1 /* Env in Frameworks */, 9FAD85A0297456A100496AB1 /* Models in Frameworks */, 9FAD85A4297456A800496AB1 /* DesignSystem in Frameworks */, + 9FE4CCAD2B4C849F00DA5F13 /* GiphyUISDK in Frameworks */, 9FAD859E2974569B00496AB1 /* Account in Frameworks */, 9FAD859C2974422700496AB1 /* AppAccount in Frameworks */, 9FC2A38F2B49D1AA00DFD1C1 /* StatusKit in Frameworks */, @@ -293,6 +296,7 @@ buildActionMask = 2147483647; files = ( 9F7335EF29674F7100AFF0BA /* QuickLook.framework in Frameworks */, + 9FE4CCAB2B4C848A00DA5F13 /* GiphyUISDK in Frameworks */, 9F7335ED2967463400AFF0BA /* AVKit.framework in Frameworks */, 9F2A540C29699705009B2D7C /* RevenueCat in Frameworks */, 9F2A540E2969A0B0009B2D7C /* StoreKit.framework in Frameworks */, @@ -603,6 +607,7 @@ 9FAD85A1297456A400496AB1 /* Env */, 9FAD85A3297456A800496AB1 /* DesignSystem */, 9FC2A38E2B49D1AA00DFD1C1 /* StatusKit */, + 9FE4CCAC2B4C849F00DA5F13 /* GiphyUISDK */, ); productName = IceCubesShareExtension; productReference = 9FAD858829743F7400496AB1 /* IceCubesShareExtension.appex */; @@ -641,6 +646,7 @@ 9FE3DB56296FEFCA00628CB0 /* AppAccount */, DA0B24FA2A6876D50045BDD7 /* SFSafeSymbols */, 9FC2A38A2B49D19A00DFD1C1 /* StatusKit */, + 9FE4CCAA2B4C848A00DA5F13 /* GiphyUISDK */, ); productName = IceCubesApp; productReference = 9FBFE639292A715500C250E9 /* Ice Cubes.app */; @@ -721,6 +727,7 @@ 9FAE4ACC29379A5A00772766 /* XCRemoteSwiftPackageReference "keychain-swift" */, 9F2A540829699705009B2D7C /* XCRemoteSwiftPackageReference "purchases-ios" */, DA0B24F92A6876D40045BDD7 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */, + 9FE4CCA92B4C848A00DA5F13 /* XCRemoteSwiftPackageReference "giphy-ios-sdk" */, ); productRefGroup = 9FBFE63A292A715500C250E9 /* Products */; projectDirPath = ""; @@ -1420,6 +1427,14 @@ kind = branch; }; }; + 9FE4CCA92B4C848A00DA5F13 /* XCRemoteSwiftPackageReference "giphy-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/Giphy/giphy-ios-sdk"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.2.7; + }; + }; DA0B24F92A6876D40045BDD7 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/SFSafeSymbols/SFSafeSymbols"; @@ -1540,6 +1555,16 @@ isa = XCSwiftPackageProductDependency; productName = AppAccount; }; + 9FE4CCAA2B4C848A00DA5F13 /* GiphyUISDK */ = { + isa = XCSwiftPackageProductDependency; + package = 9FE4CCA92B4C848A00DA5F13 /* XCRemoteSwiftPackageReference "giphy-ios-sdk" */; + productName = GiphyUISDK; + }; + 9FE4CCAC2B4C849F00DA5F13 /* GiphyUISDK */ = { + isa = XCSwiftPackageProductDependency; + package = 9FE4CCA92B4C848A00DA5F13 /* XCRemoteSwiftPackageReference "giphy-ios-sdk" */; + productName = GiphyUISDK; + }; 9FFF677B299B7B2C00FE700A /* Notifications */ = { isa = XCSwiftPackageProductDependency; productName = Notifications; diff --git a/IceCubesApp/App/Main/AppView.swift b/IceCubesApp/App/Main/AppView.swift index 2aa31073..63f50e47 100644 --- a/IceCubesApp/App/Main/AppView.swift +++ b/IceCubesApp/App/Main/AppView.swift @@ -28,11 +28,15 @@ struct AppView: View { @State var iosTabs = iOSTabs.shared var body: some View { + #if os(visionOS) + tabBarView + #else if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac { sidebarView } else { tabBarView } + #endif } var availableTabs: [Tab] { @@ -90,6 +94,7 @@ struct AppView: View { return 0 } + #if !os(visionOS) var sidebarView: some View { SideBarView(selectedTab: $selectedTab, popToRootTab: $popToRootTab, @@ -122,6 +127,7 @@ struct AppView: View { } .environment(appRouterPath) } + #endif var notificationsSecondaryColumn: some View { NotificationsTab(selectedTab: .constant(.notifications), diff --git a/Packages/MediaUI/Sources/MediaUI/MediaUIAttachmentVideoView.swift b/Packages/MediaUI/Sources/MediaUI/MediaUIAttachmentVideoView.swift index 6d68d366..4e6d17dc 100644 --- a/Packages/MediaUI/Sources/MediaUI/MediaUIAttachmentVideoView.swift +++ b/Packages/MediaUI/Sources/MediaUI/MediaUIAttachmentVideoView.swift @@ -19,7 +19,9 @@ import SwiftUI func preparePlayer(autoPlay: Bool, isCompact: Bool) { player = .init(url: url) player?.audiovisualBackgroundPlaybackPolicy = .pauses + #if !os(visionOS) player?.preventsDisplaySleepDuringVideoPlayback = false + #endif if (autoPlay || forceAutoPlay) && !isCompact { player?.play() isPlaying = true diff --git a/Packages/StatusKit/Package.swift b/Packages/StatusKit/Package.swift index 2374e329..f20bdab3 100644 --- a/Packages/StatusKit/Package.swift +++ b/Packages/StatusKit/Package.swift @@ -23,7 +23,6 @@ let package = Package( .package(name: "Network", path: "../Network"), .package(name: "Env", path: "../Env"), .package(name: "DesignSystem", path: "../DesignSystem"), - .package(url: "https://github.com/Giphy/giphy-ios-sdk", from: "2.2.7"), .package(url: "https://github.com/nicklockwood/LRUCache", from: "1.0.4"), ], targets: [ @@ -36,7 +35,6 @@ let package = Package( .product(name: "Network", package: "Network"), .product(name: "Env", package: "Env"), .product(name: "DesignSystem", package: "DesignSystem"), - .product(name: "GiphyUISDK", package: "giphy-ios-sdk"), .product(name: "LRUCache", package: "LRUCache"), ], swiftSettings: [ diff --git a/Packages/StatusKit/Sources/StatusKit/Editor/Components/AccessoryView.swift b/Packages/StatusKit/Sources/StatusKit/Editor/Components/AccessoryView.swift index 147216bb..14dea862 100644 --- a/Packages/StatusKit/Sources/StatusKit/Editor/Components/AccessoryView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Editor/Components/AccessoryView.swift @@ -1,6 +1,6 @@ import DesignSystem import Env -#if !os(visionOS) +#if !os(visionOS) && !DEBUG import GiphyUISDK #endif import Models @@ -124,7 +124,7 @@ extension StatusEditor { .background(.black) }) .sheet(isPresented: $isGIFPickerPresented, content: { - #if !os(visionOS) + #if !os(visionOS) && !DEBUG #if targetEnvironment(macCatalyst) NavigationStack { giphyView @@ -213,7 +213,7 @@ extension StatusEditor { return false } - #if !os(visionOS) + #if !os(visionOS) && !DEBUG @ViewBuilder private var giphyView: some View { @Bindable var viewModel = focusedSEVM diff --git a/Packages/StatusKit/Sources/StatusKit/Editor/Components/GIF/GIFPickerView.swift b/Packages/StatusKit/Sources/StatusKit/Editor/Components/GIF/GIFPickerView.swift index 14b00b76..61e4ab24 100644 --- a/Packages/StatusKit/Sources/StatusKit/Editor/Components/GIF/GIFPickerView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Editor/Components/GIF/GIFPickerView.swift @@ -1,4 +1,4 @@ -#if !os(visionOS) +#if !os(visionOS) && !DEBUG import DesignSystem import GiphyUISDK import SwiftUI