this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

notification support

+32 -2
+32 -2
Sources/bskyKit/Models/Notifications.swift
··· 41 41 } 42 42 43 43 /// Reason for a notification 44 - public enum NotificationReason: String, Codable, Sendable { 44 + public enum NotificationReason: Codable, Sendable, Equatable, Hashable { 45 45 case like 46 46 case repost 47 47 case follow 48 48 case mention 49 49 case reply 50 50 case quote 51 - case starterpackJoined = "starterpack-joined" 51 + case starterpackJoined 52 + case unknown(String) 53 + 54 + public init(from decoder: Decoder) throws { 55 + let container = try decoder.singleValueContainer() 56 + let value = try container.decode(String.self) 57 + switch value { 58 + case "like": self = .like 59 + case "repost": self = .repost 60 + case "follow": self = .follow 61 + case "mention": self = .mention 62 + case "reply": self = .reply 63 + case "quote": self = .quote 64 + case "starterpack-joined": self = .starterpackJoined 65 + default: self = .unknown(value) 66 + } 67 + } 68 + 69 + public func encode(to encoder: Encoder) throws { 70 + var container = encoder.singleValueContainer() 71 + switch self { 72 + case .like: try container.encode("like") 73 + case .repost: try container.encode("repost") 74 + case .follow: try container.encode("follow") 75 + case .mention: try container.encode("mention") 76 + case .reply: try container.encode("reply") 77 + case .quote: try container.encode("quote") 78 + case .starterpackJoined: try container.encode("starterpack-joined") 79 + case .unknown(let value): try container.encode(value) 80 + } 81 + } 52 82 } 53 83 54 84 /// Record attached to notification (simplified)