diff --git a/Signal/src/Loki/View Controllers/PathVC.swift b/Signal/src/Loki/View Controllers/PathVC.swift index 4e8d01a5c..732c8c151 100644 --- a/Signal/src/Loki/View Controllers/PathVC.swift +++ b/Signal/src/Loki/View Controllers/PathVC.swift @@ -21,10 +21,10 @@ final class PathVC : BaseVC { return result }() - private lazy var rebuildPathButton: Button = { + private lazy var learnMoreButton: Button = { let result = Button(style: .prominentOutline, size: .large) - result.setTitle(NSLocalizedString("Rebuild Path", comment: ""), for: UIControl.State.normal) - result.addTarget(self, action: #selector(rebuildPath), for: UIControl.Event.touchUpInside) + result.setTitle(NSLocalizedString("Learn More", comment: ""), for: UIControl.State.normal) + result.addTarget(self, action: #selector(learnMore), for: UIControl.Event.touchUpInside) return result }() @@ -44,9 +44,6 @@ final class PathVC : BaseVC { let closeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "X"), style: .plain, target: self, action: #selector(close)) closeButton.tintColor = Colors.text navigationItem.leftBarButtonItem = closeButton - let learnMoreButton = UIBarButtonItem(image: #imageLiteral(resourceName: "QuestionMark").scaled(to: CGSize(width: 24, height: 24)), style: .plain, target: self, action: #selector(learnMore)) - learnMoreButton.tintColor = Colors.text - navigationItem.rightBarButtonItem = learnMoreButton } private func setUpViewHierarchy() { @@ -72,17 +69,17 @@ final class PathVC : BaseVC { pathStackViewContainer.bottomAnchor.constraint(greaterThanOrEqualTo: spinner.bottomAnchor).isActive = true spinner.center(in: pathStackViewContainer) // Set up rebuild path button - let rebuildPathButtonContainer = UIView() - rebuildPathButtonContainer.addSubview(rebuildPathButton) - rebuildPathButton.pin(.leading, to: .leading, of: rebuildPathButtonContainer, withInset: 80) - rebuildPathButton.pin(.top, to: .top, of: rebuildPathButtonContainer) - rebuildPathButtonContainer.pin(.trailing, to: .trailing, of: rebuildPathButton, withInset: 80) - rebuildPathButtonContainer.pin(.bottom, to: .bottom, of: rebuildPathButton) + let learnMoreButtonContainer = UIView() + learnMoreButtonContainer.addSubview(learnMoreButton) + learnMoreButton.pin(.leading, to: .leading, of: learnMoreButtonContainer, withInset: 80) + learnMoreButton.pin(.top, to: .top, of: learnMoreButtonContainer) + learnMoreButtonContainer.pin(.trailing, to: .trailing, of: learnMoreButton, withInset: 80) + learnMoreButtonContainer.pin(.bottom, to: .bottom, of: learnMoreButton) // Set up spacers let topSpacer = UIView.vStretchingSpacer() let bottomSpacer = UIView.vStretchingSpacer() // Set up main stack view - let mainStackView = UIStackView(arrangedSubviews: [ explanationLabel, topSpacer, pathStackViewContainer, bottomSpacer, rebuildPathButtonContainer ]) + let mainStackView = UIStackView(arrangedSubviews: [ explanationLabel, topSpacer, pathStackViewContainer, bottomSpacer, learnMoreButtonContainer ]) mainStackView.axis = .vertical mainStackView.alignment = .fill mainStackView.layoutMargins = UIEdgeInsets(top: Values.largeSpacing, left: Values.largeSpacing, bottom: Values.largeSpacing, right: Values.largeSpacing) @@ -125,18 +122,12 @@ final class PathVC : BaseVC { spinner.stopAnimating() UIView.animate(withDuration: 0.25) { self.spinner.alpha = 0 - self.rebuildPathButton.layer.borderColor = Colors.accent.cgColor - self.rebuildPathButton.setTitleColor(Colors.accent, for: UIControl.State.normal) } - rebuildPathButton.isEnabled = true } else { spinner.startAnimating() UIView.animate(withDuration: 0.25) { self.spinner.alpha = 1 - self.rebuildPathButton.layer.borderColor = Colors.text.withAlphaComponent(Values.unimportantElementOpacity).cgColor - self.rebuildPathButton.setTitleColor(Colors.text.withAlphaComponent(Values.unimportantElementOpacity), for: UIControl.State.normal) } - rebuildPathButton.isEnabled = false } } @@ -201,19 +192,6 @@ final class PathVC : BaseVC { let url = URL(string: urlAsString)! UIApplication.shared.open(url) } - - @objc private func rebuildPath() { - // Dispatch async on the main queue to avoid nested write transactions - DispatchQueue.main.async { - let storage = OWSPrimaryStorage.shared() - storage.dbReadWriteConnection.readWrite { transaction in - storage.clearOnionRequestPaths(in: transaction) - } - } - OnionRequestAPI.guardSnodes = [] - OnionRequestAPI.paths = [] - let _ = OnionRequestAPI.buildPaths() - } } // MARK: Line View diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 5974c9c93..e1d298acb 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -2839,4 +2839,4 @@ "Service Node" = "Service Node"; "You" = "You"; "Destination" = "Destination"; -"Rebuild Path" = "Rebuild Path"; +"Learn More" = "Learn More";