Make category optional in server long description
This commit is contained in:
parent
8f999a462e
commit
26c34638cb
|
@ -48,7 +48,7 @@ class IntentDispatcher {
|
||||||
intent.profileId = header.id.uuidString
|
intent.profileId = header.id.uuidString
|
||||||
intent.providerFullName = providerFullName
|
intent.providerFullName = providerFullName
|
||||||
intent.serverId = server.id
|
intent.serverId = server.id
|
||||||
intent.serverName = server.localizedLongDescription
|
intent.serverName = server.localizedLongDescription(withCategory: false)
|
||||||
return intent
|
return intent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class DefaultLightProviderServer: LightProviderServer {
|
||||||
|
|
||||||
init(_ server: ProviderServer) {
|
init(_ server: ProviderServer) {
|
||||||
description = server.localizedShortDescriptionWithDefault
|
description = server.localizedShortDescriptionWithDefault
|
||||||
longDescription = server.localizedLongDescription
|
longDescription = server.localizedLongDescription(withCategory: false)
|
||||||
categoryName = server.categoryName
|
categoryName = server.categoryName
|
||||||
locationId = server.locationId
|
locationId = server.locationId
|
||||||
serverId = server.id
|
serverId = server.id
|
||||||
|
|
|
@ -107,7 +107,7 @@ extension ProfileView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private var currentProviderServerDescription: String? {
|
private var currentProviderServerDescription: String? {
|
||||||
profile.providerServer(providerManager)?.localizedLongDescription
|
profile.providerServer(providerManager)?.localizedLongDescription(withCategory: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var currentProviderCountryImage: Image? {
|
private var currentProviderCountryImage: Image? {
|
||||||
|
|
|
@ -93,17 +93,17 @@ extension ProviderServer {
|
||||||
localizedShortDescription ?? "\(L10n.Global.Strings.default) [\(apiId)]"
|
localizedShortDescription ?? "\(L10n.Global.Strings.default) [\(apiId)]"
|
||||||
}
|
}
|
||||||
|
|
||||||
var localizedLongDescription: String {
|
func localizedLongDescription(withCategory: Bool) -> String {
|
||||||
var comps: [String] = [localizedCountry]
|
var comps: [String] = [localizedCountry]
|
||||||
localizedShortDescription.map {
|
localizedShortDescription.map {
|
||||||
comps.append($0)
|
comps.append($0)
|
||||||
}
|
}
|
||||||
let desc = comps.joined(separator: ", ")
|
let desc = comps.joined(separator: ", ")
|
||||||
guard !categoryName.isEmpty else {
|
if withCategory, !categoryName.isEmpty {
|
||||||
return desc
|
|
||||||
}
|
|
||||||
return "\(categoryName.uppercased()): \(desc)"
|
return "\(categoryName.uppercased()): \(desc)"
|
||||||
}
|
}
|
||||||
|
return desc
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProviderServer.Preset {
|
extension ProviderServer.Preset {
|
||||||
|
|
Loading…
Reference in New Issue