Move proxy settings to advanced privacy settings

This commit is contained in:
Nora Trapp 2022-09-26 12:45:15 -07:00 committed by Nora Trapp
parent 323bbb5a4b
commit 110aa9ab6b
5 changed files with 38 additions and 30 deletions

View File

@ -25,12 +25,6 @@ class DataSettingsTableViewController: OWSTableViewController2 {
name: CallService.callServicePreferencesDidChange,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(preferencesDidChange),
name: .isSignalProxyReadyDidChange,
object: nil
)
}
func updateTableContents() {
@ -147,22 +141,6 @@ class DataSettingsTableViewController: OWSTableViewController2 {
))
contents.addSection(callsSection)
let proxySection = OWSTableSection()
proxySection.headerTitle = NSLocalizedString(
"PROXY_SETTINGS_TITLE",
comment: "Title for the signal proxy settings"
)
proxySection.add(.disclosureItem(
withText: NSLocalizedString("USE_PROXY_BUTTON", comment: "Button to activate the signal proxy"),
detailText: SignalProxy.isEnabled ? CommonStrings.switchOn : CommonStrings.switchOff,
actionBlock: { [weak self] in
self?.showProxySettings()
}
))
contents.addSection(proxySection)
}
// MARK: - Events
@ -203,11 +181,6 @@ class DataSettingsTableViewController: OWSTableViewController2 {
navigationController?.pushViewController(view, animated: true)
}
private func showProxySettings() {
let vc = ProxySettingsViewController()
navigationController?.pushViewController(vc, animated: true)
}
@objc
func preferencesDidChange() {
AssertIsOnMainThread()

View File

@ -67,7 +67,14 @@ class ProxySettingsViewController: OWSTableViewController2, OWSNavigationView {
defer { self.contents = contents }
let useProxySection = OWSTableSection()
useProxySection.footerTitle = NSLocalizedString("USE_PROXY_EXPLANATION", comment: "Explanation of when you should use a signal proxy")
useProxySection.footerAttributedTitle = .composed(of: [
NSLocalizedString("USE_PROXY_EXPLANATION", comment: "Explanation of when you should use a signal proxy"),
" ",
CommonStrings.learnMore.styled(with: .link(URL(string: "https://support.signal.org/hc/en-us/articles/360056052052-Proxy-Support")!))
]).styled(
with: .font(.ows_dynamicTypeCaption1Clamped),
.color(Theme.secondaryTextAndIconColor)
)
useProxySection.add(.switch(
withText: NSLocalizedString("USE_PROXY_BUTTON", comment: "Button to activate the signal proxy"),
isOn: { [weak self] in

View File

@ -34,6 +34,12 @@ class AdvancedPrivacySettingsViewController: OWSTableViewController2 {
name: .OWSSyncManagerConfigurationSyncDidComplete,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(updateTableContents),
name: .isSignalProxyReadyDidChange,
object: nil
)
}
override func viewWillAppear(_ animated: Bool) {
@ -138,6 +144,28 @@ class AdvancedPrivacySettingsViewController: OWSTableViewController2 {
contents.addSection(censorshipCircumventionSection)
let proxySection = OWSTableSection()
proxySection.footerAttributedTitle = .composed(of: [
NSLocalizedString("USE_PROXY_EXPLANATION", comment: "Explanation of when you should use a signal proxy"),
" ",
CommonStrings.learnMore.styled(with: .link(URL(string: "https://support.signal.org/hc/en-us/articles/360056052052-Proxy-Support")!))
]).styled(
with: .font(.ows_dynamicTypeCaption1Clamped),
.color(Theme.secondaryTextAndIconColor)
)
proxySection.add(.disclosureItem(
withText: NSLocalizedString(
"PROXY_SETTINGS_TITLE",
comment: "Title for the signal proxy settings"
),
detailText: SignalProxy.isEnabled ? CommonStrings.switchOn : CommonStrings.switchOff,
actionBlock: { [weak self] in
let vc = ProxySettingsViewController()
self?.navigationController?.pushViewController(vc, animated: true)
}
))
contents.addSection(proxySection)
let relayCallsSection = OWSTableSection()
relayCallsSection.footerTitle = NSLocalizedString(
"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE_DETAIL",

View File

@ -491,7 +491,7 @@ public extension ChatListViewController {
let boost = BoostViewController()
viewControllers += [ boost ]
case .proxy:
viewControllers += [ DataSettingsTableViewController(), ProxySettingsViewController() ]
viewControllers += [ PrivacySettingsViewController(), AdvancedPrivacySettingsViewController(), ProxySettingsViewController() ]
}
navigationController.setViewControllers(viewControllers, animated: false)
presentFormSheet(navigationController, animated: true, completion: completion)

View File

@ -5894,7 +5894,7 @@
"SETTINGS_PINS_TITLE" = "PIN код за Signal";
/* Footer for table section */
"SETTINGS_PRIVACY_ADVANCED_FOOTER" = "Censorship circumvention, relay calls, and sealed sender settings.";
"SETTINGS_PRIVACY_ADVANCED_FOOTER" = "Censorship circumvention, proxy, relay calls, and sealed sender settings.";
/* Title for the advanced privacy settings */
"SETTINGS_PRIVACY_ADVANCED_TITLE" = "Допълнителни";