Reorganize shortcut sections

This commit is contained in:
Davide De Rosa 2019-03-19 17:35:27 +01:00
parent c0be33dacc
commit 63d74b6feb
3 changed files with 32 additions and 22 deletions

View File

@ -34,11 +34,14 @@ class ShortcutsViewController: UITableViewController, TableModelHost {
let model: TableModel<SectionType, RowType> = { let model: TableModel<SectionType, RowType> = {
let model: TableModel<SectionType, RowType> = TableModel() let model: TableModel<SectionType, RowType> = TableModel()
model.add(.vpn) model.add(.vpn)
model.add(.trust) model.add(.wifi)
model.add(.cellular)
model.set([.connect, .enableVPN, .disableVPN], in: .vpn) model.set([.connect, .enableVPN, .disableVPN], in: .vpn)
model.set([.trustWiFi, .untrustWiFi, .trustCellular, .untrustCellular], in: .trust) model.set([.trustCurrentWiFi, .untrustCurrentWiFi], in: .wifi)
model.set([.trustCellular, .untrustCellular], in: .cellular)
model.setHeader(L10n.Shortcuts.Sections.Vpn.header, for: .vpn) model.setHeader(L10n.Shortcuts.Sections.Vpn.header, for: .vpn)
model.setHeader(L10n.Shortcuts.Sections.Trust.header, for: .trust) model.setHeader(L10n.Shortcuts.Sections.Wifi.header, for: .wifi)
model.setHeader(L10n.Shortcuts.Sections.Cellular.header, for: .cellular)
return model return model
}() }()
@ -59,7 +62,9 @@ extension ShortcutsViewController {
enum SectionType { enum SectionType {
case vpn case vpn
case trust case wifi
case cellular
} }
enum RowType { enum RowType {
@ -69,9 +74,9 @@ extension ShortcutsViewController {
case disableVPN case disableVPN
case trustWiFi case trustCurrentWiFi
case untrustWiFi case untrustCurrentWiFi
case trustCellular case trustCellular
@ -102,11 +107,11 @@ extension ShortcutsViewController {
case .disableVPN: case .disableVPN:
cell.leftText = L10n.Shortcuts.Cells.DisableVpn.caption cell.leftText = L10n.Shortcuts.Cells.DisableVpn.caption
case .trustWiFi: case .trustCurrentWiFi:
cell.leftText = L10n.Shortcuts.Cells.TrustWifi.caption cell.leftText = L10n.Shortcuts.Cells.TrustCurrentWifi.caption
case .untrustWiFi: case .untrustCurrentWiFi:
cell.leftText = L10n.Shortcuts.Cells.UntrustWifi.caption cell.leftText = L10n.Shortcuts.Cells.UntrustCurrentWifi.caption
case .trustCellular: case .trustCellular:
cell.leftText = L10n.Shortcuts.Cells.TrustCellular.caption cell.leftText = L10n.Shortcuts.Cells.TrustCellular.caption
@ -132,10 +137,10 @@ extension ShortcutsViewController {
case .disableVPN: case .disableVPN:
addDisable() addDisable()
case .trustWiFi: case .trustCurrentWiFi:
addTrustWiFi() addTrustWiFi()
case .untrustWiFi: case .untrustCurrentWiFi:
addUntrustWiFi() addUntrustWiFi()
case .trustCellular: case .trustCellular:

View File

@ -197,12 +197,13 @@
"issue_reporter.email.description" = "description of the issue:"; "issue_reporter.email.description" = "description of the issue:";
"shortcuts.sections.vpn.header" = "VPN"; "shortcuts.sections.vpn.header" = "VPN";
"shortcuts.sections.trust.header" = "Trust"; "shortcuts.sections.wifi.header" = "Wi-Fi";
"shortcuts.sections.cellular.header" = "Cellular";
"shortcuts.cells.connect.caption" = "Connect to"; "shortcuts.cells.connect.caption" = "Connect to";
"shortcuts.cells.enable_vpn.caption" = "Enable VPN"; "shortcuts.cells.enable_vpn.caption" = "Enable VPN";
"shortcuts.cells.disable_vpn.caption" = "Disable VPN"; "shortcuts.cells.disable_vpn.caption" = "Disable VPN";
"shortcuts.cells.trust_wifi.caption" = "Trust current Wi-Fi"; "shortcuts.cells.trust_current_wifi.caption" = "Trust current Wi-Fi";
"shortcuts.cells.untrust_wifi.caption" = "Untrust current Wi-Fi"; "shortcuts.cells.untrust_current_wifi.caption" = "Untrust current Wi-Fi";
"shortcuts.cells.trust_cellular.caption" = "Trust cellular network"; "shortcuts.cells.trust_cellular.caption" = "Trust cellular network";
"shortcuts.cells.untrust_cellular.caption" = "Untrust cellular network"; "shortcuts.cells.untrust_cellular.caption" = "Untrust cellular network";
"shortcuts.alerts.no_profiles.message" = "There is no profile to connect to."; "shortcuts.alerts.no_profiles.message" = "There is no profile to connect to.";

View File

@ -684,28 +684,32 @@ public enum L10n {
/// Trust cellular network /// Trust cellular network
public static let caption = L10n.tr("Localizable", "shortcuts.cells.trust_cellular.caption") public static let caption = L10n.tr("Localizable", "shortcuts.cells.trust_cellular.caption")
} }
public enum TrustWifi { public enum TrustCurrentWifi {
/// Trust current Wi-Fi /// Trust current Wi-Fi
public static let caption = L10n.tr("Localizable", "shortcuts.cells.trust_wifi.caption") public static let caption = L10n.tr("Localizable", "shortcuts.cells.trust_current_wifi.caption")
} }
public enum UntrustCellular { public enum UntrustCellular {
/// Untrust cellular network /// Untrust cellular network
public static let caption = L10n.tr("Localizable", "shortcuts.cells.untrust_cellular.caption") public static let caption = L10n.tr("Localizable", "shortcuts.cells.untrust_cellular.caption")
} }
public enum UntrustWifi { public enum UntrustCurrentWifi {
/// Untrust current Wi-Fi /// Untrust current Wi-Fi
public static let caption = L10n.tr("Localizable", "shortcuts.cells.untrust_wifi.caption") public static let caption = L10n.tr("Localizable", "shortcuts.cells.untrust_current_wifi.caption")
} }
} }
public enum Sections { public enum Sections {
public enum Trust { public enum Cellular {
/// Trust /// Cellular
public static let header = L10n.tr("Localizable", "shortcuts.sections.trust.header") public static let header = L10n.tr("Localizable", "shortcuts.sections.cellular.header")
} }
public enum Vpn { public enum Vpn {
/// VPN /// VPN
public static let header = L10n.tr("Localizable", "shortcuts.sections.vpn.header") public static let header = L10n.tr("Localizable", "shortcuts.sections.vpn.header")
} }
public enum Wifi {
/// Wi-Fi
public static let header = L10n.tr("Localizable", "shortcuts.sections.wifi.header")
}
} }
} }