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