refactor: Upload backend router#338
Merged
PhilippeWeidmann merged 2 commits intoprotected/st-plusfrom Mar 5, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces UploadBackendRouter as a central abstraction for upload session handling, and refactors upload-related UI + worker flows to use it in preparation for multiple backends/API versions.
Changes:
- Added
UploadBackendRouterand wired it intoMainViewStateinitialization paths (preloading/onboarding). - Refactored upload progress + background continuation flow to pass the router through to
TransferManagerWorker. - Simplified local upload session creation by returning the local session UUID instead of a
SendableUploadSession.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| SwissTransferFeatures/UploadProgressView/UploadProgress/UploadProgressView.swift | Switches upload initialization/restoration to use UploadBackendRouter. |
| SwissTransferFeatures/UploadProgressView/UploadError/UploadErrorView.swift | Updates retry flow to transition using a local session UUID. |
| SwissTransferFeatures/UploadProgressView/UploadContinuationCoordinator.swift | Passes UploadBackendRouter through background/foreground upload continuation paths. |
| SwissTransferFeatures/UploadProgressView/TransferSessionManager.swift | Updates worker creation and upload entrypoint to use the router. |
| SwissTransferFeatures/PreloadingView/PreloadingView.swift | Creates/injects UploadBackendRouter into MainViewState during startup routing. |
| SwissTransferFeatures/OnboardingView/OnboardingView.swift | Creates/injects UploadBackendRouter when entering main view from onboarding deep links. |
| SwissTransferFeatures/OnboardingView/OnboardingBottomButtonsView.swift | Creates/injects UploadBackendRouter when opening a guest session. |
| SwissTransferFeatures/NewTransferView/VerifyMailView.swift | Updates email verification flow to transition using a local session UUID. |
| SwissTransferFeatures/NewTransferView/NewTransferView.swift | Uses router to create local upload session UUID; updates share extension import URL creation. |
| SwissTransferCore/UploadManager+Extension.swift | Renames API to return local upload session UUID instead of wrapping in SendableUploadSession. |
| SwissTransferCore/Upload/UploadBackendRouter.swift | Adds the new router abstraction (currently partially implemented). |
| SwissTransferCore/Upload/TransferManagerWorker.swift | Replaces uploadManager dependency with UploadBackendRouter and routes finish through it. |
| SwissTransferCore/Upload/TransferManagerWorker+Network.swift | Uses router (currently via its underlying sharedApiUrlCreator) to build chunk upload URLs. |
Comments suppressed due to low confidence (1)
SwissTransferCore/Upload/TransferManagerWorker+Network.swift:33
TransferManagerWorkerbuilds the chunk upload URL by reaching throughuploadBackendRouter.swissTransferManager.sharedApiUrlCreator, which bypasses the new router abstraction and makes it harder to support multiple backends/API versions. Expose a dedicated URL-building method onUploadBackendRouter(e.g.uploadChunkURL(...)) and keepswissTransferManagerencapsulated so the worker doesn’t need to know which API creator to use.
guard let rawChunkURL = try uploadBackendRouter.swissTransferManager.sharedApiUrlCreator.uploadChunkUrl(
uploadUUID: chunk.uploadUUID,
fileUUID: chunk.remoteUploadFileUUID,
chunkIndex: Int32(chunk.index),
isLastChunk: chunk.isLast,
isRetry: false
) else {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
valentinperignon
approved these changes
Mar 5, 2026
da9ce5e to
e59e7e4
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This pull request introduces a new abstraction,
UploadBackendRouter, to centralize and streamline upload session management and URL creation, especially in preparation for supporting multiple API versions and user types. The changes refactor upload-related flows to use this new router, update UI state initialization, and improve transfer URL handling for both v1 and v2 APIs.