Skip to content

refactor: Upload backend router#338

Merged
PhilippeWeidmann merged 2 commits intoprotected/st-plusfrom
feat/st-plus/refactor-upload-backend-router
Mar 5, 2026
Merged

refactor: Upload backend router#338
PhilippeWeidmann merged 2 commits intoprotected/st-plusfrom
feat/st-plus/refactor-upload-backend-router

Conversation

@PhilippeWeidmann
Copy link
Member

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.

@PhilippeWeidmann PhilippeWeidmann changed the title refactor: upload backend router refactor: Upload backend router Mar 5, 2026
@PhilippeWeidmann PhilippeWeidmann changed the base branch from protected/st-plus to feat/st-plus/download March 5, 2026 07:00
@valentinperignon valentinperignon requested a review from Copilot March 5, 2026 07:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 UploadBackendRouter and wired it into MainViewState initialization 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

  • TransferManagerWorker builds the chunk upload URL by reaching through uploadBackendRouter.swissTransferManager.sharedApiUrlCreator, which bypasses the new router abstraction and makes it harder to support multiple backends/API versions. Expose a dedicated URL-building method on UploadBackendRouter (e.g. uploadChunkURL(...)) and keep swissTransferManager encapsulated 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.

Base automatically changed from feat/st-plus/download to protected/st-plus March 5, 2026 08:02
@PhilippeWeidmann PhilippeWeidmann force-pushed the feat/st-plus/refactor-upload-backend-router branch from da9ce5e to e59e7e4 Compare March 5, 2026 08:08
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

@PhilippeWeidmann PhilippeWeidmann merged commit 49b944e into protected/st-plus Mar 5, 2026
8 of 10 checks passed
@PhilippeWeidmann PhilippeWeidmann deleted the feat/st-plus/refactor-upload-backend-router branch March 5, 2026 08:12
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.

3 participants