Commit f1aa273078f576a5849b0e81cdf0c5e5628db0df

Authored by Artem Talko
1 parent 14aa9047

fixes

Showing 33 changed files with 49 additions and 51 deletions
... ... @@ -10,7 +10,7 @@ import UIKit
10 10 import Realm
11 11 import RealmSwift
12 12
13   -class BrowserTabDataBase: Object {
  13 +final class BrowserTabDataBase: Object {
14 14 @Persisted(primaryKey: true) var tabId: String = UUID().uuidString
15 15 @Persisted var tabTitle: String
16 16 @Persisted var TabUrl: String
... ...
... ... @@ -10,7 +10,7 @@ import UIKit
10 10 import Realm
11 11 import RealmSwift
12 12
13   -class HistoryDataBase: Object {
  13 +final class HistoryDataBase: Object {
14 14 @Persisted(primaryKey: true) var historyCellId: String = UUID().uuidString
15 15 @Persisted var siteTitle: String
16 16 @Persisted var siteUrl: String
... ...
... ... @@ -9,7 +9,7 @@ import UIKit
9 9 import Realm
10 10 import RealmSwift
11 11
12   -class HistoryDBManager {
  12 +final class HistoryDBManager {
13 13 static let shared = HistoryDBManager()
14 14 private let realm: Realm
15 15
... ...
... ... @@ -4,7 +4,7 @@
4 4 //
5 5 // Created by Artem Talko on 29.09.2023.
6 6 //
7   -//MARK: Checked
  7 +
8 8 import UIKit
9 9 import RealmSwift
10 10
... ... @@ -34,6 +34,7 @@ final class HistoryViewController: UIViewController {
34 34 override func viewDidLoad() {
35 35 super.viewDidLoad()
36 36
  37 + historyData = HistoryDBManager.shared.getHistoryDataForTableView()
37 38 initViewController()
38 39 }
39 40
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 29.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9 import SnapKit
... ... @@ -67,26 +66,26 @@ final class HistoryTableViewCell: UITableViewCell {
67 66
68 67 private func setupConstraints() {
69 68 searchImageLogo.snp.makeConstraints { make in
70   - make.leading.equalToSuperview().inset(8.sizeW)
71 69 make.top.equalToSuperview().inset(8.sizeH)
  70 + make.leading.equalToSuperview().inset(8.sizeW)
72 71 make.height.equalTo(18.sizeW)
73 72 make.width.equalTo(18.sizeW)
74 73 }
75 74
76 75 lastVisitSiteLabel.snp.makeConstraints { make in
  76 + make.top.equalToSuperview().inset(8.sizeH)
77 77 make.leading.equalTo(searchImageLogo.snp.trailing).offset(8.sizeW)
78 78 make.trailing.equalTo(lastVisitDateLabel.snp.leading).offset(-8.sizeW)
79   - make.top.equalToSuperview().inset(8.sizeH)
80 79 }
81 80
82 81 lastVisitDateLabel.snp.makeConstraints { make in
83   - make.trailing.equalToSuperview().inset(8.sizeW)
84 82 make.top.equalToSuperview().inset(8.sizeH)
  83 + make.trailing.equalToSuperview().inset(8.sizeW)
85 84 }
86 85
87 86 lastVisitSiteUrlLabel.snp.makeConstraints { make in
88   - make.leading.equalToSuperview().offset(34.sizeW)
89 87 make.top.equalTo(lastVisitSiteLabel.snp.bottom).offset(4.sizeH)
  88 + make.leading.equalToSuperview().offset(34.sizeW)
90 89 make.bottom.equalToSuperview().inset(8.sizeH)
91 90 make.trailing.equalToSuperview().inset(61.sizeW)
92 91 }
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 01.10.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ... @@ -14,6 +13,7 @@ final class HistorySearchBarView: UIView {
14 13 let magnifyImage = UIImage(systemName: "magnifyingglass")?.withTintColor(.gray, renderingMode: .alwaysOriginal)
15 14 obj.image = magnifyImage
16 15 obj.contentMode = .scaleAspectFit
  16 +
17 17 return obj
18 18 }()
19 19
... ... @@ -21,6 +21,7 @@ final class HistorySearchBarView: UIView {
21 21 let obj = UITextField()
22 22 obj.text = StringConstants.search
23 23 obj.textColor = ColorConstants.gray
  24 +
24 25 return obj
25 26 }()
26 27
... ... @@ -43,14 +44,14 @@ final class HistorySearchBarView: UIView {
43 44
44 45 private func setupConstraints() {
45 46 searchImageView.snp.makeConstraints { make in
46   - make.leading.equalToSuperview().offset(16.sizeW)
47 47 make.top.bottom.equalToSuperview().inset(8.sizeH)
  48 + make.leading.equalToSuperview().offset(16.sizeW)
48 49 make.height.equalTo(16.sizeH)
49 50 }
50 51 searchTextFieldView.snp.makeConstraints { make in
  52 + make.top.bottom.equalToSuperview().inset(8.sizeH)
51 53 make.leading.equalTo(searchImageView).offset(32.sizeW)
52 54 make.trailing.equalToSuperview().offset(-16.sizeW)
53   - make.top.bottom.equalToSuperview().inset(8.sizeH)
54 55 }
55 56 }
56 57 }
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 29.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ... @@ -22,11 +21,13 @@ final class HistoryToolbarView: UIView {
22 21 let menuItems: [UIMenuElement] = menuCases.allCases.map { $0.action }
23 22 obj.menu = UIMenu(title: StringConstants.menuTitle, children: menuItems)
24 23 obj.showsMenuAsPrimaryAction = true
  24 +
25 25 return obj
26 26 }()
27 27
28 28 override init(frame: CGRect) {
29 29 super.init(frame: frame)
  30 +
30 31 setupUI()
31 32 }
32 33
... ... @@ -43,9 +44,9 @@ final class HistoryToolbarView: UIView {
43 44
44 45 private func setupConstraints() {
45 46 cleanHistoryButton.snp.makeConstraints { make in
  47 + make.top.bottom.equalToSuperview()
46 48 make.trailing.equalToSuperview().inset(20.sizeW)
47 49 make.height.equalTo(20.sizeH)
48   - make.top.bottom.equalToSuperview()
49 50 }
50 51 }
51 52 }
... ...
... ... @@ -4,7 +4,7 @@
4 4 //
5 5 // Created by Artem Talko on 29.09.2023.
6 6 //
7   -//MARK: Checked
  7 +
8 8 import UIKit
9 9
10 10 final class HistoryView: UIView {
... ... @@ -12,22 +12,26 @@ final class HistoryView: UIView {
12 12 let obj = HistorySearchBarView()
13 13 obj.layer.cornerRadius = 10
14 14 obj.backgroundColor = UIColor(red: 0.913, green: 0.913, blue: 0.947, alpha: 1)
  15 +
15 16 return obj
16 17 }()
17 18
18 19 let historyTabsTableView: UITableView = {
19 20 let obj = UITableView()
20 21 obj.separatorStyle = .none
  22 +
21 23 return obj
22 24 }()
23 25
24 26 let historyToolbarView: HistoryToolbarView = {
25 27 let obj = HistoryToolbarView()
  28 +
26 29 return obj
27 30 }()
28 31
29 32 override init(frame: CGRect) {
30 33 super.init(frame: frame)
  34 +
31 35 setupUI()
32 36 }
33 37
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 25.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9 import SnapKit
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 25.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9 import SnapKit
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 25.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 12.10.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 26.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 27.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 25.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 26.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 25.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 27.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 01.10.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 29.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9 import SnapKit
... ...
... ... @@ -4,7 +4,7 @@
4 4 //
5 5 // Created by Artem Talko on 05.10.2023.
6 6 //
7   -//MARK: Checked
  7 +
8 8
9 9 import UIKit
10 10 import WebKit
... ... @@ -39,7 +39,7 @@ final class SearchResultViewController: UIViewController {
39 39 urlChecker(searchLink)
40 40 setupAdBlocker()
41 41 }
42   -
  42 +
43 43 override func viewIsAppearing(_ animated: Bool) {
44 44 navigationController?.isNavigationBarHidden = true
45 45 }
... ... @@ -47,8 +47,8 @@ final class SearchResultViewController: UIViewController {
47 47
48 48 extension SearchResultViewController {
49 49 private func urlChecker(_ url: String) {
50   - let request = URLRequest(url: URL(string: url) ?? URL(fileURLWithPath: ""))
51   - mainView.searchResultView.load(request)
  50 + let request = URLRequest(url: URL(string: url) ?? URL(fileURLWithPath: ""))
  51 + mainView.searchResultView.load(request)
52 52 }
53 53 }
54 54
... ... @@ -56,17 +56,17 @@ extension SearchResultViewController {
56 56 //MARK: AdBlocker
57 57 extension SearchResultViewController {
58 58 private func setupAdBlocker() {
59   - let userDefaultsValue = CachingManager.shared.isAdBlocking
60   - if userDefaultsValue {
  59 + let userDefaultsAdblockKey = CachingManager.shared.isAdBlocking
  60 + if userDefaultsAdblockKey {
61 61 WKContentRuleListStore.default().getAvailableContentRuleListIdentifiers { res in
62   - if let url = Bundle.main.url(forResource: "blockerList", withExtension: "json"),
63   - let str = try? String(contentsOf: url) {
64   - WKContentRuleListStore.default().compileContentRuleList(forIdentifier: "blockerList", encodedContentRuleList: str) { list, error in
65   - if let list {
66   - self.mainView.searchResultView.configuration.userContentController.add(list)
67   - }
  62 + if let url = Bundle.main.url(forResource: "blockerList", withExtension: "json"),
  63 + let str = try? String(contentsOf: url) {
  64 + WKContentRuleListStore.default().compileContentRuleList(forIdentifier: "blockerList", encodedContentRuleList: str) { list, error in
  65 + if let list {
  66 + self.mainView.searchResultView.configuration.userContentController.add(list)
68 67 }
69 68 }
  69 + }
70 70 }
71 71 } else {
72 72 WKContentRuleListStore.default().getAvailableContentRuleListIdentifiers { res in
... ...
... ... @@ -4,7 +4,7 @@
4 4 //
5 5 // Created by Artem Talko on 05.10.2023.
6 6 //
7   -//MARK: Checked
  7 +
8 8 import UIKit
9 9 import WebKit
10 10
... ... @@ -13,6 +13,7 @@ final class SearchResultView: UIView {
13 13 let obj = WKWebView()
14 14 obj.allowsBackForwardNavigationGestures = true
15 15 obj.allowsLinkPreview = true
  16 +
16 17 return obj
17 18 }()
18 19
... ... @@ -28,8 +29,8 @@ final class SearchResultView: UIView {
28 29
29 30 private func setup() {
30 31 backgroundColor = .white
31   -
32 32 addSubview(searchResultView)
  33 +
33 34 setupConstaraints()
34 35 }
35 36
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 29.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ... @@ -56,6 +55,7 @@ extension SearchingViewController: UITableViewDelegate, UITableViewDataSource {
56 55 }
57 56 let searchCellData = searchRequestData[indexPath.row]
58 57 cell.model = searchCellData
  58 +
59 59 return cell
60 60 }
61 61
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 29.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ... @@ -62,6 +61,7 @@ final class SearchingTableViewCell: UITableViewCell {
62 61 contentView.addSubview(searchLabel)
63 62 contentView.addSubview(siteLogoImage)
64 63 contentView.addSubview(linkImage)
  64 +
65 65 setupConstraints()
66 66 }
67 67
... ...
... ... @@ -4,7 +4,7 @@
4 4 //
5 5 // Created by Artem Talko on 29.09.2023.
6 6 //
7   -//MARK: Checked
  7 +
8 8 import UIKit
9 9
10 10 final class SearchingView: UIView, UITextFieldDelegate {
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 08.11.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ... @@ -15,6 +14,7 @@ final class PrivacyView: UIView {
15 14 obj.numberOfLines = 0
16 15 obj.textAlignment = .center
17 16 obj.font = FontConstants.semiboldFont_18
  17 +
18 18 return obj
19 19 }()
20 20
... ... @@ -23,6 +23,7 @@ final class PrivacyView: UIView {
23 23 obj.text = StringConstants.settingTerms
24 24 obj.numberOfLines = 0
25 25 obj.font = FontConstants.regularFont_18
  26 +
26 27 return obj
27 28 }()
28 29
... ... @@ -32,18 +33,21 @@ final class PrivacyView: UIView {
32 33 obj.layer.cornerRadius = 10
33 34 obj.setTitle(StringConstants.settingAgreeButtonText, for: .normal)
34 35 obj.setTitleColor(.black, for: .normal)
  36 +
35 37 return obj
36 38 }()
37 39
38 40 private let privacyStackView: UIStackView = {
39 41 let obj = UIStackView()
40 42 obj.axis = .vertical
  43 +
41 44 return obj
42 45 }()
43 46
44 47 private let privacyScrollView: UIScrollView = {
45 48 let obj = UIScrollView()
46 49 obj.showsVerticalScrollIndicator = false
  50 +
47 51 return obj
48 52 }()
49 53
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 08.11.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 08.11.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8
10 9 import UIKit
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 28.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9 import RealmSwift
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 28.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9 import SnapKit
... ... @@ -27,6 +26,7 @@ final class OpenedTabsCollectionViewCell: UICollectionViewCell {
27 26 private let siteNameLabel: UILabel = {
28 27 let obj = UILabel()
29 28 obj.font = FontConstants.regularFont_14
  29 +
30 30 return obj
31 31 }()
32 32
... ... @@ -34,12 +34,14 @@ final class OpenedTabsCollectionViewCell: UICollectionViewCell {
34 34 let obj = UIView()
35 35 obj.clipsToBounds = true
36 36 obj.layer.cornerRadius = 10
  37 +
37 38 return obj
38 39 }()
39 40
40 41 private let sitePreviewImage: UIImageView = {
41 42 let obj = UIImageView()
42 43 obj.contentMode = .scaleAspectFill
  44 +
43 45 return obj
44 46 }()
45 47
... ... @@ -48,6 +50,7 @@ final class OpenedTabsCollectionViewCell: UICollectionViewCell {
48 50 obj.setImage(UIImage(systemName: "xmark"), for: .normal)
49 51 obj.contentMode = .scaleAspectFill
50 52 obj.tintColor = .gray
  53 +
51 54 return obj
52 55 }()
53 56
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 28.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9
... ...
... ... @@ -4,7 +4,6 @@
4 4 //
5 5 // Created by Artem Talko on 28.09.2023.
6 6 //
7   -//MARK: Checked
8 7
9 8 import UIKit
10 9 import SnapKit
... ... @@ -31,6 +30,7 @@ final class TabsView: UIView {
31 30
32 31 override init(frame: CGRect) {
33 32 super.init(frame: frame)
  33 +
34 34 setupUI()
35 35 }
36 36
... ...
Please register or login to post a comment