Browse Source

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.
simple-swift-promises
Shadowfacts 2 months ago
parent
commit
79f44c9b58
Signed by: Shadowfacts <me@shadowfacts.net> GPG Key ID: 94A5AB95422746E5

+ 1
- 18
Pachyderm/Utilities/InstanceSelector.swift View File

@@ -51,7 +51,7 @@ public extension InstanceSelector {
51 51
         public let description: String
52 52
         public let proxiedThumbnailURL: URL
53 53
         public let language: String
54
-        public let category: Category
54
+        public let category: String
55 55
         
56 56
         enum CodingKeys: String, CodingKey {
57 57
             case domain
@@ -62,20 +62,3 @@ public extension InstanceSelector {
62 62
         }
63 63
     }
64 64
 }
65
-
66
-public extension InstanceSelector {
67
-    enum Category: String, Codable {
68
-        // source: https://source.joinmastodon.org/mastodon/joinmastodon/blob/master/src/Wizard.js#L108
69
-        case general
70
-        case regional
71
-        case art
72
-        case journalism
73
-        case activism
74
-        case lgbt
75
-        case games
76
-        case tech
77
-        case adult
78
-        case furry
79
-        case food
80
-    }
81
-}

+ 1
- 1
Tusker/Views/Instance Cell/InstanceTableViewCell.swift View File

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

Loading…
Cancel
Save