Open solkpolk opened 2 years ago
Hello @solkpolk ,
Thank you for the report. I'm looking into this and will keep you posted.
Hello @solkpolk
I've looked into the SDK and seems like it's how it was designed to work. If you want to decode a feed with multiple activity types, you can do so with a custom workaround, such as:
final class MixedActivity: EnrichedActivity<GetStream.User, String, DefaultReaction> {
var anyActivity: Activity?
var gossipActivity: GossipActivity?
required init(from decoder: Decoder) throws {
if let gossipActivity = try? GossipActivity(from: decoder) {
self.gossipActivity = gossipActivity
} else {
anyActivity = try Activity(from: decoder)
}
try super.init(from: decoder)
}
required public init(actor: ActorType, verb: Verb, object: ObjectType, foreignId: String? = nil, time: Date? = nil, feedIds: FeedIds? = nil, originFeedId: FeedId? = nil) {
fatalError("init(actor:verb:object:foreignId:time:feedIds:originFeedId:) has not been implemented")
}
}
you can then check which activity you were able to decode.
Does this make sense?
Adding custom activities in a feed causes a parsing error unless the entire feed contains the same activities
This is dangerous because if one activity does not confirm to
GossipActivity
then the entire feed disappears.