Skip to content
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

feat: Split upload queue in two behind a new service #1470

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
4652da5
feat(UploadService): New service in DI to centralise upload
adrien-coye Mar 10, 2025
ac8feae
feat: Two upload queues availlable from DI
adrien-coye Mar 10, 2025
955ad0e
feat(UploadService): Sample implementation
adrien-coye Mar 10, 2025
1ecafd4
refactor(UploadCardViewModel): Use new upload service
adrien-coye Mar 10, 2025
2ab2462
refactor(UploadService): Protocol split away from base class
adrien-coye Mar 10, 2025
c58d434
feat(UploadService): Database accessor methods
adrien-coye Mar 11, 2025
807489a
feat(UploadService): Notifications
adrien-coye Mar 11, 2025
2be00a5
feat(UploadService): Observation
adrien-coye Mar 11, 2025
1736088
feat(UploadService): Publish
adrien-coye Mar 11, 2025
31b6057
feat(UploadService): Specific protocol for DB access
adrien-coye Mar 11, 2025
5c33e51
refactor(UploadCardViewModel): Now using uploadService
adrien-coye Mar 11, 2025
9a82cc3
refactor(UploadQueueFoldersViewController): Now using uploadService
adrien-coye Mar 11, 2025
43458b9
refactor(UploadQueueViewController): Now using uploadService
adrien-coye Mar 11, 2025
779497a
refactor(PhotoSyncSettingsViewController): Now using uploadService
adrien-coye Mar 11, 2025
0d1b746
refactor(UploadTableViewCell): Now using uploadService
adrien-coye Mar 11, 2025
c59344f
refactor(UploadCountManager): Now using uploadService
adrien-coye Mar 11, 2025
8866bfe
refactor(AppDelegate): Now using uploadService
adrien-coye Mar 11, 2025
aa69a24
refactor(AppRouter): Now using uploadService
adrien-coye Mar 11, 2025
3f1f2c5
refactor(FreeSpaceService): Now using uploadService
adrien-coye Mar 11, 2025
5c147bf
refactor(DirectoryEnumerator): Now using uploadService
adrien-coye Mar 11, 2025
d3ffe48
refactor(BackgroundTasksService): Now using uploadService
adrien-coye Mar 11, 2025
57cb260
refactor(UploadFileProviderItem): Now using uploadService
adrien-coye Mar 11, 2025
d6c8026
refactor(PhotoLibraryUploader): Removed dead code
adrien-coye Mar 11, 2025
b73d0eb
refactor(UploadOperation): Now using uploadService
adrien-coye Mar 11, 2025
5813871
refactor(SceneDelegate): Now using uploadService
adrien-coye Mar 11, 2025
42997c5
refactor(FileProviderExtension): Now using uploadService
adrien-coye Mar 11, 2025
5ce6aa1
refactor(MainTabViewController): Now using uploadService
adrien-coye Mar 11, 2025
ac27b0a
refactor(SceneDelegate): Now using uploadService
adrien-coye Mar 11, 2025
7fee39f
refactor(AppDelegateBGNSURLSession): Now using uploadService
adrien-coye Mar 11, 2025
2b82a5c
refactor(BackgroundUploadSessionManager): Removed dead code
adrien-coye Mar 11, 2025
00614ca
refactor(PhotoLibraryCleanerService): Now using uploadService
adrien-coye Mar 11, 2025
9008404
refactor(FileImportHelper): Now using uploadService
adrien-coye Mar 11, 2025
580f3ce
refactor(UploadService): Removed now dead code
adrien-coye Mar 11, 2025
80b654a
refactor(UploadQueue): Remove dead code and start all operations like…
adrien-coye Mar 12, 2025
2539f1e
refactor(UploadService): Restart uploads from service init instead of…
adrien-coye Mar 12, 2025
6f58088
refactor(UploadQueue): Relocated code to the service
adrien-coye Mar 12, 2025
1297662
refactor(UploadQueue): Moved some code to the service
adrien-coye Mar 12, 2025
924741d
refactor(UploadService): Moved the database transaction part of cance…
adrien-coye Mar 12, 2025
05601f9
refactor(UploadQueue): Reworked cancelAllOperations function moving d…
adrien-coye Mar 12, 2025
7c18ad6
fix(UploadService): Correct suspended logic
adrien-coye Mar 12, 2025
4db3b93
chore: Reorganize upload related files
adrien-coye Mar 12, 2025
5272216
refactor(UploadQueue): Reworked retryAllOperations function so the da…
adrien-coye Mar 12, 2025
eec784c
refactor(UploadQueue): Restart logic moved to UploadService
adrien-coye Mar 12, 2025
aadefd3
refactor(UploadQueue): Retry logic moved to UploadService
adrien-coye Mar 12, 2025
d153c55
refactor(UploadQueue): Remove dead code
adrien-coye Mar 12, 2025
9bb872a
refactor(UploadQueue): Remove dead code
adrien-coye Mar 12, 2025
ba2c63a
refactor(UploadService): Remove dead code
adrien-coye Mar 12, 2025
c95dfb0
chore(UploadService): Added a todo
adrien-coye Mar 12, 2025
b5121ce
chore(UploadOperation): Sonar asked to remove explicit self
adrien-coye Mar 12, 2025
22ff4ad
refactor(UploadQueueObservable): Renamed UploadObservable
adrien-coye Mar 13, 2025
a39077f
refactor(ITAppLaunchTest): Now using uploadService
adrien-coye Mar 13, 2025
d11f946
refactor(UTRootViewControllerState): Now using uploadService
adrien-coye Mar 13, 2025
a48d115
chore: Remove TODOs related to splitting the photoSync upload queue
adrien-coye Mar 13, 2025
6bb1d53
chore(BackgroundUploadSessionManager): SwiftLint extra blank space
adrien-coye Mar 13, 2025
c1b7d69
refactor(UploadQueueFoldersViewController): Missing private in property
adrien-coye Mar 13, 2025
ad125dd
refactor(UploadServiceDataSourceable): Removed comments in protocol t…
adrien-coye Mar 13, 2025
7d62ec5
refactor(UploadNotifiable): Removed comments in protocol to match con…
adrien-coye Mar 13, 2025
8718cfe
refactor(UploadObservable): Removed comments in protocol to match con…
adrien-coye Mar 13, 2025
582e7b0
refactor(UploadServiceable): Removed comments in protocol to match co…
adrien-coye Mar 13, 2025
e75031a
refactor(UploadQueueable): Removed comments in protocol to match conv…
adrien-coye Mar 13, 2025
fafa7d7
refactor(BackgroundUploadSessionManager): Removed comments in protoco…
adrien-coye Mar 13, 2025
0266deb
chore(UploadService): Linter complained extra return statement
adrien-coye Mar 13, 2025
92750e2
fix(UploadService+Notifications): Missing upload paused notification …
adrien-coye Mar 13, 2025
ef753f9
refactor(cancelAllOperations): Should be non blocking like the previo…
adrien-coye Mar 13, 2025
4d593ab
fix(ITAppLaunchTest): Removed double registration
adrien-coye Mar 13, 2025
1f9a1f1
fix(UTRootViewControllerState): Removed double registration
adrien-coye Mar 13, 2025
23c8250
feat(UploadService): Remove calls to photoUploadQueue for now
adrien-coye Mar 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(UploadServiceable): Removed comments in protocol to match co…
…nventions
  • Loading branch information
