-
Notifications
You must be signed in to change notification settings - Fork 0
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
TabsListManager refactor to have use cases #72
Merged
Merged
Conversation
This file contains 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
…ich is actually looks more like a data service partly. Also need to think how to separate observers from the use cases
6734fa4
to
226c23f
Compare
…mal search suggestions VM
# Conflicts: # catowseriOS/CottonData/SearchViewModel/Autocomplete/WebSearchAutocomplete+AsyncAwait.swift # catowseriOS/CottonData/WebViewModel/DNSResolving/DNSResolver+AsyncAwait.swift # catowseriOS/catowser.xcodeproj/project.pbxproj # catowseriOS/catowser/BrowserContent/BrowserContentPreview.swift # catowseriOS/catowser/BrowserContent/WebView/WebViewModelV2.swift # catowseriOS/catowser/Extensions/TabsListManager+Extension.swift
…Phone layout. Fix web view model state by not calling load method if the initial state was pendingLoad in SwiftUI mode. Use Actor protocol for some interfaces which are only used by the actor. Logging.
…ated type is not supported by the SwiftMocky current version
kyzmitch
added a commit
that referenced
this pull request
Mar 13, 2024
* Start work on tabs use cases to not have one big tabs list manager which is actually looks more like a data service partly. Also need to think how to separate observers from the use cases * Finish ReadTabUseCase and UseCaseFactory, add service commands to TabsDataService * Integrate more use cases and create new view models to leverage them * Fix compilation * Fix compilation of CoreBrowser tests * Fix use case locator crash * Combine last 4 commits * Solve complex use case type registration issue * Rename use case classes * Doc comments, attempt to fix SwiftUI site loading (web view model creation) * Attempt to fix web view model creation * Create web view model without a specific site to solve the async init issue * Use different approach to be able to store VM as a state object * Use environment object to make the constructors smaller, also use normal search suggestions VM * Update copyright header for the new files from this PR * Fix content type reloading to the default one from the async task in Phone layout. Fix web view model state by not calling load method if the initial state was pendingLoad in SwiftUI mode. Use Actor protocol for some interfaces which are only used by the actor. Logging. * Add mocks auto-generation for the use cases, currently primary associated type is not supported by the SwiftMocky current version * Fix search suggestions vm tests compilation after adding use case * Fix CottonData unit tests compilation * Fix search suggestions view model tests * Fix web view model tests * Fix client compilation * fix linter * Swiftlint format result * Fix lint errors for sure
kyzmitch
added a commit
that referenced
this pull request
Mar 13, 2024
* Start work on tabs use cases to not have one big tabs list manager which is actually looks more like a data service partly. Also need to think how to separate observers from the use cases * Finish ReadTabUseCase and UseCaseFactory, add service commands to TabsDataService * Integrate more use cases and create new view models to leverage them * Fix compilation * Fix compilation of CoreBrowser tests * Fix use case locator crash * Combine last 4 commits * Solve complex use case type registration issue * Rename use case classes * Doc comments, attempt to fix SwiftUI site loading (web view model creation) * Attempt to fix web view model creation * Create web view model without a specific site to solve the async init issue * Use different approach to be able to store VM as a state object * Use environment object to make the constructors smaller, also use normal search suggestions VM * Update copyright header for the new files from this PR * Fix content type reloading to the default one from the async task in Phone layout. Fix web view model state by not calling load method if the initial state was pendingLoad in SwiftUI mode. Use Actor protocol for some interfaces which are only used by the actor. Logging. * Add mocks auto-generation for the use cases, currently primary associated type is not supported by the SwiftMocky current version * Fix search suggestions vm tests compilation after adding use case * Fix CottonData unit tests compilation * Fix search suggestions view model tests * Fix web view model tests * Fix client compilation * fix linter * Swiftlint format result * Fix lint errors for sure
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.
During Android development it was found that Android code base requires repositories and use cases to follow standard architecture, so that, there was no good example on iOS side to use it as a reference. So, it was decided to better first implement them on iOS side because it is easier and would allow to have good TabsDataService instead of not perfect TabsListManager which is only following observer pattern.
TabsListManager could potentially be split on:
Search autocomplete and DNS resolving strategies are used only by the view models, so that, it makes sense to refactor them and rename to be the use cases as well:
and something which will allow to observe the tabs changes (existing Observer pattern).
Also, TabsListManager can be renamed to TabsDataService to have it in these use cases.
Remaining work: