Change recommended instance selector to store categories as strings

instead of enum

Additional categories can be added, which would cause a crash when
decoding.
As the category isn't used for anything, storing it as an enum value is
not necessary.
This commit is contained in:
Shadowfacts 2020-01-18 19:49:10 -05:00
parent 66fe861442
commit 08c84688cf
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 2 additions and 19 deletions

View File

@ -51,7 +51,7 @@ public extension InstanceSelector {
public let description: String
public let proxiedThumbnailURL: URL
public let language: String
public let category: Category
public let category: String
enum CodingKeys: String, CodingKey {
case domain
@ -62,20 +62,3 @@ public extension InstanceSelector {
}
}
}
public extension InstanceSelector {
enum Category: String, Codable {
// source: https://source.joinmastodon.org/mastodon/joinmastodon/blob/master/src/Wizard.js#L108
case general
case regional
case art
case journalism
case activism
case lgbt
case games
case tech
case adult
case furry
case food
}
}

View File

@ -36,7 +36,7 @@ class InstanceTableViewCell: UITableViewCell {
self.instance = nil
domainLabel.text = instance.domain
adultLabel.isHidden = instance.category != .adult
adultLabel.isHidden = instance.category != "adult"
descriptionTextView.setTextFromHtml(instance.description)
updateThumbnail(url: instance.proxiedThumbnailURL)
}