Use placeholder when provider logo is missing
So far it's what happens for dynamically added providers, because there is no local asset.
This commit is contained in:
parent
28a7dcdcf7
commit
1619c7f46c
|
@ -284,6 +284,7 @@ internal enum Asset {
|
||||||
internal static let mullvad = ImageAsset(name: "mullvad")
|
internal static let mullvad = ImageAsset(name: "mullvad")
|
||||||
internal static let nordvpn = ImageAsset(name: "nordvpn")
|
internal static let nordvpn = ImageAsset(name: "nordvpn")
|
||||||
internal static let pia = ImageAsset(name: "pia")
|
internal static let pia = ImageAsset(name: "pia")
|
||||||
|
internal static let placeholder = ImageAsset(name: "placeholder")
|
||||||
internal static let protonvpn = ImageAsset(name: "protonvpn")
|
internal static let protonvpn = ImageAsset(name: "protonvpn")
|
||||||
internal static let tunnelbear = ImageAsset(name: "tunnelbear")
|
internal static let tunnelbear = ImageAsset(name: "tunnelbear")
|
||||||
internal static let vyprvpn = ImageAsset(name: "vyprvpn")
|
internal static let vyprvpn = ImageAsset(name: "vyprvpn")
|
||||||
|
|
|
@ -191,7 +191,7 @@ extension MFMailComposeViewController {
|
||||||
|
|
||||||
// FIXME: load from index JSON
|
// FIXME: load from index JSON
|
||||||
extension Infrastructure.Metadata {
|
extension Infrastructure.Metadata {
|
||||||
var logo: UIImage? {
|
var logo: UIImage {
|
||||||
return ImageAsset(name: name.lowercased()).image
|
return ImageAsset(name: name.lowercased()).image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "placeholder@2x.png",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "placeholder@3x.png",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
BIN
Passepartout-iOS/Providers.xcassets/placeholder.imageset/placeholder@2x.png
vendored
Normal file
BIN
Passepartout-iOS/Providers.xcassets/placeholder.imageset/placeholder@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
Passepartout-iOS/Providers.xcassets/placeholder.imageset/placeholder@3x.png
vendored
Normal file
BIN
Passepartout-iOS/Providers.xcassets/placeholder.imageset/placeholder@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
|
@ -473,9 +473,14 @@ extension OrganizerViewController {
|
||||||
case .profile:
|
case .profile:
|
||||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
let rowProfile = profileKey(at: indexPath)
|
let rowProfile = profileKey(at: indexPath)
|
||||||
if rowProfile.context == .provider, let metadata = InfrastructureFactory.shared.metadata(forName: rowProfile.id) {
|
if rowProfile.context == .provider {
|
||||||
cell.imageView?.image = metadata.logo
|
if let metadata = InfrastructureFactory.shared.metadata(forName: rowProfile.id) {
|
||||||
cell.leftText = metadata.description
|
cell.imageView?.image = metadata.logo
|
||||||
|
cell.leftText = metadata.description
|
||||||
|
} else {
|
||||||
|
cell.imageView?.image = Asset.Providers.placeholder.image
|
||||||
|
cell.leftText = rowProfile.id
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cell.imageView?.image = nil
|
cell.imageView?.image = nil
|
||||||
cell.leftText = rowProfile.id
|
cell.leftText = rowProfile.id
|
||||||
|
|
Loading…
Reference in New Issue