Define NE configuration title format in Constants

This commit is contained in:
Davide 2024-10-11 17:57:31 +02:00
parent 619ff807fd
commit c96e7e9d6e
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
4 changed files with 8 additions and 5 deletions

View File

@ -70,7 +70,7 @@ public final class AppContext: ObservableObject {
connectionObserver = ConnectionObserver( connectionObserver = ConnectionObserver(
tunnel: tunnel, tunnel: tunnel,
environment: tunnelEnvironment, environment: tunnelEnvironment,
interval: constants.connection.refreshInterval interval: constants.tunnel.refreshInterval
) )
self.registry = registry self.registry = registry
self.providerFactory = providerFactory self.providerFactory = providerFactory

View File

@ -91,7 +91,9 @@ public struct Constants: Decodable, Sendable {
public let timestamp: String public let timestamp: String
} }
public struct Connection: Decodable, Sendable { public struct Tunnel: Decodable, Sendable {
public let profileTitleFormat: String
public let refreshInterval: TimeInterval public let refreshInterval: TimeInterval
} }
@ -150,7 +152,7 @@ public struct Constants: Decodable, Sendable {
public let formats: Formats public let formats: Formats
public let connection: Connection public let tunnel: Tunnel
public let api: API public let api: API

View File

@ -20,7 +20,8 @@
"formats": { "formats": {
"timestamp": "yyyy-MM-dd HH:mm:ss" "timestamp": "yyyy-MM-dd HH:mm:ss"
}, },
"connection": { "tunnel": {
"profileTitleFormat": "Passepartout: %@",
"refreshInterval": 3.0 "refreshInterval": 3.0
}, },
"api": { "api": {

View File

@ -218,7 +218,7 @@ extension ProviderFactory {
private extension ProfileManager { private extension ProfileManager {
static let sharedTitle: (Profile) -> String = { static let sharedTitle: (Profile) -> String = {
"Passepartout: \($0.name)" String(format: Constants.shared.tunnel.profileTitleFormat, $0.name)
} }
} }