forked from shadowfacts/Tusker
Remove old code
This commit is contained in:
parent
fa1482a152
commit
dc1eb3d6f0
|
@ -32,19 +32,6 @@ class LocalData: ObservableObject {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
defaults = UserDefaults(suiteName: "group.space.vaccor.Tusker")!
|
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,20 +61,8 @@ class Draft: Codable, ObservableObject {
|
||||||
|
|
||||||
self.accountID = try container.decode(String.self, forKey: .accountID)
|
self.accountID = try container.decode(String.self, forKey: .accountID)
|
||||||
self.text = try container.decode(String.self, forKey: .text)
|
self.text = try container.decode(String.self, forKey: .text)
|
||||||
if let enabled = try? container.decode(Bool.self, forKey: .contentWarningEnabled) {
|
self.contentWarningEnabled = try container.decode(Bool.self, forKey: .contentWarningEnabled)
|
||||||
self.contentWarningEnabled = enabled
|
self.contentWarning = try container.decode(String.self, forKey: .contentWarning)
|
||||||
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.attachments = try container.decode([CompositionAttachment].self, forKey: .attachments)
|
self.attachments = try container.decode([CompositionAttachment].self, forKey: .attachments)
|
||||||
self.inReplyToID = try container.decode(String?.self, forKey: .inReplyToID)
|
self.inReplyToID = try container.decode(String?.self, forKey: .inReplyToID)
|
||||||
self.visibility = try container.decode(Status.Visibility.self, forKey: .visibility)
|
self.visibility = try container.decode(Status.Visibility.self, forKey: .visibility)
|
||||||
|
|
Loading…
Reference in New Issue