From ef7a486fd4cb190e56081fae9b36216cec5e18d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Wed, 1 May 2024 14:30:19 +0200 Subject: [PATCH] add migration for old profiles to new format --- Shared/YatteeApp.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Shared/YatteeApp.swift b/Shared/YatteeApp.swift index 110d638e..b0097a05 100644 --- a/Shared/YatteeApp.swift +++ b/Shared/YatteeApp.swift @@ -204,6 +204,7 @@ struct YatteeApp: App { URLBookmarkModel.shared.refreshAll() migrateHomeHistoryItems() + migrateQualityProfiles() } func migrateHomeHistoryItems() { @@ -221,6 +222,16 @@ struct YatteeApp: App { Defaults[.homeHistoryItems] = -1 } + @Default(.qualityProfiles) private var qualityProfilesData + + func migrateQualityProfiles() { + for profile in qualityProfilesData where profile.order.isEmpty { + var updatedProfile = profile + updatedProfile.order = Array(QualityProfile.Format.allCases.indices) + QualityProfilesModel.shared.update(profile, updatedProfile) + } + } + var navigationStyle: NavigationStyle { #if os(iOS) return horizontalSizeClass == .compact ? .tab : .sidebar