From dc1eb3d6f0b8628db416ce0a6909618e9afad5e4 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 21 Jan 2022 11:12:30 -0500 Subject: [PATCH] Remove old code --- Tusker/LocalData.swift | 13 ------------- Tusker/Models/Draft.swift | 16 ++-------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/Tusker/LocalData.swift b/Tusker/LocalData.swift index 2c70a68a6f..020c58840d 100644 --- a/Tusker/LocalData.swift +++ b/Tusker/LocalData.swift @@ -32,19 +32,6 @@ class LocalData: ObservableObject { } } else { defaults = UserDefaults(suiteName: "group.space.vaccor.Tusker")! - tryMigrateOldDefaults() - } - } - - // TODO: remove me before public beta - private func tryMigrateOldDefaults() { - let old = UserDefaults() - if let accounts = old.array(forKey: accountsKey) as? [[String: String]], - let mostRecentAccount = old.string(forKey: mostRecentAccountKey) { - defaults.setValue(accounts, forKey: accountsKey) - defaults.setValue(mostRecentAccount, forKey: mostRecentAccountKey) - old.removeObject(forKey: accountsKey) - old.removeObject(forKey: mostRecentAccountKey) } } diff --git a/Tusker/Models/Draft.swift b/Tusker/Models/Draft.swift index 523737bfb2..9db9d01232 100644 --- a/Tusker/Models/Draft.swift +++ b/Tusker/Models/Draft.swift @@ -61,20 +61,8 @@ class Draft: Codable, ObservableObject { self.accountID = try container.decode(String.self, forKey: .accountID) self.text = try container.decode(String.self, forKey: .text) - if let enabled = try? container.decode(Bool.self, forKey: .contentWarningEnabled) { - self.contentWarningEnabled = enabled - self.contentWarning = try container.decode(String.self, forKey: .contentWarning) - } else { - // todo: temporary until migration away from old drafts manager is complete - let cw = try container.decode(String?.self, forKey: .contentWarning) - if let cw = cw { - self.contentWarningEnabled = !cw.isEmpty - self.contentWarning = cw - } else { - self.contentWarningEnabled = false - self.contentWarning = "" - } - } + self.contentWarningEnabled = try container.decode(Bool.self, forKey: .contentWarningEnabled) + self.contentWarning = try container.decode(String.self, forKey: .contentWarning) self.attachments = try container.decode([CompositionAttachment].self, forKey: .attachments) self.inReplyToID = try container.decode(String?.self, forKey: .inReplyToID) self.visibility = try container.decode(Status.Visibility.self, forKey: .visibility)