Skip to content

Conversation

@nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Feb 28, 2025

🔗 Issue Link

#759

🎯 Goal

Send photos from the library as JPEG instead of HEIC to make sure other platforms can show the images correctly.

🛠 Implementation

We now convert the HEIC image to JPG when adding it to the composer.

This approach is what we do when sending photos from the Camera. With this change, we are also consistent with UIKit as well which follows the same approach.

🧪 Testing

Smoke testing around images

☑️ Checklist

  • I have signed the Stream CLA (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Affected documentation updated (docusaurus, tutorial, CMS (task created)

@nuno-vieira nuno-vieira requested a review from a team as a code owner February 28, 2025 12:53
@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Feb 28, 2025

SDK Size

title develop branch diff status
StreamChatSwiftUI 8.17 MB 8.17 MB 0 KB 🟢

Comment on lines 200 to 203
private func assetJpgURL() -> URL? {
guard let assetURL = assetURL else { return nil }
guard let assetData = try? Data(contentsOf: assetURL) else { return nil }
return try? UIImage(data: assetData)?.temporaryLocalFileUrl()
Copy link
Contributor

@laevandus laevandus Feb 28, 2025

Choose a reason for hiding this comment

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

Not for this PR, but I did not know that temporaryLocalFileUrl actually goes and converts the image to JPEG. We should probably rename this at some point.

I guess this is fast enough that we don't need any async call for this.

Copy link
Member Author

@nuno-vieira nuno-vieira Feb 28, 2025

Choose a reason for hiding this comment

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

Yeah I actually changed it and then reverted it. But I think we can do it already here. It makes sense to rename it on UIKit as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess this is fast enough that we don't need any async call for this.

Yes it is quite fast, and is also only executed when an attachment is added to the composer

Copy link
Member Author

Choose a reason for hiding this comment

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

Done ✅ Let me know WDYT

@sonarqubecloud
Copy link

Copy link
Contributor

@martinmitrevski martinmitrevski left a comment

Choose a reason for hiding this comment

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

LGTM ✅

@nuno-vieira nuno-vieira enabled auto-merge (squash) March 3, 2025 14:00
@nuno-vieira nuno-vieira merged commit 40026ea into develop Mar 3, 2025
12 checks passed
@nuno-vieira nuno-vieira deleted the change/send-heic-images-as-jpg branch March 3, 2025 14:25
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants