mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Localization and platform availability fixes
This commit is contained in:
parent
780b7ab130
commit
99769380fc
@ -3,8 +3,11 @@ import SwiftUI
|
|||||||
|
|
||||||
extension Backport where Content: View {
|
extension Backport where Content: View {
|
||||||
@ViewBuilder func listRowSeparator(_ visible: Bool) -> some View {
|
@ViewBuilder func listRowSeparator(_ visible: Bool) -> some View {
|
||||||
if #available(iOS 15, macOS 12, tvOS 15, *) {
|
if #available(iOS 15, macOS 13, *) {
|
||||||
content.listRowSeparator(visible ? .visible : .hidden)
|
content
|
||||||
|
#if !os(tvOS)
|
||||||
|
.listRowSeparator(visible ? .visible : .hidden)
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
content
|
content
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ struct HomeView: View {
|
|||||||
OpenVideosButton(text: "Settings", imageSystemName: "gear") {
|
OpenVideosButton(text: "Settings", imageSystemName: "gear") {
|
||||||
NavigationModel.shared.presentingSettings = true
|
NavigationModel.shared.presentingSettings = true
|
||||||
}
|
}
|
||||||
|
.frame(maxWidth: 600)
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -93,6 +94,7 @@ struct HomeView: View {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
if homeRecentDocumentsItems > 0 {
|
if homeRecentDocumentsItems > 0 {
|
||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
@ -115,6 +117,7 @@ struct HomeView: View {
|
|||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if homeHistoryItems > 0 {
|
if homeHistoryItems > 0 {
|
||||||
VStack {
|
VStack {
|
||||||
@ -140,8 +143,10 @@ struct HomeView: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
#if os(tvOS)
|
||||||
|
.padding(.trailing, 40)
|
||||||
|
#endif
|
||||||
|
|
||||||
HistoryView(limit: homeHistoryItems)
|
HistoryView(limit: homeHistoryItems)
|
||||||
.id(historyID)
|
.id(historyID)
|
||||||
|
@ -6,8 +6,10 @@ struct Sidebar: View {
|
|||||||
@EnvironmentObject<NavigationModel> private var navigation
|
@EnvironmentObject<NavigationModel> private var navigation
|
||||||
|
|
||||||
@Default(.showHome) private var showHome
|
@Default(.showHome) private var showHome
|
||||||
@Default(.showDocuments) private var showDocuments
|
|
||||||
@Default(.visibleSections) private var visibleSections
|
@Default(.visibleSections) private var visibleSections
|
||||||
|
#if os(iOS)
|
||||||
|
@Default(.showDocuments) private var showDocuments
|
||||||
|
#endif
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollViewReader { scrollView in
|
ScrollViewReader { scrollView in
|
||||||
|
@ -10,12 +10,12 @@ struct BrowsingSettings: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@Default(.homeRecentDocumentsItems) private var homeRecentDocumentsItems
|
@Default(.homeRecentDocumentsItems) private var homeRecentDocumentsItems
|
||||||
@Default(.lockPortraitWhenBrowsing) private var lockPortraitWhenBrowsing
|
@Default(.lockPortraitWhenBrowsing) private var lockPortraitWhenBrowsing
|
||||||
|
@Default(.showDocuments) private var showDocuments
|
||||||
#endif
|
#endif
|
||||||
@Default(.thumbnailsQuality) private var thumbnailsQuality
|
@Default(.thumbnailsQuality) private var thumbnailsQuality
|
||||||
@Default(.channelOnThumbnail) private var channelOnThumbnail
|
@Default(.channelOnThumbnail) private var channelOnThumbnail
|
||||||
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
||||||
@Default(.showHome) private var showHome
|
@Default(.showHome) private var showHome
|
||||||
@Default(.showDocuments) private var showDocuments
|
|
||||||
@Default(.showFavoritesInHome) private var showFavoritesInHome
|
@Default(.showFavoritesInHome) private var showFavoritesInHome
|
||||||
@Default(.showOpenActionsInHome) private var showOpenActionsInHome
|
@Default(.showOpenActionsInHome) private var showOpenActionsInHome
|
||||||
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
|
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
|
||||||
@ -59,7 +59,14 @@ struct BrowsingSettings: View {
|
|||||||
private var sections: some View {
|
private var sections: some View {
|
||||||
Group {
|
Group {
|
||||||
homeSettings
|
homeSettings
|
||||||
interfaceSettings
|
let interface = interfaceSettings
|
||||||
|
#if os(tvOS)
|
||||||
|
if !accounts.isEmpty {
|
||||||
|
interface
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
interface
|
||||||
|
#endif
|
||||||
if !accounts.isEmpty {
|
if !accounts.isEmpty {
|
||||||
thumbnailsSettings
|
thumbnailsSettings
|
||||||
visibleSectionsSettings
|
visibleSectionsSettings
|
||||||
@ -91,6 +98,7 @@ struct BrowsingSettings: View {
|
|||||||
}
|
}
|
||||||
.multilineTextAlignment(.trailing)
|
.multilineTextAlignment(.trailing)
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
HStack {
|
HStack {
|
||||||
Text("Recent Documents")
|
Text("Recent Documents")
|
||||||
TextField("Recent Documents", text: $homeRecentDocumentsItemsText)
|
TextField("Recent Documents", text: $homeRecentDocumentsItemsText)
|
||||||
@ -106,6 +114,7 @@ struct BrowsingSettings: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.multilineTextAlignment(.trailing)
|
.multilineTextAlignment(.trailing)
|
||||||
|
#endif
|
||||||
|
|
||||||
if !accounts.isEmpty {
|
if !accounts.isEmpty {
|
||||||
Toggle("Show Favorites", isOn: $showFavoritesInHome)
|
Toggle("Show Favorites", isOn: $showFavoritesInHome)
|
||||||
@ -115,7 +124,7 @@ struct BrowsingSettings: View {
|
|||||||
Button {
|
Button {
|
||||||
presentingEditFavoritesSheet = true
|
presentingEditFavoritesSheet = true
|
||||||
} label: {
|
} label: {
|
||||||
Text("Edit Favorites...")
|
Text("Edit Favorites…")
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $presentingEditFavoritesSheet) {
|
.sheet(isPresented: $presentingEditFavoritesSheet) {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
|
@ -104,18 +104,16 @@ struct EditFavorites: View {
|
|||||||
|
|
||||||
func label(_ item: FavoriteItem) -> String {
|
func label(_ item: FavoriteItem) -> String {
|
||||||
if case let .playlist(id) = item.section {
|
if case let .playlist(id) = item.section {
|
||||||
return playlistsModel.find(id: id)?.title ?? "Playlist"
|
return playlistsModel.find(id: id)?.title ?? "Playlist".localized()
|
||||||
}
|
}
|
||||||
|
|
||||||
return item.section.label
|
return item.section.label.localized()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct EditFavorites_Previews: PreviewProvider {
|
struct EditFavorites_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
// NavigationView {
|
|
||||||
EditFavorites()
|
EditFavorites()
|
||||||
// }
|
|
||||||
.injectFixtureEnvironmentObjects()
|
.injectFixtureEnvironmentObjects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,8 +124,9 @@ struct PlayerSettings: View {
|
|||||||
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
Section(header: SettingsHeader(text: "Video Details").padding(.bottom, videoDetailsHeaderPadding)) {
|
Section(header: SettingsHeader(text: "Video Details").padding(.bottom, videoDetailsHeaderPadding)) {
|
||||||
SettingsHeader(text: "Buttons labels".localized(), secondary: true)
|
SettingsHeader(text: "Actions buttons".localized(), secondary: true)
|
||||||
playerActionsButtonLabelStylePicker
|
playerActionsButtonLabelStylePicker
|
||||||
|
SettingsHeader(text: "Pages buttons".localized(), secondary: true)
|
||||||
detailsButtonLabelStylePicker
|
detailsButtonLabelStylePicker
|
||||||
|
|
||||||
SettingsHeader(text: "Show Inspector".localized(), secondary: true)
|
SettingsHeader(text: "Show Inspector".localized(), secondary: true)
|
||||||
|
@ -223,7 +223,7 @@ struct SettingsView: View {
|
|||||||
case .browsing:
|
case .browsing:
|
||||||
return 580
|
return 580
|
||||||
case .player:
|
case .player:
|
||||||
return 850
|
return 900
|
||||||
case .quality:
|
case .quality:
|
||||||
return 420
|
return 420
|
||||||
case .history:
|
case .history:
|
||||||
@ -235,7 +235,7 @@ struct SettingsView: View {
|
|||||||
case .advanced:
|
case .advanced:
|
||||||
return 250
|
return 250
|
||||||
case .help:
|
case .help:
|
||||||
return 580
|
return 650
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user