fix: FilesViewModel - WPB-24805#4590
Open
WilhelmOks wants to merge 83 commits intodevelopfrom
Open
Conversation
… entity - WPB-24208 (#4478)
… Publisher with the need for manually setting up a sink
…WPB-23967-make-files-available-offline-ui-bl # Conflicts: # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesItemViewModel.swift
…WPB-23967-make-files-available-offline-ui-bl # Conflicts: # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/FilesContentView.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesItemViewModel.swift
…WPB-23967-make-files-available-offline-ui-bl
…g when deleting to the recycle bin
…WPB-23967-make-files-available-offline-ui-bl # Conflicts: # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesItemViewModel.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesViewItemView.swift
…re and removing the accentColorProvider from all of the places where it's being passed around to ViewModels (because it's not needed)
…in and removed the obsolete TODO
…quired in the FilesViewModel anymore.
# Conflicts: # WireMessaging/Sources/WireMessagingAssembly/WireMessagingFactory.swift # WireMessaging/Sources/WireMessagingDomain/WireDrive/UseCases/WireDriveMakeAssetAvailableOfflineUseCase.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/FilesContentView.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/FilesOfflineBarView.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/FilesPreviewHelpers.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/FilesViewContainer.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/FilesViewModel.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/Item/FilesItemView.swift # WireMessaging/Sources/WireMessagingUI/WireDrive/Components/Files/RecycleBinContainer.swift # WireMessaging/Tests/WireMessagingTests/WireDrive/ImplementationTests/WireDriveLocalAssetRepositoryTests.swift # WireMessaging/Tests/WireMessagingTests/WireDrive/UITests/Components/Files/FilesViewModelTests.swift
Contributor
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit a0bf1e7. ♻️ This comment has been updated with latest results. Summary: workflow run #25441449176 |
|
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.



Issue
The swift file FilesViewModel is almost 1k loc long, is shared by multiple Views and has accumulated a lot of code for different kinds of functionality.
This makes it hard to read and maintain it.
Solution
Many different kinds of refactoring were implemented resulting in the
FilesViewModel.swiftfile being about 50% smaller:FilesViewIteminto a separate fileSheetNavigationto use Model data instead of SwiftUI Views as payload, eliminating the need forimport SwiftUIin ViewModel codeFilesViewModel+make_ViewModels.swiftUseCasesnested struct into the extensionFilesViewModel+UseCases.swiftLoadOfflineAvailableFilesUIActionIncrementalListLoaderandFilesListLoader// MARK: labelcommentsTesting
The logic should be exactly the same after the refactoring.