mirror of
https://github.com/yattee/yattee.git
synced 2025-04-28 16:00:33 +05:30
Fix sheets and covers on iOS 14
This commit is contained in:
parent
5ef89ac9f4
commit
b5ffa5b267
@ -24,7 +24,7 @@ struct ContentView: View {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Section {
|
Group {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
if horizontalSizeClass == .compact {
|
if horizontalSizeClass == .compact {
|
||||||
AppTabNavigation()
|
AppTabNavigation()
|
||||||
@ -49,55 +49,66 @@ struct ContentView: View {
|
|||||||
.environmentObject(subscriptions)
|
.environmentObject(subscriptions)
|
||||||
.environmentObject(thumbnailsModel)
|
.environmentObject(thumbnailsModel)
|
||||||
|
|
||||||
.sheet(isPresented: $navigation.presentingWelcomeScreen) {
|
// iOS 14 has problem with multiple sheets in one view
|
||||||
|
// but it's ok when it's in background
|
||||||
|
.background(
|
||||||
|
EmptyView().sheet(isPresented: $navigation.presentingWelcomeScreen) {
|
||||||
WelcomeScreen()
|
WelcomeScreen()
|
||||||
.environmentObject(accounts)
|
.environmentObject(accounts)
|
||||||
.environmentObject(navigation)
|
.environmentObject(navigation)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.fullScreenCover(isPresented: $player.presentingPlayer) {
|
.background(
|
||||||
VideoPlayerView()
|
EmptyView().fullScreenCover(isPresented: $player.presentingPlayer) {
|
||||||
.environmentObject(accounts)
|
videoPlayer
|
||||||
.environmentObject(instances)
|
|
||||||
.environmentObject(navigation)
|
|
||||||
.environmentObject(player)
|
|
||||||
.environmentObject(playlists)
|
|
||||||
.environmentObject(subscriptions)
|
|
||||||
.environmentObject(thumbnailsModel)
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
#elseif os(macOS)
|
#elseif os(macOS)
|
||||||
.sheet(isPresented: $player.presentingPlayer) {
|
.background(
|
||||||
VideoPlayerView()
|
EmptyView().sheet(isPresented: $player.presentingPlayer) {
|
||||||
|
videoPlayer
|
||||||
.frame(minWidth: 900, minHeight: 800)
|
.frame(minWidth: 900, minHeight: 800)
|
||||||
.environmentObject(accounts)
|
|
||||||
.environmentObject(instances)
|
|
||||||
.environmentObject(navigation)
|
|
||||||
.environmentObject(player)
|
|
||||||
.environmentObject(playlists)
|
|
||||||
.environmentObject(subscriptions)
|
|
||||||
.environmentObject(thumbnailsModel)
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
#endif
|
#endif
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
.handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"]))
|
.handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"]))
|
||||||
.onOpenURL(perform: handleOpenedURL)
|
.onOpenURL(perform: handleOpenedURL)
|
||||||
.sheet(isPresented: $navigation.presentingAddToPlaylist) {
|
.background(
|
||||||
|
EmptyView().sheet(isPresented: $navigation.presentingAddToPlaylist) {
|
||||||
AddToPlaylistView(video: navigation.videoToAddToPlaylist)
|
AddToPlaylistView(video: navigation.videoToAddToPlaylist)
|
||||||
.environmentObject(playlists)
|
.environmentObject(playlists)
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $navigation.presentingPlaylistForm) {
|
)
|
||||||
|
.background(
|
||||||
|
EmptyView().sheet(isPresented: $navigation.presentingPlaylistForm) {
|
||||||
PlaylistFormView(playlist: $navigation.editedPlaylist)
|
PlaylistFormView(playlist: $navigation.editedPlaylist)
|
||||||
.environmentObject(accounts)
|
.environmentObject(accounts)
|
||||||
.environmentObject(playlists)
|
.environmentObject(playlists)
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $navigation.presentingSettings, onDismiss: openWelcomeScreenIfAccountEmpty) {
|
)
|
||||||
|
.background(
|
||||||
|
EmptyView().sheet(isPresented: $navigation.presentingSettings, onDismiss: openWelcomeScreenIfAccountEmpty) {
|
||||||
SettingsView()
|
SettingsView()
|
||||||
.environmentObject(accounts)
|
.environmentObject(accounts)
|
||||||
.environmentObject(instances)
|
.environmentObject(instances)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var videoPlayer: some View {
|
||||||
|
VideoPlayerView()
|
||||||
|
.environmentObject(accounts)
|
||||||
|
.environmentObject(instances)
|
||||||
|
.environmentObject(navigation)
|
||||||
|
.environmentObject(player)
|
||||||
|
.environmentObject(playlists)
|
||||||
|
.environmentObject(subscriptions)
|
||||||
|
.environmentObject(thumbnailsModel)
|
||||||
|
}
|
||||||
|
|
||||||
func configure() {
|
func configure() {
|
||||||
SiestaLog.Category.enabled = .common
|
SiestaLog.Category.enabled = .common
|
||||||
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
|
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
|
||||||
|
@ -318,17 +318,21 @@ struct VideoDetails: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $presentingAddToPlaylist) {
|
.background(
|
||||||
|
EmptyView().sheet(isPresented: $presentingAddToPlaylist) {
|
||||||
if let video = video {
|
if let video = video {
|
||||||
AddToPlaylistView(video: video)
|
AddToPlaylistView(video: video)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
)
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.sheet(isPresented: $presentingShareSheet) {
|
.background(
|
||||||
|
EmptyView().sheet(isPresented: $presentingShareSheet) {
|
||||||
if let shareURL = shareURL {
|
if let shareURL = shareURL {
|
||||||
ShareSheet(activityItems: [shareURL])
|
ShareSheet(activityItems: [shareURL])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,14 +58,20 @@ struct PlaylistsView: View {
|
|||||||
.environmentObject(accounts)
|
.environmentObject(accounts)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
.background(
|
||||||
|
EmptyView()
|
||||||
.sheet(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
|
.sheet(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
|
||||||
PlaylistFormView(playlist: $createdPlaylist)
|
PlaylistFormView(playlist: $createdPlaylist)
|
||||||
.environmentObject(accounts)
|
.environmentObject(accounts)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
.background(
|
||||||
|
EmptyView()
|
||||||
.sheet(isPresented: $showingEditPlaylist, onDismiss: selectEditedPlaylist) {
|
.sheet(isPresented: $showingEditPlaylist, onDismiss: selectEditedPlaylist) {
|
||||||
PlaylistFormView(playlist: $editedPlaylist)
|
PlaylistFormView(playlist: $editedPlaylist)
|
||||||
.environmentObject(accounts)
|
.environmentObject(accounts)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
#endif
|
#endif
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItemGroup {
|
ToolbarItemGroup {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user