Add Open URL and Remote Control as sidebar items

After disabling home shortcuts on tvOS, Open URL and Remote Control had
no entry point. Add them as configurable sidebar main items. Remote
Control defaults to visible on tvOS; Open URL defaults to hidden on all
platforms.
This commit is contained in:
Arkadiusz Fal
2026-04-15 06:09:32 +02:00
parent e141a168f0
commit d422bf13e5
5 changed files with 218 additions and 49 deletions

View File

@@ -15,6 +15,8 @@ enum SidebarItem: Hashable, Identifiable {
case sources
case settings
case nowPlaying
case openURL
case remoteControl
// MARK: - Dynamic Channel Items
case channel(channelID: String, name: String, source: ContentSource)
@@ -49,6 +51,10 @@ enum SidebarItem: Hashable, Identifiable {
return "settings"
case .nowPlaying:
return "now-playing"
case .openURL:
return "open-url"
case .remoteControl:
return "remote-control"
case .channel(let channelID, _, let source):
return "channel-\(source.provider)-\(channelID)"
case .playlist(let id, _):
@@ -84,6 +90,10 @@ enum SidebarItem: Hashable, Identifiable {
return String(localized: "tabs.settings")
case .nowPlaying:
return String(localized: "sidebar.nowPlaying")
case .openURL:
return String(localized: "sidebar.mainItem.openURL")
case .remoteControl:
return String(localized: "sidebar.mainItem.remoteControl")
case .channel(_, let name, _):
return name
case .playlist(_, let title):
@@ -117,6 +127,10 @@ enum SidebarItem: Hashable, Identifiable {
return "gear"
case .nowPlaying:
return "play.circle.fill"
case .openURL:
return "link"
case .remoteControl:
return "antenna.radiowaves.left.and.right"
case .channel:
return "person.circle"
case .playlist:
@@ -144,7 +158,7 @@ enum SidebarItem: Hashable, Identifiable {
/// Returns nil for items that are root views (home, search) which don't push.
func navigationDestination() -> NavigationDestination? {
switch self {
case .home, .search, .sources, .settings, .nowPlaying:
case .home, .search, .sources, .settings, .nowPlaying, .openURL, .remoteControl:
// These are root tabs, not push destinations
return nil
case .channel(let channelID, _, let source):
@@ -174,7 +188,7 @@ enum SidebarItem: Hashable, Identifiable {
/// Whether this is a fixed navigation item (always visible).
var isFixedNavigation: Bool {
switch self {
case .home, .search, .sources, .settings, .nowPlaying:
case .home, .search, .sources, .settings, .nowPlaying, .openURL, .remoteControl:
return true
default:
return false

View File

@@ -18,16 +18,19 @@ enum SidebarMainItem: String, CaseIterable, Codable, Identifiable, Sendable {
case channels
case sources
case settings
case openURL
case remoteControl
var id: String { rawValue }
/// Default order for sidebar main items.
static var defaultOrder: [SidebarMainItem] {
[.search, .home, .subscriptions, .bookmarks, .history, .channels, .sources, .downloads, .settings]
[.search, .home, .subscriptions, .bookmarks, .history, .channels, .sources, .openURL, .remoteControl, .downloads, .settings]
}
/// Default visibility (all visible except subscriptions and channels).
static var defaultVisibility: [SidebarMainItem: Bool] {
#if os(tvOS)
[
.search: true,
.home: true,
@@ -37,8 +40,25 @@ enum SidebarMainItem: String, CaseIterable, Codable, Identifiable, Sendable {
.downloads: true,
.channels: false,
.sources: true,
.settings: true
.settings: true,
.openURL: false,
.remoteControl: true
]
#else
[
.search: true,
.home: true,
.subscriptions: false,
.bookmarks: false,
.history: false,
.downloads: true,
.channels: false,
.sources: true,
.settings: true,
.openURL: false,
.remoteControl: false
]
#endif
}
/// SF Symbol icon name.
@@ -53,6 +73,8 @@ enum SidebarMainItem: String, CaseIterable, Codable, Identifiable, Sendable {
case .channels: "person.2"
case .sources: "server.rack"
case .settings: "gear"
case .openURL: "link"
case .remoteControl: "antenna.radiowaves.left.and.right"
}
}
@@ -68,6 +90,8 @@ enum SidebarMainItem: String, CaseIterable, Codable, Identifiable, Sendable {
case .channels: String(localized: "sidebar.mainItem.channels")
case .sources: String(localized: "sidebar.mainItem.sources")
case .settings: String(localized: "sidebar.mainItem.settings")
case .openURL: String(localized: "sidebar.mainItem.openURL")
case .remoteControl: String(localized: "sidebar.mainItem.remoteControl")
}
}
@@ -110,6 +134,8 @@ enum SidebarMainItem: String, CaseIterable, Codable, Identifiable, Sendable {
case .channels: return TabBarItem.channels.rawValue
case .sources: return TabBarItem.sources.rawValue
case .settings: return TabBarItem.settings.rawValue
case .openURL: return "open-url"
case .remoteControl: return "remote-control"
}
}
@@ -125,6 +151,8 @@ enum SidebarMainItem: String, CaseIterable, Codable, Identifiable, Sendable {
case .channels: return .manageChannels
case .sources: return .sources
case .settings: return .settings
case .openURL: return .openURL
case .remoteControl: return .remoteControl
}
}