adrien-coye committed Mar 13, 2025
commit 582e7b0f23dca545e5ba0e2557d593e705898517
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,27 @@ public enum UploadQueueID {
}

public protocol UploadServiceable {
/// True if all upload queues are suspended
var isSuspended: Bool { get }

/// Sum of all operations in all the queues
var operationCount: Int { get }

/// Read database to enqueue all non finished upload tasks.
func rebuildUploadQueueFromObjectsInRealm()

func suspendAllOperations()

func resumeAllOperations()

/// Wait for all (started or not) enqueued operations to finish.
func waitForCompletion(_ completionHandler: @escaping () -> Void)

// Retry to upload a specific file, this re-enqueue the task.
func retry(_ uploadFileId: String)

// Retry all uploads within a specified graph, this re-enqueue the tasks.
func retryAllOperations(withParent parentId: Int, userId: Int, driveId: Int)

func cancelAllOperations(withParent parentId: Int, userId: Int, driveId: Int)

/// Mark all running `UploadOperation` as rescheduled, and terminate gracefully
///
/// Takes more time than `cancel`, yet prefer it over a `cancel` for the sake of consistency.
/// Further uploads will start from the mail app
func rescheduleRunningOperations()

/// Cancel an upload from an UploadFile.id. The UploadFile is removed and a matching operation is removed.
/// - Parameter uploadFileId: the upload file id to cancel.
/// - Returns: true if fileId matched
@discardableResult func cancel(uploadFileId: String) -> Bool

/// Clean errors linked to any upload operation in base. Does not restart the operations.
///
/// Also make sure that UploadFiles initiated in FileManager will restart at next retry.
func cleanNetworkAndLocalErrorsForAllOperations()
}