diff --git a/IceCubesApp/App/Tabs/Timeline/TimelineTab.swift b/IceCubesApp/App/Tabs/Timeline/TimelineTab.swift index 2b250dde..a101179a 100644 --- a/IceCubesApp/App/Tabs/Timeline/TimelineTab.swift +++ b/IceCubesApp/App/Tabs/Timeline/TimelineTab.swift @@ -28,9 +28,6 @@ struct TimelineTab: View { @Query(sort: \LocalTimeline.creationDate, order: .reverse) var localTimelines: [LocalTimeline] @Query(sort: \TagGroup.creationDate, order: .reverse) var tagGroups: [TagGroup] - @AppStorage("remote_local_timeline") var legacyLocalTimelines: [String] = [] - @AppStorage("tag_groups") var legacyTagGroups: [LegacyTagGroup] = [] - @AppStorage("last_timeline_filter") var lastTimelineFilter: TimelineFilter = .home private let canFilterTimeline: Bool @@ -56,8 +53,6 @@ struct TimelineTab: View { .id(client.id) } .onAppear { - migrateUserPreferencesTimeline() - migrateUserPreferencesTagGroups() routerPath.client = client if !didAppear, canFilterTimeline { didAppear = true @@ -257,18 +252,4 @@ struct TimelineTab: View { timeline = .federated } } - - func migrateUserPreferencesTimeline() { - for instance in legacyLocalTimelines { - context.insert(LocalTimeline(instance: instance)) - } - legacyLocalTimelines = [] - } - - func migrateUserPreferencesTagGroups() { - for group in legacyTagGroups { - context.insert(TagGroup(title: group.title, symbolName: group.sfSymbolName, tags: group.tags)) - } - legacyTagGroups = [] - } } diff --git a/Packages/AppAccount/Sources/AppAccount/AppAccount.swift b/Packages/AppAccount/Sources/AppAccount/AppAccount.swift index fd443d63..6c76a86d 100644 --- a/Packages/AppAccount/Sources/AppAccount/AppAccount.swift +++ b/Packages/AppAccount/Sources/AppAccount/AppAccount.swift @@ -24,7 +24,6 @@ public extension AppAccount { } static func retrieveAll() -> [AppAccount] { - migrateLegacyAccounts() let keychain = Self.keychain let decoder = JSONDecoder() let keys = keychain.allKeys @@ -40,19 +39,6 @@ public extension AppAccount { return accounts } - static func migrateLegacyAccounts() { - let keychain = KeychainSwift() - let decoder = JSONDecoder() - let keys = keychain.allKeys - for key in keys { - if let data = keychain.getData(key) { - if let account = try? decoder.decode(AppAccount.self, from: data) { - try? account.save() - } - } - } - } - static func deleteAll() { let keychain = Self.keychain let keys = keychain.allKeys diff --git a/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift b/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift index f0abe925..d79709bb 100644 --- a/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift +++ b/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift @@ -105,10 +105,11 @@ struct ConversationMessageView: View { Button { Task { do { - let status: Status = if isLiked { - try await client.post(endpoint: Statuses.unfavorite(id: message.id)) + let status: Status + if isLiked { + status = try await client.post(endpoint: Statuses.unfavorite(id: message.id)) } else { - try await client.post(endpoint: Statuses.favorite(id: message.id)) + status = try await client.post(endpoint: Statuses.favorite(id: message.id)) } withAnimation { isLiked = status.favourited == true @@ -121,10 +122,11 @@ struct ConversationMessageView: View { } Button { Task { do { - let status: Status = if isBookmarked { - try await client.post(endpoint: Statuses.unbookmark(id: message.id)) + let status: Status + if isBookmarked { + status = try await client.post(endpoint: Statuses.unbookmark(id: message.id)) } else { - try await client.post(endpoint: Statuses.bookmark(id: message.id)) + status = try await client.post(endpoint: Statuses.bookmark(id: message.id)) } withAnimation { isBookmarked = status.bookmarked == true diff --git a/Packages/Env/Sources/Env/UserPreferences.swift b/Packages/Env/Sources/Env/UserPreferences.swift index 518419f9..9c192e58 100644 --- a/Packages/Env/Sources/Env/UserPreferences.swift +++ b/Packages/Env/Sources/Env/UserPreferences.swift @@ -349,7 +349,7 @@ import SwiftUI } public var totalNotificationsCount: Int { - notificationsCount.compactMap(\.value).reduce(0, +) + notificationsCount.compactMap{ $0.value }.reduce(0, +) } public func reloadNotificationsCount(tokens: [OauthToken]) { diff --git a/Packages/Models/Sources/Models/SwiftData/TagGroup.swift b/Packages/Models/Sources/Models/SwiftData/TagGroup.swift index 50a02dba..022064b4 100644 --- a/Packages/Models/Sources/Models/SwiftData/TagGroup.swift +++ b/Packages/Models/Sources/Models/SwiftData/TagGroup.swift @@ -15,14 +15,3 @@ import SwiftUI creationDate = Date() } } - -public struct LegacyTagGroup: Codable, Equatable, Hashable { - public let title: String - public let sfSymbolName: String - public let main: String - public let additional: [String] - - public var tags: [String] { - [main] + additional - } -} diff --git a/Packages/Status/Sources/Status/Editor/Drafts/DraftsListView.swift b/Packages/Status/Sources/Status/Editor/Drafts/DraftsListView.swift index 60c1b650..725e1dd0 100644 --- a/Packages/Status/Sources/Status/Editor/Drafts/DraftsListView.swift +++ b/Packages/Status/Sources/Status/Editor/Drafts/DraftsListView.swift @@ -4,8 +4,6 @@ import SwiftData import SwiftUI struct DraftsListView: View { - @AppStorage("draft_posts") public var legacyDraftPosts: [String] = [] - @Environment(\.dismiss) private var dismiss @Environment(\.modelContext) private var context @@ -49,17 +47,6 @@ struct DraftsListView: View { .background(theme.secondaryBackgroundColor) .navigationTitle("status.editor.drafts.navigation-title") .navigationBarTitleDisplayMode(.inline) - .onAppear { - migrateUserPreferencesDraft() - } } } - - func migrateUserPreferencesDraft() { - for draft in legacyDraftPosts { - let newDraft = Draft(content: draft) - context.insert(newDraft) - } - legacyDraftPosts = [] - } }