Fix changing SideStore app icon not displaying My Apps

This commit is contained in:
naturecodevoid
2023-02-19 09:16:07 -08:00
parent 839699ee03
commit d9a4b07095
5 changed files with 68 additions and 34 deletions

View File

@@ -10,23 +10,42 @@ import SwiftUI
import AsyncImage
struct AppIconView: View {
@ObservedObject private var iO = Inject.observer
@ObservedObject private var sideStoreIconData = AppIconsData.shared
let iconUrl: URL?
var isSideStore = false
var size: CGFloat = 64
var cornerRadius: CGFloat {
size * 0.234
}
var body: some View {
if let iconUrl {
AsyncImage(url: iconUrl) { image in
image
var image: some View {
if isSideStore {
return AnyView(
Image(uiImage: UIImage(named: sideStoreIconData.selectedIconName! + "-image") ?? UIImage())
.resizable()
} placeholder: {
Color(UIColor.secondarySystemBackground)
}
.renderingMode(.original)
)
}
if let iconUrl {
return AnyView(
AsyncImage(url: iconUrl) { image in
image
.resizable()
} placeholder: {
Color(UIColor.secondarySystemBackground)
}
)
}
return AnyView(Color(UIColor.secondarySystemBackground))
}
var body: some View {
image
.frame(width: size, height: size)
.clipShape(RoundedRectangle(cornerRadius: cornerRadius, style: .continuous))
}
.enableInjection()
}
}

View File

@@ -20,7 +20,7 @@ struct AppRowView: View {
var body: some View {
HStack(alignment: .center, spacing: 12) {
AppIconView(iconUrl: storeApp?.iconURL)
AppIconView(iconUrl: storeApp?.iconURL, isSideStore: storeApp?.bundleIdentifier == Bundle.Info.appbundleIdentifier)
VStack(alignment: .leading, spacing: 2) {
Text(app.name)