mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
increase performance??
This commit is contained in:
8 files changed
+52
-27
No files matched your search
@@ -46,6 +46,7 @@ struct DownloadedView: View {
|
||||
pack: nil,
|
||||
width: 75,
|
||||
style: .plainWithMenu,
|
||||
animate: false,
|
||||
edit: false
|
||||
)
|
||||
// GeometryReader { geo in
|
||||
|
||||
@@ -31,7 +31,8 @@ struct JumboMojiTestView: View {
|
||||
items: jumboMoji.items,
|
||||
pack: nil,
|
||||
width: CGFloat(jumboMoji.width),
|
||||
style: .jumboMoji
|
||||
style: .jumboMoji,
|
||||
animate: false
|
||||
)
|
||||
.frame(width: 100, height: 100)
|
||||
Text(jumboMoji.description)
|
||||
|
||||
@@ -144,17 +144,26 @@ extension View {
|
||||
}
|
||||
|
||||
struct fadeIn: ViewModifier {
|
||||
@State private var enabled: Bool
|
||||
@State private var isVisible: Bool = false
|
||||
|
||||
init(enabled: Bool = true) {
|
||||
self.enabled = enabled
|
||||
}
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.opacity(isVisible ? 1 : 0)
|
||||
.scaleEffect(isVisible ? 1 : 0)
|
||||
.onAppear {
|
||||
withAnimation { isVisible = true }
|
||||
}
|
||||
.onDisappear {
|
||||
withAnimation { isVisible = false }
|
||||
}
|
||||
if enabled {
|
||||
content
|
||||
.opacity(isVisible ? 1 : 0)
|
||||
.scaleEffect(isVisible ? 1 : 0)
|
||||
.onAppear {
|
||||
withAnimation { isVisible = true }
|
||||
}
|
||||
.onDisappear {
|
||||
withAnimation { isVisible = false }
|
||||
}
|
||||
} else {
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,23 +11,24 @@ import Haptics
|
||||
struct StickerPreview: View {
|
||||
@State var sticker: any StickerProtocol
|
||||
@State var gifImage: Image?
|
||||
@State var animate: Bool = true
|
||||
|
||||
var body: some View {
|
||||
if sticker.isLocal {
|
||||
//local
|
||||
GifView(url: sticker.localImageURL)
|
||||
GifView(url: sticker.localImageURL, animate: animate)
|
||||
} else {
|
||||
//remote
|
||||
if sticker.type == .slackEmoji {
|
||||
GifView(url: sticker.remoteImageURL)
|
||||
GifView(url: sticker.remoteImageURL, animate: animate)
|
||||
} else {
|
||||
let gif = sticker as! Gif
|
||||
if let giphyImages = gif.giphyImages,
|
||||
let preview_gif = giphyImages.preview_gif,
|
||||
let url = URL(string: preview_gif.url) {
|
||||
GifView(url: url)
|
||||
GifView(url: url, animate: animate)
|
||||
} else {
|
||||
GifView(url: gif.remoteImageURL)
|
||||
GifView(url: gif.remoteImageURL, animate: animate)
|
||||
.overlay {
|
||||
Image(systemName:
|
||||
"square.arrowtriangle.4.outward")
|
||||
|
||||