mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-02-16 04:42:11 +00:00
parent
d12590387a
commit
9e7860d390
@ -510,8 +510,10 @@ public enum Strings {
|
||||
}
|
||||
public enum Theme {
|
||||
public enum Confirmation {
|
||||
/// Are you sure?
|
||||
public static let message = Strings.tr("Localizable", "theme.confirmation.message", fallback: "Are you sure?")
|
||||
/// Are you sure you want to proceed with this operation?
|
||||
public static let message = Strings.tr("Localizable", "theme.confirmation.message", fallback: "Are you sure you want to proceed with this operation?")
|
||||
/// Confirm
|
||||
public static let ok = Strings.tr("Localizable", "theme.confirmation.ok", fallback: "Confirm")
|
||||
}
|
||||
}
|
||||
public enum Ui {
|
||||
|
@ -114,7 +114,8 @@
|
||||
|
||||
// MARK: - Theme
|
||||
|
||||
"theme.confirmation.message" = "Are you sure?";
|
||||
"theme.confirmation.ok" = "Confirm";
|
||||
"theme.confirmation.message" = "Are you sure you want to proceed with this operation?";
|
||||
|
||||
// MARK: - Views
|
||||
|
||||
|
@ -148,12 +148,14 @@ struct ThemeConfirmationModifier: ViewModifier {
|
||||
|
||||
let title: String
|
||||
|
||||
let isDestructive: Bool
|
||||
|
||||
let action: () -> Void
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.confirmationDialog(title, isPresented: $isPresented) {
|
||||
Button(Strings.Global.ok, action: action)
|
||||
.confirmationDialog(title, isPresented: $isPresented, titleVisibility: .visible) {
|
||||
Button(Strings.Theme.Confirmation.ok, role: isDestructive ? .destructive : nil, action: action)
|
||||
Text(Strings.Global.cancel)
|
||||
} message: {
|
||||
Text(Strings.Theme.Confirmation.message)
|
||||
|
@ -137,8 +137,18 @@ extension View {
|
||||
))
|
||||
}
|
||||
|
||||
public func themeConfirmation(isPresented: Binding<Bool>, title: String, action: @escaping () -> Void) -> some View {
|
||||
modifier(ThemeConfirmationModifier(isPresented: isPresented, title: title, action: action))
|
||||
public func themeConfirmation(
|
||||
isPresented: Binding<Bool>,
|
||||
title: String,
|
||||
isDestructive: Bool = false,
|
||||
action: @escaping () -> Void
|
||||
) -> some View {
|
||||
modifier(ThemeConfirmationModifier(
|
||||
isPresented: isPresented,
|
||||
title: title,
|
||||
isDestructive: isDestructive,
|
||||
action: action
|
||||
))
|
||||
}
|
||||
|
||||
public func themeNavigationStack(if condition: Bool, closable: Bool = false, path: Binding<NavigationPath>) -> some View {
|
||||
|
@ -80,7 +80,8 @@ private extension SettingsSectionGroup {
|
||||
}
|
||||
.themeConfirmation(
|
||||
isPresented: $isConfirmingEraseiCloud,
|
||||
title: Strings.Views.Settings.Rows.eraseIcloud
|
||||
title: Strings.Views.Settings.Rows.eraseIcloud,
|
||||
isDestructive: true
|
||||
) {
|
||||
isErasingiCloud = true
|
||||
Task {
|
||||
|
Loading…
Reference in New Issue
Block a user