Refactor theme section and some phrases
This commit is contained in:
parent
0917e47ea3
commit
429e79cd3a
|
@ -372,6 +372,8 @@ public enum Strings {
|
|||
public enum Interactive {
|
||||
/// On-demand will be disabled.
|
||||
public static let footer = Strings.tr("Localizable", "modules.openvpn.credentials.interactive.footer", fallback: "On-demand will be disabled.")
|
||||
/// Log in interactively
|
||||
public static let purchase = Strings.tr("Localizable", "modules.openvpn.credentials.interactive.purchase", fallback: "Log in interactively")
|
||||
}
|
||||
public enum OtpMethod {
|
||||
public enum Approach {
|
||||
|
@ -382,10 +384,6 @@ public enum Strings {
|
|||
}
|
||||
}
|
||||
}
|
||||
public enum Purchase {
|
||||
/// Log in interactively
|
||||
public static let interactive = Strings.tr("Localizable", "modules.openvpn.purchase.interactive", fallback: "Log in interactively")
|
||||
}
|
||||
}
|
||||
public enum Wireguard {
|
||||
/// Allowed IPs
|
||||
|
|
|
@ -179,7 +179,6 @@
|
|||
"modules.on_demand.ethernet" = "Ethernet";
|
||||
"modules.on_demand.ssid.add" = "Add SSID";
|
||||
|
||||
"modules.openvpn.purchase.interactive" = "Log in interactively";
|
||||
"modules.openvpn.pull" = "Pull";
|
||||
"modules.openvpn.redirect_gateway" = "Redirect gateway";
|
||||
"modules.openvpn.credentials" = "Credentials";
|
||||
|
@ -196,6 +195,7 @@
|
|||
"modules.openvpn.randomize_endpoint" = "Randomize endpoint";
|
||||
"modules.openvpn.randomize_hostname" = "Randomize hostname";
|
||||
"modules.openvpn.credentials.interactive" = "Interactive";
|
||||
"modules.openvpn.credentials.interactive.purchase" = "Log in interactively";
|
||||
"modules.openvpn.credentials.interactive.footer" = "On-demand will be disabled.";
|
||||
"modules.openvpn.credentials.otp_method.approach.append" = "The OTP will be appended to the password.";
|
||||
"modules.openvpn.credentials.otp_method.approach.encode" = "The OTP will be encoded in Base64 with the password.";
|
||||
|
|
|
@ -113,7 +113,7 @@ private extension OnDemandView {
|
|||
Text($0.localizedDescription)
|
||||
}
|
||||
}
|
||||
.themeSectionWithFooter(policyFooterDescription)
|
||||
.themeSection(footer: policyFooterDescription)
|
||||
}
|
||||
|
||||
var policyFooterDescription: String {
|
||||
|
|
|
@ -89,7 +89,7 @@ private extension OpenVPNView.CredentialsView {
|
|||
var restrictedArea: some View {
|
||||
switch iapManager.paywallReason(forFeature: .interactiveLogin) {
|
||||
case .purchase(let appFeature):
|
||||
Button(Strings.Modules.Openvpn.Purchase.interactive) {
|
||||
Button(Strings.Modules.Openvpn.Credentials.Interactive.purchase) {
|
||||
paywallReason = .purchase(appFeature)
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ private extension OpenVPNView.CredentialsView {
|
|||
}
|
||||
}
|
||||
}
|
||||
.themeSectionWithFooter(interactiveFooter)
|
||||
.themeSection(footer: interactiveFooter)
|
||||
}
|
||||
|
||||
var interactiveFooter: String? {
|
||||
|
@ -140,7 +140,7 @@ private extension OpenVPNView.CredentialsView {
|
|||
.textContentType(.oneTimeCode)
|
||||
}
|
||||
}
|
||||
.themeSectionWithFooter(inputFooter)
|
||||
.themeSection(footer: inputFooter)
|
||||
}
|
||||
|
||||
var inputFooter: String? {
|
||||
|
|
|
@ -39,7 +39,7 @@ struct ProfileGeneralView: View {
|
|||
placeholder: Strings.Placeholders.Profile.name
|
||||
)
|
||||
EmptyView()
|
||||
.themeSectionWithFooter(Strings.Views.Profile.ModuleList.Section.footer)
|
||||
.themeSection(footer: Strings.Views.Profile.ModuleList.Section.footer)
|
||||
StorageSection(
|
||||
uuid: profileEditor.id
|
||||
)
|
||||
|
|
|
@ -187,7 +187,9 @@ struct ThemeAnimationModifier<T>: ViewModifier where T: Equatable {
|
|||
}
|
||||
}
|
||||
|
||||
struct ThemeSectionWithFooterModifier: ViewModifier {
|
||||
struct ThemeSectionWithHeaderFooterModifier: ViewModifier {
|
||||
let header: String?
|
||||
|
||||
let footer: String?
|
||||
}
|
||||
|
||||
|
|
|
@ -68,10 +68,12 @@ extension ThemeManualInputModifier {
|
|||
}
|
||||
}
|
||||
|
||||
extension ThemeSectionWithFooterModifier {
|
||||
extension ThemeSectionWithHeaderFooterModifier {
|
||||
func body(content: Content) -> some View {
|
||||
Section {
|
||||
content
|
||||
} header: {
|
||||
header.map(Text.init)
|
||||
} footer: {
|
||||
footer.map(Text.init)
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ extension ThemeManualInputModifier {
|
|||
}
|
||||
}
|
||||
|
||||
extension ThemeSectionWithFooterModifier {
|
||||
extension ThemeSectionWithHeaderFooterModifier {
|
||||
|
||||
@ViewBuilder
|
||||
func body(content: Content) -> some View {
|
||||
|
@ -82,6 +82,8 @@ extension ThemeSectionWithFooterModifier {
|
|||
.font(.callout)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
} header: {
|
||||
header.map(Text.init)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,8 +189,8 @@ extension View {
|
|||
modifier(ThemeAnimationModifier(value: value, category: category))
|
||||
}
|
||||
|
||||
public func themeSectionWithFooter(_ footer: String?) -> some View {
|
||||
modifier(ThemeSectionWithFooterModifier(footer: footer))
|
||||
public func themeSection(header: String? = nil, footer: String? = nil) -> some View {
|
||||
modifier(ThemeSectionWithHeaderFooterModifier(header: header, footer: footer))
|
||||
}
|
||||
|
||||
public func themeGridHeader(title: String?) -> some View {
|
||||
|
|
Loading…
Reference in New Issue