Add Continue Watching toggle to tab bar settings

Exposes ContinueWatchingView as an opt-in compact tab bar item,
hidden by default. Uses a short "Continue" label since the full
"Continue Watching" string does not fit as a tab bar title.
This commit is contained in:
Arkadiusz Fal
2026-04-17 21:52:10 +02:00
parent 096df34f64
commit 13ade8aad3
4 changed files with 27 additions and 2 deletions

View File

@@ -16712,6 +16712,17 @@
} }
} }
}, },
"tabBar.item.continueWatching" : {
"comment" : "Tab bar item title for continue watching (short title)",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Continue"
}
}
}
},
"tabBar.item.sources" : { "tabBar.item.sources" : {
"comment" : "Tab bar item title for sources", "comment" : "Tab bar item title for sources",
"localizations" : { "localizations" : {

View File

@@ -181,6 +181,7 @@ enum SidebarMainItem: String, CaseIterable, Codable, Identifiable, Sendable {
case .downloads: self = .downloads case .downloads: self = .downloads
case .sources: self = .sources case .sources: self = .sources
case .settings: self = .settings case .settings: self = .settings
case .continueWatching: self = .continueWatching
} }
} }
} }

View File

@@ -17,17 +17,18 @@ enum TabBarItem: String, CaseIterable, Codable, Identifiable, Sendable {
case downloads case downloads
case sources case sources
case settings case settings
case continueWatching
var id: String { rawValue } var id: String { rawValue }
/// Default order for tab bar items. /// Default order for tab bar items.
static var defaultOrder: [TabBarItem] { static var defaultOrder: [TabBarItem] {
[.subscriptions, .channels, .bookmarks, .playlists, .history, .sources, .downloads, .settings] [.subscriptions, .channels, .bookmarks, .playlists, .history, .continueWatching, .sources, .downloads, .settings]
} }
/// Default visibility (only subscriptions visible by default). /// Default visibility (only subscriptions visible by default).
static var defaultVisibility: [TabBarItem: Bool] { static var defaultVisibility: [TabBarItem: Bool] {
[.subscriptions: false, .channels: false, .bookmarks: false, .playlists: false, .history: false, .downloads: true, .sources: true, .settings: false] [.subscriptions: false, .channels: false, .bookmarks: false, .playlists: false, .history: false, .downloads: true, .sources: true, .settings: false, .continueWatching: false]
} }
/// SF Symbol icon name. /// SF Symbol icon name.
@@ -41,6 +42,7 @@ enum TabBarItem: String, CaseIterable, Codable, Identifiable, Sendable {
case .downloads: "arrow.down.circle" case .downloads: "arrow.down.circle"
case .sources: "server.rack" case .sources: "server.rack"
case .settings: "gear" case .settings: "gear"
case .continueWatching: "play.circle"
} }
} }
@@ -55,6 +57,7 @@ enum TabBarItem: String, CaseIterable, Codable, Identifiable, Sendable {
case .downloads: String(localized: "tabBar.item.downloads") case .downloads: String(localized: "tabBar.item.downloads")
case .sources: String(localized: "tabBar.item.sources") case .sources: String(localized: "tabBar.item.sources")
case .settings: String(localized: "tabBar.item.settings") case .settings: String(localized: "tabBar.item.settings")
case .continueWatching: String(localized: "tabBar.item.continueWatching")
} }
} }
} }

View File

@@ -25,6 +25,7 @@ struct CompactTabView: View {
@State private var downloadsPath = NavigationPath() @State private var downloadsPath = NavigationPath()
@State private var sourcesPath = NavigationPath() @State private var sourcesPath = NavigationPath()
@State private var settingsPath = NavigationPath() @State private var settingsPath = NavigationPath()
@State private var continueWatchingPath = NavigationPath()
// Tab selection - using String to support both fixed and dynamic tabs // Tab selection - using String to support both fixed and dynamic tabs
// Initial value is a placeholder; actual startup tab is applied in onAppear // Initial value is a placeholder; actual startup tab is applied in onAppear
@@ -241,6 +242,8 @@ struct CompactTabView: View {
sourcesPath.append(destination) sourcesPath.append(destination)
case TabBarItem.settings.rawValue: case TabBarItem.settings.rawValue:
settingsPath.append(destination) settingsPath.append(destination)
case TabBarItem.continueWatching.rawValue:
continueWatchingPath.append(destination)
default: default:
homePath.append(destination) homePath.append(destination)
} }
@@ -291,6 +294,11 @@ struct CompactTabView: View {
SettingsView(showCloseButton: false) SettingsView(showCloseButton: false)
.withNavigationDestinations() .withNavigationDestinations()
} }
case .continueWatching:
NavigationStack(path: $continueWatchingPath) {
ContinueWatchingView()
.withNavigationDestinations()
}
} }
} }
@@ -321,6 +329,8 @@ struct CompactTabView: View {
sourcesPath.append(destination) sourcesPath.append(destination)
case TabBarItem.settings.rawValue: case TabBarItem.settings.rawValue:
settingsPath.append(destination) settingsPath.append(destination)
case TabBarItem.continueWatching.rawValue:
continueWatchingPath.append(destination)
default: default:
// Fallback to home // Fallback to home
homePath.append(destination) homePath.append(destination)