visionOS fix

This commit is contained in:
Thomas Ricouard 2024-01-08 21:21:14 +01:00
parent 5d24c4d2e8
commit e79ead5efe
6 changed files with 37 additions and 6 deletions

View File

@ -95,6 +95,8 @@
9FD542E72962D2FF0045321A /* Lists in Frameworks */ = {isa = PBXBuildFile; productRef = 9FD542E62962D2FF0045321A /* Lists */; }; 9FD542E72962D2FF0045321A /* Lists in Frameworks */ = {isa = PBXBuildFile; productRef = 9FD542E62962D2FF0045321A /* Lists */; };
9FE151A6293C90F900E9683D /* IconSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE151A5293C90F900E9683D /* IconSelectorView.swift */; }; 9FE151A6293C90F900E9683D /* IconSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE151A5293C90F900E9683D /* IconSelectorView.swift */; };
9FE3DB57296FEFCA00628CB0 /* AppAccount in Frameworks */ = {isa = PBXBuildFile; productRef = 9FE3DB56296FEFCA00628CB0 /* AppAccount */; }; 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 */; }; 9FFF677C299B7B2C00FE700A /* Notifications in Frameworks */ = {isa = PBXBuildFile; productRef = 9FFF677B299B7B2C00FE700A /* Notifications */; };
9FFF6780299B7D2B00FE700A /* DesignSystem in Frameworks */ = {isa = PBXBuildFile; productRef = 9FFF677F299B7D2B00FE700A /* DesignSystem */; }; 9FFF6780299B7D2B00FE700A /* DesignSystem in Frameworks */ = {isa = PBXBuildFile; productRef = 9FFF677F299B7D2B00FE700A /* DesignSystem */; };
9FFF6782299B7D3A00FE700A /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 9FFF6781299B7D3A00FE700A /* Account */; }; 9FFF6782299B7D3A00FE700A /* Account in Frameworks */ = {isa = PBXBuildFile; productRef = 9FFF6781299B7D3A00FE700A /* Account */; };
@ -281,6 +283,7 @@
9FAD85A2297456A400496AB1 /* Env in Frameworks */, 9FAD85A2297456A400496AB1 /* Env in Frameworks */,
9FAD85A0297456A100496AB1 /* Models in Frameworks */, 9FAD85A0297456A100496AB1 /* Models in Frameworks */,
9FAD85A4297456A800496AB1 /* DesignSystem in Frameworks */, 9FAD85A4297456A800496AB1 /* DesignSystem in Frameworks */,
9FE4CCAD2B4C849F00DA5F13 /* GiphyUISDK in Frameworks */,
9FAD859E2974569B00496AB1 /* Account in Frameworks */, 9FAD859E2974569B00496AB1 /* Account in Frameworks */,
9FAD859C2974422700496AB1 /* AppAccount in Frameworks */, 9FAD859C2974422700496AB1 /* AppAccount in Frameworks */,
9FC2A38F2B49D1AA00DFD1C1 /* StatusKit in Frameworks */, 9FC2A38F2B49D1AA00DFD1C1 /* StatusKit in Frameworks */,
@ -293,6 +296,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9F7335EF29674F7100AFF0BA /* QuickLook.framework in Frameworks */, 9F7335EF29674F7100AFF0BA /* QuickLook.framework in Frameworks */,
9FE4CCAB2B4C848A00DA5F13 /* GiphyUISDK in Frameworks */,
9F7335ED2967463400AFF0BA /* AVKit.framework in Frameworks */, 9F7335ED2967463400AFF0BA /* AVKit.framework in Frameworks */,
9F2A540C29699705009B2D7C /* RevenueCat in Frameworks */, 9F2A540C29699705009B2D7C /* RevenueCat in Frameworks */,
9F2A540E2969A0B0009B2D7C /* StoreKit.framework in Frameworks */, 9F2A540E2969A0B0009B2D7C /* StoreKit.framework in Frameworks */,
@ -603,6 +607,7 @@
9FAD85A1297456A400496AB1 /* Env */, 9FAD85A1297456A400496AB1 /* Env */,
9FAD85A3297456A800496AB1 /* DesignSystem */, 9FAD85A3297456A800496AB1 /* DesignSystem */,
9FC2A38E2B49D1AA00DFD1C1 /* StatusKit */, 9FC2A38E2B49D1AA00DFD1C1 /* StatusKit */,
9FE4CCAC2B4C849F00DA5F13 /* GiphyUISDK */,
); );
productName = IceCubesShareExtension; productName = IceCubesShareExtension;
productReference = 9FAD858829743F7400496AB1 /* IceCubesShareExtension.appex */; productReference = 9FAD858829743F7400496AB1 /* IceCubesShareExtension.appex */;
@ -641,6 +646,7 @@
9FE3DB56296FEFCA00628CB0 /* AppAccount */, 9FE3DB56296FEFCA00628CB0 /* AppAccount */,
DA0B24FA2A6876D50045BDD7 /* SFSafeSymbols */, DA0B24FA2A6876D50045BDD7 /* SFSafeSymbols */,
9FC2A38A2B49D19A00DFD1C1 /* StatusKit */, 9FC2A38A2B49D19A00DFD1C1 /* StatusKit */,
9FE4CCAA2B4C848A00DA5F13 /* GiphyUISDK */,
); );
productName = IceCubesApp; productName = IceCubesApp;
productReference = 9FBFE639292A715500C250E9 /* Ice Cubes.app */; productReference = 9FBFE639292A715500C250E9 /* Ice Cubes.app */;
@ -721,6 +727,7 @@
9FAE4ACC29379A5A00772766 /* XCRemoteSwiftPackageReference "keychain-swift" */, 9FAE4ACC29379A5A00772766 /* XCRemoteSwiftPackageReference "keychain-swift" */,
9F2A540829699705009B2D7C /* XCRemoteSwiftPackageReference "purchases-ios" */, 9F2A540829699705009B2D7C /* XCRemoteSwiftPackageReference "purchases-ios" */,
DA0B24F92A6876D40045BDD7 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */, DA0B24F92A6876D40045BDD7 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */,
9FE4CCA92B4C848A00DA5F13 /* XCRemoteSwiftPackageReference "giphy-ios-sdk" */,
); );
productRefGroup = 9FBFE63A292A715500C250E9 /* Products */; productRefGroup = 9FBFE63A292A715500C250E9 /* Products */;
projectDirPath = ""; projectDirPath = "";
@ -1420,6 +1427,14 @@
kind = branch; 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" */ = { DA0B24F92A6876D40045BDD7 /* XCRemoteSwiftPackageReference "SFSafeSymbols" */ = {
isa = XCRemoteSwiftPackageReference; isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SFSafeSymbols/SFSafeSymbols"; repositoryURL = "https://github.com/SFSafeSymbols/SFSafeSymbols";
@ -1540,6 +1555,16 @@
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;
productName = AppAccount; 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 */ = { 9FFF677B299B7B2C00FE700A /* Notifications */ = {
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;
productName = Notifications; productName = Notifications;

View File

@ -28,11 +28,15 @@ struct AppView: View {
@State var iosTabs = iOSTabs.shared @State var iosTabs = iOSTabs.shared
var body: some View { var body: some View {
#if os(visionOS)
tabBarView
#else
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac { if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
sidebarView sidebarView
} else { } else {
tabBarView tabBarView
} }
#endif
} }
var availableTabs: [Tab] { var availableTabs: [Tab] {
@ -90,6 +94,7 @@ struct AppView: View {
return 0 return 0
} }
#if !os(visionOS)
var sidebarView: some View { var sidebarView: some View {
SideBarView(selectedTab: $selectedTab, SideBarView(selectedTab: $selectedTab,
popToRootTab: $popToRootTab, popToRootTab: $popToRootTab,
@ -122,6 +127,7 @@ struct AppView: View {
} }
.environment(appRouterPath) .environment(appRouterPath)
} }
#endif
var notificationsSecondaryColumn: some View { var notificationsSecondaryColumn: some View {
NotificationsTab(selectedTab: .constant(.notifications), NotificationsTab(selectedTab: .constant(.notifications),

View File

@ -19,7 +19,9 @@ import SwiftUI
func preparePlayer(autoPlay: Bool, isCompact: Bool) { func preparePlayer(autoPlay: Bool, isCompact: Bool) {
player = .init(url: url) player = .init(url: url)
player?.audiovisualBackgroundPlaybackPolicy = .pauses player?.audiovisualBackgroundPlaybackPolicy = .pauses
#if !os(visionOS)
player?.preventsDisplaySleepDuringVideoPlayback = false player?.preventsDisplaySleepDuringVideoPlayback = false
#endif
if (autoPlay || forceAutoPlay) && !isCompact { if (autoPlay || forceAutoPlay) && !isCompact {
player?.play() player?.play()
isPlaying = true isPlaying = true

View File

@ -23,7 +23,6 @@ let package = Package(
.package(name: "Network", path: "../Network"), .package(name: "Network", path: "../Network"),
.package(name: "Env", path: "../Env"), .package(name: "Env", path: "../Env"),
.package(name: "DesignSystem", path: "../DesignSystem"), .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"), .package(url: "https://github.com/nicklockwood/LRUCache", from: "1.0.4"),
], ],
targets: [ targets: [
@ -36,7 +35,6 @@ let package = Package(
.product(name: "Network", package: "Network"), .product(name: "Network", package: "Network"),
.product(name: "Env", package: "Env"), .product(name: "Env", package: "Env"),
.product(name: "DesignSystem", package: "DesignSystem"), .product(name: "DesignSystem", package: "DesignSystem"),
.product(name: "GiphyUISDK", package: "giphy-ios-sdk"),
.product(name: "LRUCache", package: "LRUCache"), .product(name: "LRUCache", package: "LRUCache"),
], ],
swiftSettings: [ swiftSettings: [

View File

@ -1,6 +1,6 @@
import DesignSystem import DesignSystem
import Env import Env
#if !os(visionOS) #if !os(visionOS) && !DEBUG
import GiphyUISDK import GiphyUISDK
#endif #endif
import Models import Models
@ -124,7 +124,7 @@ extension StatusEditor {
.background(.black) .background(.black)
}) })
.sheet(isPresented: $isGIFPickerPresented, content: { .sheet(isPresented: $isGIFPickerPresented, content: {
#if !os(visionOS) #if !os(visionOS) && !DEBUG
#if targetEnvironment(macCatalyst) #if targetEnvironment(macCatalyst)
NavigationStack { NavigationStack {
giphyView giphyView
@ -213,7 +213,7 @@ extension StatusEditor {
return false return false
} }
#if !os(visionOS) #if !os(visionOS) && !DEBUG
@ViewBuilder @ViewBuilder
private var giphyView: some View { private var giphyView: some View {
@Bindable var viewModel = focusedSEVM @Bindable var viewModel = focusedSEVM

View File

@ -1,4 +1,4 @@
#if !os(visionOS) #if !os(visionOS) && !DEBUG
import DesignSystem import DesignSystem
import GiphyUISDK import GiphyUISDK
import SwiftUI import SwiftUI