Display subscription icons in the iOS subscription view
This commit is contained in:
@ -123,7 +123,7 @@ struct SubscriptionCell: View {
|
||||
let subscription: Subscription
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
Text(subscription.name)
|
||||
.font(.appCallout)
|
||||
@ -140,7 +140,28 @@ struct SubscriptionCell: View {
|
||||
}
|
||||
.multilineTextAlignment(.leading)
|
||||
.padding(.vertical, 8)
|
||||
.frame(minHeight: 50)
|
||||
|
||||
Spacer()
|
||||
|
||||
Group {
|
||||
if let icon = subscription.icon, let imageURL = URL(string: icon) {
|
||||
AsyncImage(url: imageURL) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: 40, height: 40)
|
||||
.cornerRadius(6)
|
||||
} else if phase.error != nil {
|
||||
EmptyView().frame(width: 40, height: 40, alignment: .top)
|
||||
} else {
|
||||
Color.appButtonBackground
|
||||
.frame(width: 40, height: 40)
|
||||
.cornerRadius(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.frame(minHeight: 50)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ public struct Subscription {
|
||||
public let unsubscribeMailTo: String?
|
||||
public let updatedAt: Date?
|
||||
public let url: String?
|
||||
public let icon: String?
|
||||
|
||||
public init(
|
||||
createdAt: Date?,
|
||||
@ -22,7 +23,8 @@ public struct Subscription {
|
||||
unsubscribeHttpUrl: String?,
|
||||
unsubscribeMailTo: String?,
|
||||
updatedAt: Date?,
|
||||
url: String?
|
||||
url: String?,
|
||||
icon: String?
|
||||
) {
|
||||
self.createdAt = createdAt
|
||||
self.description = description
|
||||
@ -34,6 +36,7 @@ public struct Subscription {
|
||||
self.unsubscribeMailTo = unsubscribeMailTo
|
||||
self.updatedAt = updatedAt
|
||||
self.url = url
|
||||
self.icon = icon
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,8 @@ public extension DataService {
|
||||
unsubscribeHttpUrl: try $0.unsubscribeHttpUrl(),
|
||||
unsubscribeMailTo: try $0.unsubscribeMailTo(),
|
||||
updatedAt: try $0.updatedAt().value,
|
||||
url: try $0.url()
|
||||
url: try $0.url(),
|
||||
icon: try $0.icon()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user