Opening videos by URL and local files

This commit is contained in:
Arkadiusz Fal
2022-11-10 18:11:28 +01:00
parent 34f7621f36
commit 402d1a2f79
40 changed files with 1158 additions and 126 deletions

View File

@@ -6,13 +6,13 @@ import SwiftUI
struct AppSidebarNavigation: View {
@EnvironmentObject<AccountsModel> private var accounts
@EnvironmentObject<NavigationModel> private var navigation
#if os(iOS)
@State private var didApplyPrimaryViewWorkAround = false
@EnvironmentObject<CommentsModel> private var comments
@EnvironmentObject<InstancesModel> private var instances
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<PlayerModel> private var player
@EnvironmentObject<PlaylistsModel> private var playlists
@EnvironmentObject<RecentsModel> private var recents
@@ -74,7 +74,15 @@ struct AppSidebarNavigation: View {
}
#endif
ToolbarItem(placement: accountsMenuToolbarItemPlacement) {
ToolbarItemGroup(placement: openVideosToolbarItemPlacement) {
Button {
navigation.presentingOpenVideos = true
} label: {
Label("Open Videos", systemImage: "play.circle.fill")
}
}
ToolbarItemGroup(placement: accountsMenuToolbarItemPlacement) {
AccountsMenuView()
.help(
"Switch Instances and Accounts\n" +
@@ -96,6 +104,14 @@ struct AppSidebarNavigation: View {
}
}
var openVideosToolbarItemPlacement: ToolbarItemPlacement {
#if os(iOS)
return .navigationBarLeading
#else
return .automatic
#endif
}
var accountsMenuToolbarItemPlacement: ToolbarItemPlacement {
#if os(iOS)
return .bottomBar

View File

@@ -139,6 +139,9 @@ struct AppTabNavigation: View {
}
ToolbarItemGroup(placement: .navigationBarTrailing) {
Button(action: { navigation.presentingOpenVideos = true }) {
Label("Open Videos", systemImage: "play.circle.fill")
}
AccountsMenuView()
}
}

View File

@@ -119,6 +119,11 @@ struct ContentView: View {
}
)
#endif
.background(
EmptyView().sheet(isPresented: $navigation.presentingOpenVideos) {
OpenVideosView()
}
)
.background(playerViewInitialize)
.alert(isPresented: $navigation.presentingAlert) { navigation.alert }
}