Localization and platform availability fixes

This commit is contained in:
Arkadiusz Fal
2022-11-19 00:38:32 +01:00
parent 780b7ab130
commit 99769380fc
7 changed files with 64 additions and 46 deletions

View File

@@ -10,12 +10,12 @@ struct BrowsingSettings: View {
#if os(iOS)
@Default(.homeRecentDocumentsItems) private var homeRecentDocumentsItems
@Default(.lockPortraitWhenBrowsing) private var lockPortraitWhenBrowsing
@Default(.showDocuments) private var showDocuments
#endif
@Default(.thumbnailsQuality) private var thumbnailsQuality
@Default(.channelOnThumbnail) private var channelOnThumbnail
@Default(.timeOnThumbnail) private var timeOnThumbnail
@Default(.showHome) private var showHome
@Default(.showDocuments) private var showDocuments
@Default(.showFavoritesInHome) private var showFavoritesInHome
@Default(.showOpenActionsInHome) private var showOpenActionsInHome
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
@@ -59,7 +59,14 @@ struct BrowsingSettings: View {
private var sections: some View {
Group {
homeSettings
interfaceSettings
let interface = interfaceSettings
#if os(tvOS)
if !accounts.isEmpty {
interface
}
#else
interface
#endif
if !accounts.isEmpty {
thumbnailsSettings
visibleSectionsSettings
@@ -91,21 +98,23 @@ struct BrowsingSettings: View {
}
.multilineTextAlignment(.trailing)
HStack {
Text("Recent Documents")
TextField("Recent Documents", text: $homeRecentDocumentsItemsText)
.labelsHidden()
#if !os(macOS)
.keyboardType(.numberPad)
#endif
.onAppear {
homeRecentDocumentsItemsText = String(homeRecentDocumentsItems)
}
.onChange(of: homeRecentDocumentsItemsText) { newValue in
homeRecentDocumentsItems = Int(newValue) ?? 3
}
}
.multilineTextAlignment(.trailing)
#if os(iOS)
HStack {
Text("Recent Documents")
TextField("Recent Documents", text: $homeRecentDocumentsItemsText)
.labelsHidden()
#if !os(macOS)
.keyboardType(.numberPad)
#endif
.onAppear {
homeRecentDocumentsItemsText = String(homeRecentDocumentsItems)
}
.onChange(of: homeRecentDocumentsItemsText) { newValue in
homeRecentDocumentsItems = Int(newValue) ?? 3
}
}
.multilineTextAlignment(.trailing)
#endif
if !accounts.isEmpty {
Toggle("Show Favorites", isOn: $showFavoritesInHome)
@@ -115,7 +124,7 @@ struct BrowsingSettings: View {
Button {
presentingEditFavoritesSheet = true
} label: {
Text("Edit Favorites...")
Text("Edit Favorites")
}
.sheet(isPresented: $presentingEditFavoritesSheet) {
VStack(alignment: .leading) {

View File

@@ -104,18 +104,16 @@ struct EditFavorites: View {
func label(_ item: FavoriteItem) -> String {
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 {
static var previews: some View {
// NavigationView {
EditFavorites()
// }
.injectFixtureEnvironmentObjects()
}
}

View File

@@ -124,8 +124,9 @@ struct PlayerSettings: View {
#if !os(tvOS)
Section(header: SettingsHeader(text: "Video Details").padding(.bottom, videoDetailsHeaderPadding)) {
SettingsHeader(text: "Buttons labels".localized(), secondary: true)
SettingsHeader(text: "Actions buttons".localized(), secondary: true)
playerActionsButtonLabelStylePicker
SettingsHeader(text: "Pages buttons".localized(), secondary: true)
detailsButtonLabelStylePicker
SettingsHeader(text: "Show Inspector".localized(), secondary: true)

View File

@@ -223,7 +223,7 @@ struct SettingsView: View {
case .browsing:
return 580
case .player:
return 850
return 900
case .quality:
return 420
case .history:
@@ -235,7 +235,7 @@ struct SettingsView: View {
case .advanced:
return 250
case .help:
return 580
return 650
}
}
#endif