mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 05:19:13 +00:00
update emojpreview
This commit is contained in:
@@ -18,40 +18,29 @@ struct EmojiPreview: View {
|
||||
VStack(alignment: .leading) {
|
||||
Text(emoji.name)
|
||||
Group {
|
||||
if emoji.isLocal {
|
||||
Image(uiImage: emoji.image ?? UIImage())
|
||||
.resizable().scaledToFit()
|
||||
.border(.orange)
|
||||
.overlay(alignment: .bottomLeading) {
|
||||
Image(systemName: "arrow.down.circle.fill")
|
||||
.resizable().scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.shadow(radius: 1)
|
||||
}
|
||||
} else {
|
||||
AsyncImage(url: emoji.remoteImageURL) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable().scaledToFit()
|
||||
} else if phase.error != nil {
|
||||
ZStack {
|
||||
Image(systemName: "xmark.app.fill")
|
||||
AsyncImage(url: emoji.localImageURL) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable().scaledToFit()
|
||||
} else if phase.error != nil {
|
||||
ImageErrorView()
|
||||
.onTapGesture {
|
||||
id = UUID()
|
||||
}
|
||||
} else {
|
||||
AsyncImage(url: emoji.remoteImageURL) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable().scaledToFit()
|
||||
.padding()
|
||||
.padding()
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.foregroundStyle(.red)
|
||||
.onAppear {
|
||||
id = UUID()
|
||||
}
|
||||
} else if phase.error != nil {
|
||||
ImageErrorView()
|
||||
.onTapGesture {
|
||||
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