mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 20:54:51 +00:00
remove the rror state for stickers cos icba and fixed random divider on the packmanager
This commit is contained in:
2 files changed
+7
-17
No files matched your search
@@ -30,6 +30,7 @@ struct EmojiPackManager: View {
|
||||
.tint(.red)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
NavigationLink {
|
||||
EmojiPackDetailView(hoarder: hoarder, pack: .constant(.test))
|
||||
} label: {
|
||||
@@ -50,7 +51,6 @@ struct EmojiPackManager: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ struct GifView: View {
|
||||
@State var currentI: Int = 0
|
||||
|
||||
@State var timer: Timer?
|
||||
@State var error: Error?
|
||||
@State var failed: Bool = false
|
||||
|
||||
func run() async {
|
||||
do {
|
||||
@@ -28,15 +26,11 @@ struct GifView: View {
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
self.error = error
|
||||
}
|
||||
guard self.error == nil && !self.gif.isEmpty else {
|
||||
print(error)
|
||||
print(error.localizedDescription)
|
||||
print("falied loading or empty gif")
|
||||
withAnimation(.spring) { self.failed = true }
|
||||
return
|
||||
}
|
||||
guard gif.count > 0 else { return }
|
||||
|
||||
if timer != nil {
|
||||
timer!.invalidate()
|
||||
timer = nil
|
||||
@@ -56,16 +50,10 @@ struct GifView: View {
|
||||
// /*@START_MENU_TOKEN@*//*@PLACEHOLDER=Hello, world!@*/Text("Hello, world!")/*@END_MENU_TOKEN@*/
|
||||
TimelineView(.animation) { tl in
|
||||
VStack {
|
||||
if gif.isEmpty && error == nil {
|
||||
if gif.isEmpty {
|
||||
ProgressView()
|
||||
.controlSize(.large)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
} else if failed {
|
||||
Image(systemName: "xmark")
|
||||
.resizable().scaledToFit()
|
||||
.padding()
|
||||
.padding()
|
||||
.background(.red)
|
||||
} else {
|
||||
if currentI < gif.count {
|
||||
let image = Image(uiImage: .init(cgImage: gif[currentI].frame))
|
||||
@@ -80,11 +68,13 @@ struct GifView: View {
|
||||
timer?.invalidate()
|
||||
timer = nil
|
||||
}
|
||||
.task {
|
||||
.onAppear {
|
||||
Task {
|
||||
await run()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
GifView(
|
||||
|
||||