yattee/Model/Applications/VideosApp.swift

105 lines
1.9 KiB
Swift
Raw Permalink Normal View History

2021-10-20 22:21:50 +00:00
import Foundation
enum VideosApp: String, CaseIterable {
2022-12-11 15:00:20 +00:00
enum AppType: String {
case local
case youTube
case peerTube
}
2022-12-09 00:15:19 +00:00
case local
case invidious
case piped
case peerTube
2021-10-20 22:21:50 +00:00
var name: String {
2022-12-11 22:15:56 +00:00
switch self {
case .peerTube:
return "PeerTube"
default:
return rawValue.capitalized
}
2021-10-20 22:21:50 +00:00
}
2022-12-11 15:00:20 +00:00
var appType: AppType {
switch self {
case .local:
return .local
case .invidious:
return .youTube
case .piped:
return .youTube
case .peerTube:
return .peerTube
}
}
2021-10-20 22:21:50 +00:00
var supportsAccounts: Bool {
2022-12-09 00:15:19 +00:00
self != .local
}
2021-10-20 22:21:50 +00:00
var supportsPopular: Bool {
self == .invidious
}
var supportsSearchFilters: Bool {
self == .invidious
}
2022-12-09 00:15:19 +00:00
var supportsSearchSuggestions: Bool {
self != .peerTube
}
2021-10-20 22:21:50 +00:00
var supportsSubscriptions: Bool {
supportsAccounts
}
2022-12-10 02:01:59 +00:00
var paginatesSubscriptions: Bool {
self == .invidious
}
2021-10-20 22:21:50 +00:00
var supportsTrendingCategories: Bool {
self == .invidious
}
var supportsUserPlaylists: Bool {
2022-12-09 00:15:19 +00:00
self != .local
}
var userPlaylistsEndpointIncludesVideos: Bool {
2021-10-20 22:21:50 +00:00
self == .invidious
}
2021-10-27 21:11:38 +00:00
var userPlaylistsUseChannelPlaylistEndpoint: Bool {
self == .piped
}
var userPlaylistsHaveVisibility: Bool {
self == .invidious
}
var userPlaylistsAreEditable: Bool {
self == .invidious
}
2021-10-27 21:11:38 +00:00
var hasFrontendURL: Bool {
self == .piped
}
2021-12-04 19:35:41 +00:00
var searchUsesIndexedPages: Bool {
self == .invidious
}
2022-06-24 22:48:57 +00:00
var supportsOpeningChannelsByName: Bool {
self == .piped
}
var allowsDisablingVidoesProxying: Bool {
self == .invidious || self == .piped
}
2022-11-10 17:11:28 +00:00
var supportsOpeningVideosByID: Bool {
2022-12-09 00:15:19 +00:00
self != .local
2022-11-10 17:11:28 +00:00
}
2021-10-20 22:21:50 +00:00
}