Skip to content

refactor(chat): Upload shared files with the single implementation - #2642

Merged
SystemKeeper merged 4 commits into
mainfrom
chore/noid/unify-share-sheet-upload
Aug 9, 2026
Merged

refactor(chat): Upload shared files with the single implementation#2642
SystemKeeper merged 4 commits into
mainfrom
chore/noid/unify-share-sheet-upload

Conversation

@Ivansss

@Ivansss Ivansss commented Jul 31, 2026

Copy link
Copy Markdown
Member

Fourth and last refactoring step, on top of #2641. This is the one that removes the second upload
implementation: ShareConfirmationViewController had its own copy because ChatFileUploader was
not part of the ShareExtension target.

  • Adds a batch upload() to the uploader: one draft folder request for the whole batch, uploads
    running concurrently, one result per file
  • Uses it in ShareConfirmationViewController and deletes startUploads(), uploadFile() and the
    dispatch group and error/success lists around them
  • Fixes a leftover send button in the navigation bar after sharing, which showed up next to the one
    in the input bar

Quota and rate limit failures now show the strings the app has for them instead of the ones from
NextcloudKit.

馃 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@Ivansss
Ivansss requested a review from SystemKeeper July 31, 2026 13:13
@SystemKeeper
SystemKeeper force-pushed the chore/noid/unify-chat-file-uploads branch from 2d44321 to 4c46122 Compare August 9, 2026 13:11
Base automatically changed from chore/noid/unify-chat-file-uploads to main August 9, 2026 13:38
Ivansss added 3 commits August 9, 2026 15:40
Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
@SystemKeeper
SystemKeeper force-pushed the chore/noid/unify-share-sheet-upload branch from e5e1c57 to 648f319 Compare August 9, 2026 13:40
Signed-off-by: Marcel M眉ller <marcel-mueller@gmx.de>
Comment on lines +58 to +59
try await self.put(upload, to: destination, progress: { progress?(index, $0) }, mayCreateAttachmentFolder: true)
try await self.announce(upload, at: destination)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing we should try to do in a followup is to retain the order of the shares.

Comment on lines +695 to +708
private func message(for error: Error) -> String {
switch error {
case ChatFileUploadError.destinationUnavailable:
return NSLocalizedString("Could not prepare upload folder", comment: "")
case ChatFileUploadError.attachmentFolderUnavailable:
return NSLocalizedString("Failed to check or create attachment folder", comment: "")
case ChatFileUploadError.quotaExceeded:
return NSLocalizedString("User storage quota exceeded", comment: "")
case ChatFileUploadError.tooManyRequests:
return NSLocalizedString("Too many requests, please try again later", comment: "")
case ChatFileUploadError.uploadFailed(_, let errorDescription):
return errorDescription
default:
return error.localizedDescription

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Very similar to the one in BsaeChatTableViewcontroller. Might make sense to check if we can unify them.

@SystemKeeper
SystemKeeper merged commit ca2d9b3 into main Aug 9, 2026
10 checks passed
@SystemKeeper
SystemKeeper deleted the chore/noid/unify-share-sheet-upload branch August 9, 2026 14:09
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.

2 participants