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> = TableModel()
model.add(.vpn)
model.add(.trust)
model.add(.wifi)
model.add(.cellular)
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.Trust.header, for: .trust)
model.setHeader(L10n.Shortcuts.Sections.Wifi.header, for: .wifi)
model.setHeader(L10n.Shortcuts.Sections.Cellular.header, for: .cellular)
return model
}()
@ -59,7 +62,9 @@ extension ShortcutsViewController {
enum SectionType {
case vpn
case trust
case wifi
case cellular
}
enum RowType {
@ -69,9 +74,9 @@ extension ShortcutsViewController {
case disableVPN
case trustWiFi
case trustCurrentWiFi
case untrustWiFi
case untrustCurrentWiFi
case trustCellular
@ -102,11 +107,11 @@ extension ShortcutsViewController {
case .disableVPN:
cell.leftText = L10n.Shortcuts.Cells.DisableVpn.caption
case .trustWiFi:
cell.leftText = L10n.Shortcuts.Cells.TrustWifi.caption
case .trustCurrentWiFi:
cell.leftText = L10n.Shortcuts.Cells.TrustCurrentWifi.caption
case .untrustWiFi:
cell.leftText = L10n.Shortcuts.Cells.UntrustWifi.caption
case .untrustCurrentWiFi:
cell.leftText = L10n.Shortcuts.Cells.UntrustCurrentWifi.caption
case .trustCellular:
cell.leftText = L10n.Shortcuts.Cells.TrustCellular.caption
@ -132,10 +137,10 @@ extension ShortcutsViewController {
case .disableVPN:
addDisable()
case .trustWiFi:
case .trustCurrentWiFi:
addTrustWiFi()
case .untrustWiFi:
case .untrustCurrentWiFi:
addUntrustWiFi()
case .trustCellular:

View File

@ -197,12 +197,13 @@
"issue_reporter.email.description" = "description of the issue:";
"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.enable_vpn.caption" = "Enable VPN";
"shortcuts.cells.disable_vpn.caption" = "Disable VPN";
"shortcuts.cells.trust_wifi.caption" = "Trust current Wi-Fi";
"shortcuts.cells.untrust_wifi.caption" = "Untrust current Wi-Fi";
"shortcuts.cells.trust_current_wifi.caption" = "Trust current Wi-Fi";
"shortcuts.cells.untrust_current_wifi.caption" = "Untrust current Wi-Fi";
"shortcuts.cells.trust_cellular.caption" = "Trust cellular network";
"shortcuts.cells.untrust_cellular.caption" = "Untrust cellular network";
"shortcuts.alerts.no_profiles.message" = "There is no profile to connect to.";

View File

@ -684,28 +684,32 @@ public enum L10n {
/// Trust cellular network
public static let caption = L10n.tr("Localizable", "shortcuts.cells.trust_cellular.caption")
}
public enum TrustWifi {
public enum TrustCurrentWifi {
/// 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 {
/// Untrust cellular network
public static let caption = L10n.tr("Localizable", "shortcuts.cells.untrust_cellular.caption")
}
public enum UntrustWifi {
public enum UntrustCurrentWifi {
/// 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 Trust {
/// Trust
public static let header = L10n.tr("Localizable", "shortcuts.sections.trust.header")
public enum Cellular {
/// Cellular
public static let header = L10n.tr("Localizable", "shortcuts.sections.cellular.header")
}
public enum Vpn {
/// VPN
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")
}
}
}