mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 13:26:17 +00:00
update emojpreview
This commit is contained in:
@@ -18,40 +18,29 @@ struct EmojiPreview: View {
|
|||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
Text(emoji.name)
|
Text(emoji.name)
|
||||||
Group {
|
Group {
|
||||||
if emoji.isLocal {
|
AsyncImage(url: emoji.localImageURL) { phase in
|
||||||
Image(uiImage: emoji.image ?? UIImage())
|
if let image = phase.image {
|
||||||
.resizable().scaledToFit()
|
image
|
||||||
.border(.orange)
|
.resizable().scaledToFit()
|
||||||
.overlay(alignment: .bottomLeading) {
|
} else if phase.error != nil {
|
||||||
Image(systemName: "arrow.down.circle.fill")
|
ImageErrorView()
|
||||||
.resizable().scaledToFit()
|
.onTapGesture {
|
||||||
.frame(width: 20, height: 20)
|
id = UUID()
|
||||||
.symbolRenderingMode(.hierarchical)
|
}
|
||||||
.shadow(radius: 1)
|
} else {
|
||||||
}
|
AsyncImage(url: emoji.remoteImageURL) { phase in
|
||||||
} else {
|
if let image = phase.image {
|
||||||
AsyncImage(url: emoji.remoteImageURL) { phase in
|
image
|
||||||
if let image = phase.image {
|
|
||||||
image
|
|
||||||
.resizable().scaledToFit()
|
|
||||||
} else if phase.error != nil {
|
|
||||||
ZStack {
|
|
||||||
Image(systemName: "xmark.app.fill")
|
|
||||||
.resizable().scaledToFit()
|
.resizable().scaledToFit()
|
||||||
.padding()
|
} else if phase.error != nil {
|
||||||
.padding()
|
ImageErrorView()
|
||||||
.symbolRenderingMode(.hierarchical)
|
|
||||||
.foregroundStyle(.red)
|
|
||||||
.onAppear {
|
|
||||||
id = UUID()
|
|
||||||
}
|
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
id = UUID()
|
id = UUID()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ProgressView()
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ProgressView()
|
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,3 +59,14 @@ struct EmojiPreview: View {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ImageErrorView: View {
|
||||||
|
var body: some View {
|
||||||
|
Image(systemName: "xmark.app.fill")
|
||||||
|
.resizable().scaledToFit()
|
||||||
|
.padding()
|
||||||
|
.padding()
|
||||||
|
.symbolRenderingMode(.hierarchical)
|
||||||
|
.foregroundStyle(.red)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user