Favorites improvements

This commit is contained in:
Arkadiusz Fal
2022-12-11 16:00:20 +01:00
parent 784fc8cfc6
commit f6a261662c
9 changed files with 169 additions and 52 deletions

View File

@@ -1,6 +1,12 @@
import Foundation
enum VideosApp: String, CaseIterable {
enum AppType: String {
case local
case youTube
case peerTube
}
case local
case invidious
case piped
@@ -10,6 +16,19 @@ enum VideosApp: String, CaseIterable {
rawValue.capitalized
}
var appType: AppType {
switch self {
case .local:
return .local
case .invidious:
return .youTube
case .piped:
return .youTube
case .peerTube:
return .peerTube
}
}
var supportsAccounts: Bool {
self != .local
}

View File

@@ -6,9 +6,9 @@ struct FavoriteItem: Codable, Equatable, Identifiable, Defaults.Serializable {
case subscriptions
case popular
case trending(String, String?)
case channel(String, String)
case channel(String, String, String)
case playlist(String)
case channelPlaylist(String, String)
case channelPlaylist(String, String, String)
case searchQuery(String, String, String, String)
var label: String {
@@ -21,9 +21,9 @@ struct FavoriteItem: Codable, Equatable, Identifiable, Defaults.Serializable {
let trendingCountry = Country(rawValue: country)!
let trendingCategory = category.isNil ? nil : TrendingCategory(rawValue: category!)
return "\(trendingCountry.flag) \(trendingCountry.id) \(trendingCategory?.name ?? "Trending")"
case let .channel(_, name):
case let .channel(_, _, name):
return name
case let .channelPlaylist(_, name):
case let .channelPlaylist(_, _, name):
return name
case let .searchQuery(text, date, duration, order):
var label = "Search: \"\(text)\""

View File

@@ -237,6 +237,13 @@ final class NavigationModel: ObservableObject {
presentingAlert = true
}
func hideViewsAboveBrowser() {
player.hide()
presentingChannel = false
presentingPlaylist = false
presentingOpenVideos = false
}
func hideKeyboard() {
#if os(iOS)
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)