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" : {
"comment" : "Tab bar item title for sources",
"localizations" : {

View File

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

View File

@@ -17,17 +17,18 @@ enum TabBarItem: String, CaseIterable, Codable, Identifiable, Sendable {
case downloads
case sources
case settings
case continueWatching
var id: String { rawValue }
/// Default order for tab bar items.
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).
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.
@@ -41,6 +42,7 @@ enum TabBarItem: String, CaseIterable, Codable, Identifiable, Sendable {
case .downloads: "arrow.down.circle"
case .sources: "server.rack"
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 .sources: String(localized: "tabBar.item.sources")
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 sourcesPath = NavigationPath()
@State private var settingsPath = NavigationPath()
@State private var continueWatchingPath = NavigationPath()
// Tab selection - using String to support both fixed and dynamic tabs
// Initial value is a placeholder; actual startup tab is applied in onAppear
@@ -241,6 +242,8 @@ struct CompactTabView: View {
sourcesPath.append(destination)
case TabBarItem.settings.rawValue:
settingsPath.append(destination)
case TabBarItem.continueWatching.rawValue:
continueWatchingPath.append(destination)
default:
homePath.append(destination)
}
@@ -291,6 +294,11 @@ struct CompactTabView: View {
SettingsView(showCloseButton: false)
.withNavigationDestinations()
}
case .continueWatching:
NavigationStack(path: $continueWatchingPath) {
ContinueWatchingView()
.withNavigationDestinations()
}
}
}
@@ -321,6 +329,8 @@ struct CompactTabView: View {
sourcesPath.append(destination)
case TabBarItem.settings.rawValue:
settingsPath.append(destination)
case TabBarItem.continueWatching.rawValue:
continueWatchingPath.append(destination)
default:
// Fallback to home
homePath.append(destination)