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-1592] Fix file mime-types and attachment type #1873

Merged
merged 7 commits into from Mar 24, 2022

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Mar 23, 2022

🔗 Issue Link

CIS-1592

🎯 Goal

  • Align the file mime-types with the other SDKs
  • When adding a file from the File Picker, resolve the correct attachment type

🛠 Implementation

  • Fix the incorrect mime-type and add missing ones
  • When adding a file in the composer, resolve the attachment type through the file extension

🎨 UI Changes

Adding an image through the file picker:

ResolvingAttachmentType.mp4

🧪 Testing

Scenario 1:

  1. Open a chat
  2. Add a file attachment with extension .rtf
  3. Check the HTTP Request - mime-type should be text/rtf

Scenario 2:

  1. Open a chat
  2. Add an image from the File Picker (Instead of Photo & Video Picker)
  3. Composer should preview the image
  4. Image should be added to the message list successfully

Note: When importing audio files from the File Picker, nothing will render
since we currently don't support audio files in the iOS SDK

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • This change follows zero ⚠️ policy (required)
  • Comparison screenshots added for visual changes
  • Affected documentation updated (docusaurus, tutorial, CMS)

@nuno-vieira nuno-vieira added 🐞 Bug An issue or PR related to a bug 🎨 SDK: StreamChatUI Tasks related to the StreamChatUI SDK labels Mar 23, 2022
@nuno-vieira nuno-vieira requested a review from a team as a code owner March 23, 2022 19:53
@nuno-vieira nuno-vieira changed the title [CIS-1592] Fix attachment file mime-types [CIS-1592] Fix file mime-types and resolve attachment type from file extensions Mar 23, 2022
CHANGELOG.md Outdated Show resolved Hide resolved
@nuno-vieira nuno-vieira changed the title [CIS-1592] Fix file mime-types and resolve attachment type from file extensions [CIS-1592] Fix file mime-types and attachment type Mar 23, 2022
CHANGELOG.md Outdated Show resolved Hide resolved
@nuno-vieira nuno-vieira added the 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK label Mar 23, 2022
Copy link
Contributor

@evsaev evsaev left a comment

Choose a reason for hiding this comment

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

LGTM! 🚢

CHANGELOG.md Outdated Show resolved Hide resolved
@nuno-vieira nuno-vieira force-pushed the fix/CIS-1592-Align-mime-types-with-other-sdks branch from 04dd086 to 1559687 Compare March 24, 2022 11:52
Co-authored-by: Pavel Evsaev <pavel.evsaev@gmail.com>
@nuno-vieira nuno-vieira marked this pull request as draft March 24, 2022 12:42
@nuno-vieira
Copy link
Member Author

Converted to draft to make sure we should do: "When adding a file from the File Picker, resolve the correct attachment type"

@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #1873 (11020b7) into develop (74fabd6) will decrease coverage by 0.05%.
The diff coverage is 97.22%.

@@             Coverage Diff             @@
##           develop    #1873      +/-   ##
===========================================
- Coverage    86.00%   85.94%   -0.06%     
===========================================
  Files          237      238       +1     
  Lines        11526    11556      +30     
===========================================
+ Hits          9913     9932      +19     
- Misses        1613     1624      +11     
Flag Coverage Δ
llc-tests 85.94% <97.22%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...treamChat/Models/Attachments/AttachmentTypes.swift 88.31% <94.44%> (+1.64%) ⬆️
...reamChat/APIClient/Endpoints/DeviceEndpoints.swift 100.00% <100.00%> (ø)
.../CurrentUserController/CurrentUserController.swift 85.71% <100.00%> (+0.52%) ⬆️
Sources/StreamChat/Models/PushProvider.swift 100.00% <100.00%> (ø)
...ources/StreamChat/Workers/CurrentUserUpdater.swift 95.77% <100.00%> (+0.06%) ⬆️
Sources/StreamChat/Utils/Logger/Logger.swift 50.29% <0.00%> (-5.99%) ⬇️

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 182365f...11020b7. Read the comment docs.

@nuno-vieira nuno-vieira marked this pull request as ready for review March 24, 2022 12:53
@nuno-vieira nuno-vieira merged commit 75de63c into develop Mar 24, 2022
@nuno-vieira nuno-vieira deleted the fix/CIS-1592-Align-mime-types-with-other-sdks branch March 24, 2022 13:09
@nuno-vieira nuno-vieira mentioned this pull request Mar 29, 2022
ajay-simform added a commit to timeless-space/stream-chat-swift that referenced this pull request Apr 5, 2022
…swift into feature/sync-with-main

* 'main' of https://github.com/timeless-space/stream-chat-swift: (24 commits)
  Update CHANGELOG.md
  [CIS-1737] Fix deadlock when accessing some properties from Events Delegate (GetStream#1898)
  Bump 4.13.1
  Update CHANGELOG.md
  Bump 4.13.0
  Update CHANGELOG.md
  [CIS-1655] Do not fail decoding `removed_from_channel` event if channel is incomplete (GetStream#1881)
  Move UI Kit Customizing Components doc to main level (GetStream#1883)
  Docs updates for the SwiftUI SDK (GetStream#1882)
  [CIS-1189] Fix long file names overlapped by the close button (GetStream#1880)
  [CIS-1702] Add Mixed Attachments UI Support (GetStream#1877)
  [CIS-1523] Create mock web socket client for UI tests (GetStream#1866)
  [CIS-1694] Introduce message translations (GetStream#1867)
  Fix pasting long text into composer won't update input height (GetStream#1876)
  Fix command with no arg can be sent without text (GetStream#1869)
  [CIS-1592] Fix file mime-types and attachment type  (GetStream#1873)
  [CIS-1689] Add support for multiple push providers (GetStream#1864)
  [CIS-1285] Start collecting iOS version (GetStream#1846)
  Improved wording in summary to give us a fighting chance when indexing at cocoapods.org
  [CIS-1679] Fix payload for reaction when using enforce_unique (GetStream#1861)
  ...

# Conflicts:
#	Package.swift
#	Sources/StreamChat/Models/ChatMessage.swift
#	Sources/StreamChatUI/ChatChannelList/ChatChannelListItemView.swift
#	Sources/StreamChatUI/ChatChannelList/ChatChannelListVC.swift
#	Sources/StreamChatUI/ChatMessageList/ChatMessage/ChatMessageCell.swift
#	Sources/StreamChatUI/Composer/ComposerVC.swift
#	StreamChat.xcodeproj/project.pbxproj
#	StreamChatUI.podspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK 🎨 SDK: StreamChatUI Tasks related to the StreamChatUI SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants