New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Channels not showing up when Message attachment has malformed data #834
Conversation
Codecov Report
@@ Coverage Diff @@
## main #834 +/- ##
==========================================
+ Coverage 86.70% 86.74% +0.03%
==========================================
Files 228 229 +1
Lines 8638 8641 +3
==========================================
+ Hits 7490 7496 +6
+ Misses 1148 1145 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a test for the new functionality. Thanks
7afa204
to
8ca74b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
8ca74b6
to
f14c1fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just nits
|
||
import Foundation | ||
|
||
struct OptionalDecodable<Base: Decodable>: Decodable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining what is this and why/when to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
attachments = try container.decode([AttachmentPayload].self, forKey: .attachments) | ||
attachments = try container.decode([OptionalDecodable<AttachmentPayload>].self, forKey: .attachments).compactMap(\.base) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining what is happening here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Sources/StreamChat/APIClient/Endpoints/Payloads/MessagePayloads_Tests.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the solution, pity that this isn't JSONDecoder's default behavior....
f14c1fb
to
900c74d
Compare
900c74d
to
4531da3
Compare
What this PR do:
How to test it