mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Favorites improvements
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -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)\""
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user