Use profile name as interactive view title

This commit is contained in:
Davide 2024-11-03 11:44:14 +01:00
parent fbe2d84113
commit 1d2de39d49
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
3 changed files with 9 additions and 7 deletions

View File

@ -531,10 +531,6 @@ public enum Strings {
/// (on-demand) /// (on-demand)
public static let onDemandSuffix = Strings.tr("Localizable", "ui.connection_status.on_demand_suffix", fallback: " (on-demand)") public static let onDemandSuffix = Strings.tr("Localizable", "ui.connection_status.on_demand_suffix", fallback: " (on-demand)")
} }
public enum InteractiveCoordinator {
/// Interactive
public static let title = Strings.tr("Localizable", "ui.interactive_coordinator.title", fallback: "Interactive")
}
public enum ProfileContext { public enum ProfileContext {
/// Connect to... /// Connect to...
public static let connectTo = Strings.tr("Localizable", "ui.profile_context.connect_to", fallback: "Connect to...") public static let connectTo = Strings.tr("Localizable", "ui.profile_context.connect_to", fallback: "Connect to...")

View File

@ -246,7 +246,6 @@
// MARK: - Components // MARK: - Components
"ui.connection_status.on_demand_suffix" = " (on-demand)"; "ui.connection_status.on_demand_suffix" = " (on-demand)";
"ui.interactive_coordinator.title" = "Interactive";
"ui.profile_context.connect_to" = "Connect to..."; "ui.profile_context.connect_to" = "Connect to...";
// MARK: - Paywalls // MARK: - Paywalls

View File

@ -52,6 +52,7 @@ public struct InteractiveCoordinator: View {
case .modal: case .modal:
interactiveView interactiveView
.modifier(ModalInteractiveModifier( .modifier(ModalInteractiveModifier(
title: title,
confirm: confirm, confirm: confirm,
cancel: cancel cancel: cancel
)) ))
@ -59,7 +60,7 @@ public struct InteractiveCoordinator: View {
case .inline(let withCancel): case .inline(let withCancel):
interactiveView interactiveView
.modifier(InlineInteractiveModifier( .modifier(InlineInteractiveModifier(
title: manager.editor.profile.name, title: title,
withCancel: withCancel, withCancel: withCancel,
confirm: confirm, confirm: confirm,
cancel: cancel cancel: cancel
@ -72,6 +73,8 @@ public struct InteractiveCoordinator: View {
private extension InteractiveCoordinator { private extension InteractiveCoordinator {
struct ModalInteractiveModifier: ViewModifier { struct ModalInteractiveModifier: ViewModifier {
let title: String
let confirm: () -> Void let confirm: () -> Void
let cancel: () -> Void let cancel: () -> Void
@ -83,7 +86,7 @@ private extension InteractiveCoordinator {
} }
.themeForm() .themeForm()
.themeNavigationDetail() .themeNavigationDetail()
.navigationTitle(Strings.Ui.InteractiveCoordinator.title) .navigationTitle(title)
.toolbar(content: modalToolbar) .toolbar(content: modalToolbar)
} }
} }
@ -166,6 +169,10 @@ private extension InteractiveCoordinator {
AnyView(provider.interactiveView(with: manager.editor, onSubmit: confirm)) AnyView(provider.interactiveView(with: manager.editor, onSubmit: confirm))
} }
var title: String {
manager.editor.profile.name
}
func confirm() { func confirm() {
Task { Task {
do { do {