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)
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 {
/// 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
"ui.connection_status.on_demand_suffix" = " (on-demand)";
"ui.interactive_coordinator.title" = "Interactive";
"ui.profile_context.connect_to" = "Connect to...";
// MARK: - Paywalls

View File

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