mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add default profiles and option to reset to defaults
This commit is contained in:
@@ -4,7 +4,6 @@ import Foundation
|
||||
struct QualityProfile: Hashable, Identifiable, Defaults.Serializable {
|
||||
static var bridge = QualityProfileBridge()
|
||||
static var defaultProfile = Self(id: "default", backend: .mpv, resolution: .hd720p60, formats: [.stream])
|
||||
static var highQualityProfile = Self(id: "highQuality", backend: .mpv, resolution: .hd2160p60, formats: [.webm, .mp4, .av1, .avc1])
|
||||
|
||||
enum Format: String, CaseIterable, Identifiable, Defaults.Serializable {
|
||||
case hls
|
||||
|
@@ -15,11 +15,7 @@ struct QualityProfilesModel {
|
||||
#endif
|
||||
|
||||
func find(_ id: QualityProfile.ID) -> QualityProfile? {
|
||||
if id == "default" {
|
||||
return QualityProfile.defaultProfile
|
||||
} else if id == "highQuality" {
|
||||
return QualityProfile.highQualityProfile
|
||||
}
|
||||
guard id != "default" else { return QualityProfile.defaultProfile }
|
||||
|
||||
return Defaults[.qualityProfiles].first { $0.id == id }
|
||||
}
|
||||
@@ -47,6 +43,14 @@ struct QualityProfilesModel {
|
||||
Defaults[.chargingNonCellularProfile] = qualityProfile.id
|
||||
}
|
||||
|
||||
func reset() {
|
||||
Defaults.reset(.qualityProfiles)
|
||||
Defaults.reset(.batteryCellularProfile)
|
||||
Defaults.reset(.batteryNonCellularProfile)
|
||||
Defaults.reset(.chargingCellularProfile)
|
||||
Defaults.reset(.chargingNonCellularProfile)
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
private func findCurrentConnection() -> Reachability.Connection? {
|
||||
do {
|
||||
|
Reference in New Issue
Block a user