Skip to content

Commit

Permalink
Data service evolution (#87)
Browse files Browse the repository at this point in the history
* Concurrently fetch use cases if possible

* Rename of actor based interface and add another one for class based

* Inject search  bar view model (need to fix one compile error)

* Fix compilation

* Make tabs data service internal to the module

* Add base class for data service

* New files

* Add dispatch queues and promise table

* Add initial search data service code

* Register data service in locator

* Make start/init of phone tab previews coordinator sync again to fix use case registration race

* Add app assembler

* Move remaining app start data to app assembler

* Renaming

* Add a note about #14

* Re-indent params

* Implement functions in search data service and move some files

* Remove dependency on specific strategies to be able to switch between them in runtime

* Properly register auto search suggestions use case

* Better use case func names

* Domain resolving use case changes to use new data service

* Adapt search suggestions view model to the new use case and data service

* Adapt rx swift use case functions

* One more command in Search data service

* Dependencies for view model factory

* Re-indent params

* Merge async service registry class with service registry

* Fix tabs data service registration, because it has an associated type

* Fix app coordinator crash

* Use abstract protocol for the search data service to hide the implementation

* Renamed a bunch of frameworks and added view models and data services frameworks. Still there a two sendable errors.

* Fix several errors

* Fix imports in use cases module

* Fix several errors in main build target by importing new modules

* Fix not trivial problem with module verification by adding -no-verify-emitted-module-interface option to Other Swift Flags for several new modules

* Fix build

* Remove extra imports

* Add doc comments

* Minor changes

* Rename Rest client functions

* Not finished work about service data in tabs service

* Not finished work about service data in tabs service - part #2

* Not finished work about service data in tabs service - part #3 (fixed compilation)

* Add errors propagation to some use cases

* small performance optimisation for the initial tabs loading

* Return new selected tab if closed tab was selected

* Remove CottonData module and move remaining files to CoreBrowser

* new bundle ids
  • Loading branch information
kyzmitch authored Dec 13, 2024
1 parent 8beeb45 commit 83307f2
Show file tree
Hide file tree
Showing 247 changed files with 5,484 additions and 2,554 deletions.
225 changes: 0 additions & 225 deletions catowseriOS/BrowserNetworking/Downloadable.swift

This file was deleted.

79 changes: 0 additions & 79 deletions catowseriOS/BrowserNetworking/HttpClient+Alamofire.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// SiteSettings+Extensions.swift
// catowser
// CoreBrowser
//
// Created by Andrei Ermoshin on 6/2/20.
// Copyright © 2020 Cotton (former Catowser). All rights reserved.
Expand All @@ -12,7 +12,7 @@ import CottonBase
extension Site.Settings {
/// This will be ignored for old WebViews because it can't be changed for existing WebView without recration.
/// It has to be main actor because `WKWebViewConfiguration` uses it.
@MainActor var webViewConfig: WKWebViewConfiguration {
@MainActor public var webViewConfig: WKWebViewConfiguration {
let configuration = WKWebViewConfiguration()
if #available(iOS 14, *) {
let preferences = WKWebpagePreferences()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ResourceReader.swift
// XmlSearchPluginResource.swift
// CoreBrowser
//
// Created by Andrei Ermoshin on 4/15/20.
Expand All @@ -8,16 +8,13 @@

import Foundation

public enum KnownSearchPluginName: String, Sendable {
case google
case duckduckgo
}

/// Resource reader parser, doesn't hold any state, so no need to be global actor
public enum ResourceReader {
public static func readXmlSearchPlugin(with name: KnownSearchPluginName,
on bundle: Bundle) -> Data? {
guard let fileURL = bundle.url(forResource: name.rawValue, withExtension: "xml") else {
public enum XmlSearchPluginResource {
public static func read(
with name: WebAutoCompletionSource,
on bundle: Bundle
) -> Data? {
guard let fileURL = bundle.url(forResource: name.stringKey, withExtension: "xml") else {
return nil
}
guard let data = try? Data(contentsOf: fileURL) else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// OpenSearchParser.swift
// BrowserNetworking
// CoreBrowser
//
// Created by Andrei Ermoshin on 4/20/20.
// Copyright © 2020 Cotton/Catowser Andrei Ermoshin. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// SearchEngine+OpenSearchParser.swift
// BrowserNetworking
// CoreBrowser
//
// Created by Andrei Ermoshin on 4/14/20.
// Copyright © 2020 Cotton/Catowser Andrei Ermoshin. All rights reserved.
Expand Down Expand Up @@ -32,10 +32,12 @@ extension String {
}

extension SearchEngine {
init(xml element: SWXMLHash.XMLElement,
indexer: XMLIndexer,
shortName: String,
imageData: OpenSearch.ImageParseResult) throws {
init(
xml element: SWXMLHash.XMLElement,
indexer: XMLIndexer,
shortName: String,
imageData: OpenSearch.ImageParseResult
) throws {

self.shortName = shortName
self.imageData = imageData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// GoogleSearchEngine.swift
// BrowserNetworking
// CoreBrowser
//
// Created by Andrei Ermoshin on 4/13/20.
// Copyright © 2020 Cotton (former Catowser). All rights reserved.
Expand Down
Loading

0 comments on commit 83307f2

Please sign in to comment.