From 93abc9e9a94ce5e99065626e9898f06cfa2f16b6 Mon Sep 17 00:00:00 2001 From: Bruno Muniz Azevedo Filho <bruno@elixxir.io> Date: Thu, 11 Aug 2022 14:51:55 -0300 Subject: [PATCH] Fix MR comments --- Package.swift | 2 +- Sources/LaunchFeature/LaunchViewModel.swift | 23 +++--------------- .../OnboardingStartController.swift | 1 + .../OnboardingUsernameController.swift | 21 +--------------- Sources/Shared/Extensions/NavigationBar.swift | 8 +++++-- .../TermsConditionsController.swift | 24 ++----------------- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- 7 files changed, 16 insertions(+), 67 deletions(-) diff --git a/Package.swift b/Package.swift index 2c6601fb..b8f43d82 100644 --- a/Package.swift +++ b/Package.swift @@ -116,7 +116,7 @@ let package = Package( ), .package( url: "https://git.xx.network/elixxir/client-ios-db.git", - branch: "feature/blocked-and-banned-contacts" + .upToNextMajor(from: "1.1.0") ), .package( url: "https://github.com/firebase/firebase-ios-sdk.git", diff --git a/Sources/LaunchFeature/LaunchViewModel.swift b/Sources/LaunchFeature/LaunchViewModel.swift index 9dea87ed..9f815af4 100644 --- a/Sources/LaunchFeature/LaunchViewModel.swift +++ b/Sources/LaunchFeature/LaunchViewModel.swift @@ -86,8 +86,7 @@ final class LaunchViewModel { Task { do { network.writeLogs() - let bannedList = try await fetchBannedList() - process(bannedList: bannedList) + let _ = try await fetchBannedList() network.updateNDF { [weak self] in guard let self = self else { return } @@ -209,14 +208,9 @@ final class LaunchViewModel { } private func fetchBannedList() async throws -> Data { - let request = URLRequest( - url: URL(string: "https://elixxir-bins.s3.us-west-1.amazonaws.com/client/bannedUsers/banned.csv")!, - cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, - timeoutInterval: 5 - ) - + let url = URL(string: "https://elixxir-bins.s3.us-west-1.amazonaws.com/client/bannedUsers/banned.csv") return try await withCheckedThrowingContinuation { continuation in - URLSession.shared.dataTask(with: request) { data, _, error in + URLSession.shared.dataTask(with: url!) { data, _, error in if let error = error { return continuation.resume(throwing: error) } @@ -226,15 +220,4 @@ final class LaunchViewModel { }.resume() } } - - private func process(bannedList: Data) { - if let csv: CSV = try? CSV<Enumerated>( - string: String(data: bannedList, encoding: .utf8)!, - loadColumns: false - ) { - /// csv.rows[0][0] == userId - /// csv.rows[0][1] == username - csv.rows.forEach { print("^^^ Banned row: \($0)") } - } - } } diff --git a/Sources/OnboardingFeature/Controllers/OnboardingStartController.swift b/Sources/OnboardingFeature/Controllers/OnboardingStartController.swift index 7ef1bae8..d9b97032 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingStartController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingStartController.swift @@ -27,6 +27,7 @@ public final class OnboardingStartController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" navigationController?.navigationBar.customize(translucent: true) } diff --git a/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift b/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift index b1d3feb5..761128f1 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift @@ -23,6 +23,7 @@ public final class OnboardingUsernameController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) statusBarController.style.send(.darkContent) + navigationItem.backButtonTitle = "" navigationController?.navigationBar.customize(translucent: true) } @@ -49,26 +50,6 @@ public final class OnboardingUsernameController: UIViewController { } } - private func setupNavigationBar() { - navigationItem.backButtonTitle = "" - - let backButton = UIButton() - backButton.setImage(Asset.navigationBarBack.image, for: .normal) - backButton.tintColor = Asset.neutralActive.color - backButton.imageView?.contentMode = .center - backButton.snp.makeConstraints { $0.width.equalTo(50) } - backButton - .publisher(for: .touchUpInside) - .receive(on: DispatchQueue.main) - .sink { [unowned self] in - navigationController?.popViewController(animated: true) - }.store(in: &cancellables) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [backButton]) - ) - } - private func setupScrollView() { scrollViewController.scrollView.backgroundColor = .white diff --git a/Sources/Shared/Extensions/NavigationBar.swift b/Sources/Shared/Extensions/NavigationBar.swift index 2b4d8d25..b7efcb69 100644 --- a/Sources/Shared/Extensions/NavigationBar.swift +++ b/Sources/Shared/Extensions/NavigationBar.swift @@ -4,14 +4,18 @@ public extension UINavigationBar { func customize( translucent: Bool = false, backgroundColor: UIColor = .clear, - shadowColor: UIColor? = nil + shadowColor: UIColor? = nil, + tint: UIColor = Asset.neutralActive.color ) { isTranslucent = translucent let barAppearance = UINavigationBarAppearance() barAppearance.backgroundColor = backgroundColor barAppearance.backgroundEffect = .none barAppearance.shadowColor = shadowColor + + tintColor = tint + compactAppearance = barAppearance standardAppearance = barAppearance - scrollEdgeAppearance = standardAppearance + scrollEdgeAppearance = barAppearance } } diff --git a/Sources/TermsFeature/TermsConditionsController.swift b/Sources/TermsFeature/TermsConditionsController.swift index ea017dd0..0a5b3b5b 100644 --- a/Sources/TermsFeature/TermsConditionsController.swift +++ b/Sources/TermsFeature/TermsConditionsController.swift @@ -36,27 +36,9 @@ public final class TermsConditionsController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() - navigationItem.backButtonTitle = "" - - let backButton = UIButton() - backButton.setImage(Asset.navigationBarBack.image, for: .normal) - backButton.tintColor = Asset.neutralActive.color - backButton.imageView?.contentMode = .center - backButton.snp.makeConstraints { $0.width.equalTo(50) } - backButton - .publisher(for: .touchUpInside) - .receive(on: DispatchQueue.main) - .sink { [unowned self] in - navigationController?.popViewController(animated: true) - }.store(in: &cancellables) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [backButton]) - ) - screenView.radioComponent - .radioButton.publisher(for: .touchUpInside) - .receive(on: DispatchQueue.main) + .radioButton + .publisher(for: .touchUpInside) .sink { [unowned self] in screenView.radioComponent.isEnabled.toggle() screenView.nextButton.isEnabled = screenView.radioComponent.isEnabled @@ -64,7 +46,6 @@ public final class TermsConditionsController: UIViewController { screenView.nextButton .publisher(for: .touchUpInside) - .receive(on: DispatchQueue.main) .sink { [unowned self] in didAcceptTerms = true @@ -77,7 +58,6 @@ public final class TermsConditionsController: UIViewController { screenView.showTermsButton .publisher(for: .touchUpInside) - .receive(on: DispatchQueue.main) .sink { _ in // TODO }.store(in: &cancellables) diff --git a/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved b/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved index 453f1d5d..2edfffa2 100644 --- a/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://git.xx.network/elixxir/client-ios-db.git", "state" : { - "branch" : "feature/blocked-and-banned-contacts", - "revision" : "b35a3779c276471aa6e79f047e1c843e49b0dea8" + "revision" : "f8e3e0088de8301d6c4816e12f0aca1d6f02a280", + "version" : "1.1.0" } }, { -- GitLab