mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add Welcome screen
This commit is contained in:
@@ -3,7 +3,6 @@ import SwiftUI
|
||||
|
||||
struct AccountsMenuView: View {
|
||||
@EnvironmentObject<AccountsModel> private var model
|
||||
@EnvironmentObject<InstancesModel> private var instancesModel
|
||||
|
||||
@Default(.instances) private var instances
|
||||
|
||||
|
@@ -37,7 +37,12 @@ struct AppSidebarNavigation: View {
|
||||
.toolbar { toolbarContent }
|
||||
.frame(minWidth: sidebarMinWidth)
|
||||
|
||||
Text("Select section")
|
||||
VStack {
|
||||
Image(systemName: "play.tv")
|
||||
.renderingMode(.original)
|
||||
.font(.system(size: 60))
|
||||
.foregroundColor(.accentColor)
|
||||
}
|
||||
}
|
||||
.environment(\.navigationStyle, .sidebar)
|
||||
}
|
||||
|
@@ -39,6 +39,11 @@ struct ContentView: View {
|
||||
.environmentObject(recents)
|
||||
.environmentObject(search)
|
||||
.environmentObject(subscriptions)
|
||||
.sheet(isPresented: $navigation.presentingWelcomeScreen) {
|
||||
WelcomeScreen()
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(navigation)
|
||||
}
|
||||
#if os(iOS)
|
||||
.fullScreenCover(isPresented: $player.presentingPlayer) {
|
||||
VideoPlayerView()
|
||||
@@ -68,8 +73,9 @@ struct ContentView: View {
|
||||
PlaylistFormView(playlist: $navigation.editedPlaylist)
|
||||
.environmentObject(playlists)
|
||||
}
|
||||
.sheet(isPresented: $navigation.presentingSettings) {
|
||||
.sheet(isPresented: $navigation.presentingSettings, onDismiss: openWelcomeScreenIfAccountEmpty) {
|
||||
SettingsView()
|
||||
.environmentObject(accounts)
|
||||
.environmentObject(instances)
|
||||
}
|
||||
#endif
|
||||
@@ -78,17 +84,29 @@ struct ContentView: View {
|
||||
func configure() {
|
||||
SiestaLog.Category.enabled = .common
|
||||
|
||||
// TODO: Remove when piped supports videos information
|
||||
if let account = instances.defaultAccount ??
|
||||
// TODO: Remove when piped supports videos information
|
||||
accounts.all.first(where: { $0.instance.app == .invidious })
|
||||
{
|
||||
accounts.setAccount(account)
|
||||
}
|
||||
|
||||
if accounts.account.isNil {
|
||||
navigation.presentingWelcomeScreen = true
|
||||
}
|
||||
player.accounts = accounts
|
||||
playlists.accounts = accounts
|
||||
search.accounts = accounts
|
||||
subscriptions.accounts = accounts
|
||||
}
|
||||
|
||||
func openWelcomeScreenIfAccountEmpty() {
|
||||
guard accounts.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
navigation.presentingWelcomeScreen = true
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
|
@@ -7,14 +7,16 @@ struct Sidebar: View {
|
||||
var body: some View {
|
||||
ScrollViewReader { scrollView in
|
||||
List {
|
||||
mainNavigationLinks
|
||||
if !accounts.isEmpty {
|
||||
mainNavigationLinks
|
||||
|
||||
AppSidebarRecents()
|
||||
.id("recentlyOpened")
|
||||
AppSidebarRecents()
|
||||
.id("recentlyOpened")
|
||||
|
||||
if accounts.signedIn {
|
||||
AppSidebarSubscriptions()
|
||||
AppSidebarPlaylists()
|
||||
if accounts.signedIn {
|
||||
AppSidebarSubscriptions()
|
||||
AppSidebarPlaylists()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onChange(of: navigation.sidebarSectionChanged) { _ in
|
||||
|
Reference in New Issue
Block a user