From a848d988bdc4ce7a51e880f6e5e01f16f1450a12 Mon Sep 17 00:00:00 2001 From: Sjmarf <78750526+Sjmarf@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:57:58 +0000 Subject: [PATCH] Fix top 3/6/9 month sort modes (#774) --- Mlem/Enums/Settings/PostSortType.swift | 26 +++++++++++++------------- Mlem/Views/Tabs/Feeds/Feed View.swift | 5 +++++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Mlem/Enums/Settings/PostSortType.swift b/Mlem/Enums/Settings/PostSortType.swift index ac52955d7..ce0cec387 100644 --- a/Mlem/Enums/Settings/PostSortType.swift +++ b/Mlem/Enums/Settings/PostSortType.swift @@ -25,9 +25,9 @@ enum PostSortType: String, Codable, CaseIterable, Identifiable { case topDay = "TopDay" case topWeek = "TopWeek" case topMonth = "TopMonth" - case topThreeMonth = "TopThreeMonth" - case topSixMonth = "TopSixMonth" - case topNineMonth = "TopNineMonth" + case topThreeMonths = "TopThreeMonths" + case topSixMonths = "TopSixMonths" + case topNineMonths = "TopNineMonths" case topYear = "TopYear" case topAll = "TopAll" @@ -51,9 +51,9 @@ enum PostSortType: String, Codable, CaseIterable, Identifiable { .topDay, .topWeek, .topMonth, - .topThreeMonth, - .topSixMonth, - .topNineMonth, + .topThreeMonths, + .topSixMonths, + .topNineMonths, .topYear, .topAll ] } @@ -73,7 +73,7 @@ enum PostSortType: String, Codable, CaseIterable, Identifiable { switch self { case .controversial, .scaled: return .init("0.19.0") - case .topThreeMonth, .topSixMonth, .topNineMonth: + case .topThreeMonths, .topSixMonths, .topNineMonths: return .init("0.18.1") default: return .zero @@ -94,11 +94,11 @@ enum PostSortType: String, Codable, CaseIterable, Identifiable { return "Top of the week" case .topMonth: return "Top of the month" - case .topThreeMonth: + case .topThreeMonths: return "Top of the last 3 months" - case .topSixMonth: + case .topSixMonths: return "Top of the last 6 months" - case .topNineMonth: + case .topNineMonths: return "Top of the last 9 months" case .topYear: return "Top of the year" @@ -129,11 +129,11 @@ extension PostSortType: SettingsOptions { return "Week" case .topMonth: return "Month" - case .topThreeMonth: + case .topThreeMonths: return "3 Months" - case .topSixMonth: + case .topSixMonths: return "6 Months" - case .topNineMonth: + case .topNineMonths: return "9 Months" case .topYear: return "Year" diff --git a/Mlem/Views/Tabs/Feeds/Feed View.swift b/Mlem/Views/Tabs/Feeds/Feed View.swift index c3e3e052b..cbb20e607 100644 --- a/Mlem/Views/Tabs/Feeds/Feed View.swift +++ b/Mlem/Views/Tabs/Feeds/Feed View.swift @@ -140,6 +140,11 @@ struct FeedView: View { shouldLoad = false } } + .onChange(of: postTracker.items) { newValue in + if !newValue.isEmpty { + errorDetails = nil + } + } .refreshable { await refreshFeed() }