From c96e7e9d6e0a5f1e1cdb49c0ca082db4b99f3f8d Mon Sep 17 00:00:00 2001 From: Davide Date: Fri, 11 Oct 2024 17:57:31 +0200 Subject: [PATCH] Define NE configuration title format in Constants --- .../Library/Sources/AppUI/Business/AppContext.swift | 2 +- .../Library/Sources/CommonLibrary/Domain/Constants.swift | 6 ++++-- .../Library/Sources/CommonLibrary/Resources/Constants.json | 3 ++- Passepartout/Shared/Shared+App.swift | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Passepartout/Library/Sources/AppUI/Business/AppContext.swift b/Passepartout/Library/Sources/AppUI/Business/AppContext.swift index 36d2d3aa..280bb1b1 100644 --- a/Passepartout/Library/Sources/AppUI/Business/AppContext.swift +++ b/Passepartout/Library/Sources/AppUI/Business/AppContext.swift @@ -70,7 +70,7 @@ public final class AppContext: ObservableObject { connectionObserver = ConnectionObserver( tunnel: tunnel, environment: tunnelEnvironment, - interval: constants.connection.refreshInterval + interval: constants.tunnel.refreshInterval ) self.registry = registry self.providerFactory = providerFactory diff --git a/Passepartout/Library/Sources/CommonLibrary/Domain/Constants.swift b/Passepartout/Library/Sources/CommonLibrary/Domain/Constants.swift index 90e2763d..7e71bc42 100644 --- a/Passepartout/Library/Sources/CommonLibrary/Domain/Constants.swift +++ b/Passepartout/Library/Sources/CommonLibrary/Domain/Constants.swift @@ -91,7 +91,9 @@ public struct Constants: Decodable, Sendable { public let timestamp: String } - public struct Connection: Decodable, Sendable { + public struct Tunnel: Decodable, Sendable { + public let profileTitleFormat: String + public let refreshInterval: TimeInterval } @@ -150,7 +152,7 @@ public struct Constants: Decodable, Sendable { public let formats: Formats - public let connection: Connection + public let tunnel: Tunnel public let api: API diff --git a/Passepartout/Library/Sources/CommonLibrary/Resources/Constants.json b/Passepartout/Library/Sources/CommonLibrary/Resources/Constants.json index ef0676fb..6bac93a2 100644 --- a/Passepartout/Library/Sources/CommonLibrary/Resources/Constants.json +++ b/Passepartout/Library/Sources/CommonLibrary/Resources/Constants.json @@ -20,7 +20,8 @@ "formats": { "timestamp": "yyyy-MM-dd HH:mm:ss" }, - "connection": { + "tunnel": { + "profileTitleFormat": "Passepartout: %@", "refreshInterval": 3.0 }, "api": { diff --git a/Passepartout/Shared/Shared+App.swift b/Passepartout/Shared/Shared+App.swift index ed54a803..ec4060be 100644 --- a/Passepartout/Shared/Shared+App.swift +++ b/Passepartout/Shared/Shared+App.swift @@ -218,7 +218,7 @@ extension ProviderFactory { private extension ProfileManager { static let sharedTitle: (Profile) -> String = { - "Passepartout: \($0.name)" + String(format: Constants.shared.tunnel.profileTitleFormat, $0.name) } }