Skip to content
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

[CIS-661] Simplify attachment send API #815

Merged
merged 2 commits into from
Feb 12, 2021

Conversation

mantergo
Copy link
Contributor

In this PR:

  • Simplify attachment send API

@mantergo mantergo added the 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK label Feb 12, 2021
@mantergo mantergo changed the title Simplify attachment send API [CIS-661] Simplify attachment send API Feb 12, 2021
@codecov
Copy link

codecov bot commented Feb 12, 2021

Codecov Report

Merging #815 (7f6b8ca) into main (389a317) will decrease coverage by 0.85%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #815      +/-   ##
==========================================
- Coverage   87.55%   86.70%   -0.86%     
==========================================
  Files         230      228       -2     
  Lines        8826     8636     -190     
==========================================
- Hits         7728     7488     -240     
- Misses       1098     1148      +50     
Impacted Files Coverage Δ
...trollers/ChannelController/ChannelController.swift 91.21% <ø> (-0.03%) ⬇️
...trollers/MessageController/MessageController.swift 95.18% <ø> (-0.03%) ⬇️
Sources/StreamChat/Database/DatabaseSession.swift 92.85% <ø> (-0.17%) ⬇️
...Models/Attachments/ChatMessageAttachmentSeed.swift 95.00% <0.00%> (-5.00%) ⬇️
Sources/StreamChat/Workers/ChannelUpdater.swift 100.00% <ø> (ø)
Sources/StreamChat/Workers/MessageUpdater.swift 100.00% <ø> (ø)
Sources/StreamChat/Database/DTOs/MessageDTO.swift 98.60% <100.00%> (-0.12%) ⬇️
Tests/Shared/JSONEncoder+Extensions.swift 50.00% <0.00%> (-50.00%) ⬇️
Tests/Shared/iOS13TestCase.swift 66.66% <0.00%> (-33.34%) ⬇️
...ocketClient/Engine/StarscreamWebSocketEngine.swift 0.00% <0.00%> (-30.96%) ⬇️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 389a317...7f6b8ca. Read the comment docs.

Copy link
Contributor

@b-onc b-onc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it looks much nicer now 🎉
Pro: Simplified API, unified flow
Con: Docs are basically required to understand these things, but seeds were not self-explanatory anyway

Copy link
Contributor

@VojtaStavik VojtaStavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea @mantergo and @b-onc 👍

Comment on lines +58 to +60

// Dummy encodable conformance to satisfy `AttachmentEnvelope` protocol.
public func encode(to encoder: Encoder) throws {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting side effect. I'm thinking - what does this mean? Maybe we're missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Encodable is the main constraint for the custom attachments cause it is the minimum we need to blindly send it to the backend.
Dummy conformance means that we can't blindly send it, some pre-processing is required and we know how to handle that.
I think that's acceptable trade-off.

@mantergo mantergo merged commit 7baadd7 into main Feb 12, 2021
@mantergo mantergo deleted the CIS-661-simplify-sending-attachments branch February 12, 2021 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants