8000 Use AppSettings.fileUploadConfig for setting supported UTI types for the file picker by laevandus · Pull Request #713 · GetStream/stream-chat-swiftui · GitHub
[go: up one dir, main page]

Skip to content

Use AppSettings.fileUploadConfig for setting supported UTI types for the file picker #713

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

Merged
merged 7 commits into from
Jan 14, 2025

Conversation

laevandus
Copy link
Contributor
@laevandus laevandus commented Jan 13, 2025

🔗 Issue Link

Resolves IOS-124

🎯 Goal

Use AppSettings.fileUploadConfig for setting supported UTI types for the file picker

🛠 Implementation

Read the state of ChatClient.appSettings for setting allowed content types for pickers. Note that setting block list does not restrict pickers (but attachment upload fails immediately).

🧪 Testing

Note: block lists and allow lists work differently in pickers (technical reasons).

Upload configs are set using Stream Dashboard.

Case 1: Block list using path extensions

  1. Set upload config for image uploads to block path extensions .png (or more)
  2. Open a channel, use the image picker to select a blocked file
    Expected: user can pick the file, but upload fails immediately when sending the message

Repeat for file upload config with .pdf

Case 2: Block list using mime types

  1. Set upload config for image uploads to block path extensions image/png (or more)
  2. Open a channel, use the image picker to select a blocked file
    Expected: user can pick the file, but upload fails immediately when sending the message

Repeat for file upload config with application/pdf

Case 3: Allow list using path extensions

  1. Set file upload config for image uploads to allow only .png path extensions
  2. Open a channel, use the image picker to select allowed file
    Expected:
    ImagePicker: user can pick the file, but upload fails immediately when sending the message
    FilePicker: user can't pick the file

Repeat for file upload config with .pdf

Case 4: Allow list using mime types

  1. Set file upload config for image uploads to allow only image/png mime type
  2. Open a channel, use the image picker to select allowed file
    Expected:
    ImagePicker: user can pick the file, but upload fails immediately when sending the message
    FilePicker: user can't pick the file

Repeat for file upload config with application/pdf

🎨 Changes

☑️ 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)

@laevandus laevandus requested a review from a team as a code owner January 13, 2025 12:47
@Stream-SDK-Bot
Copy link
Collaborator
Stream-SDK-Bot commented Jan 13, 2025

SDK Size

title develop branch diff status
StreamChatSwiftUI 7.54 MB 7.54 MB +1 KB 🟢

Copy link
Member
@nuno-vieira nuno-vieira left a comment

Choose a reason for hiding this comment

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

LGTM! ✅

@laevandus laevandus changed the title Use AppSettings for settin 8000 g the list of allowed file and image types in pickers Use AppSettings.fileUploadConfig for setting supported UTI types for the file picker Jan 14, 2025
@laevandus laevandus enabled auto-merge (squash) January 14, 2025 12:26
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
68.2% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud

@laevandus laevandus merged commit 67ab9f3 into develop Jan 14, 2025
11 of 12 checks passed
@laevandus laevandus deleted the feature/app-settings-upload-config branch January 14, 2025 13:11
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0