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.providerFullName = providerFullName
|
||||
intent.serverId = server.id
|
||||
intent.serverName = server.localizedLongDescription
|
||||
intent.serverName = server.localizedLongDescription(withCategory: false)
|
||||
return intent
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class DefaultLightProviderServer: LightProviderServer {
|
|||
|
||||
init(_ server: ProviderServer) {
|
||||
description = server.localizedShortDescriptionWithDefault
|
||||
longDescription = server.localizedLongDescription
|
||||
longDescription = server.localizedLongDescription(withCategory: false)
|
||||
categoryName = server.categoryName
|
||||
locationId = server.locationId
|
||||
serverId = server.id
|
||||
|
|
|
@ -107,7 +107,7 @@ extension ProfileView {
|
|||
}
|
||||
|
||||
private var currentProviderServerDescription: String? {
|
||||
profile.providerServer(providerManager)?.localizedLongDescription
|
||||
profile.providerServer(providerManager)?.localizedLongDescription(withCategory: true)
|
||||
}
|
||||
|
||||
private var currentProviderCountryImage: Image? {
|
||||
|
|
|
@ -93,17 +93,17 @@ extension ProviderServer {
|
|||
localizedShortDescription ?? "\(L10n.Global.Strings.default) [\(apiId)]"
|
||||
}
|
||||
|
||||
var localizedLongDescription: String {
|
||||
func localizedLongDescription(withCategory: Bool) -> String {
|
||||
var comps: [String] = [localizedCountry]
|
||||
localizedShortDescription.map {
|
||||
comps.append($0)
|
||||
}
|
||||
let desc = comps.joined(separator: ", ")
|
||||
guard !categoryName.isEmpty else {
|
||||
return desc
|
||||
}
|
||||
if withCategory, !categoryName.isEmpty {
|
||||
return "\(categoryName.uppercased()): \(desc)"
|
||||
}
|
||||
return desc
|
||||
}
|
||||
}
|
||||
|
||||
extension ProviderServer.Preset {
|
||||
|
|
Loading…
Reference in New Issue