mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 05:19:13 +00:00
gifs dont stop animating on reappear now :yay:
This commit is contained in:
@@ -30,16 +30,19 @@ struct GifView: View {
|
|||||||
}
|
}
|
||||||
.onDisappear {
|
.onDisappear {
|
||||||
timer?.invalidate()
|
timer?.invalidate()
|
||||||
|
timer = nil
|
||||||
}
|
}
|
||||||
.task {
|
.task {
|
||||||
|
if gif.isEmpty {
|
||||||
self.gif = await GifManager.gifFrom(url: url)
|
self.gif = await GifManager.gifFrom(url: url)
|
||||||
guard gif.count > 0 else {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
guard timer == nil else {
|
guard gif.count > 0 else { return }
|
||||||
|
|
||||||
|
if timer != nil {
|
||||||
timer!.invalidate()
|
timer!.invalidate()
|
||||||
return
|
timer = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
timer = Timer(timeInterval: gif[0].showFor, repeats: true) { timer in
|
timer = Timer(timeInterval: gif[0].showFor, repeats: true) { timer in
|
||||||
if currentI == (gif.count-1) {
|
if currentI == (gif.count-1) {
|
||||||
currentI = 0
|
currentI = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user