mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
i think ive fixed all the performance issues w searching
This commit is contained in:
5 files changed
+38
-19
No files matched your search
@@ -14,6 +14,7 @@ struct GifView: View {
|
||||
@State var url: URL
|
||||
@State var gif: [(frame: CGImage, showFor: Double)] = []
|
||||
@State var currentI: Int = 0
|
||||
@State var isVisible: Bool = false
|
||||
|
||||
@State var timer: Timer?
|
||||
|
||||
@@ -62,7 +63,7 @@ struct GifView: View {
|
||||
Group {
|
||||
if gif.isEmpty {
|
||||
ProgressView()
|
||||
// .controlSize(.large)
|
||||
.modifier(fadeIn())
|
||||
} else if url.pathExtension == "gif" {
|
||||
TimelineView(.animation) { tl in
|
||||
if currentI < gif.count {
|
||||
|
||||
@@ -142,3 +142,19 @@ extension View {
|
||||
modifier(TabViewBottomAcceessorySafe(isEnabled: isEnabled, contents: content))
|
||||
}
|
||||
}
|
||||
|
||||
struct fadeIn: ViewModifier {
|
||||
@State private var isVisible: Bool = false
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.opacity(isVisible ? 1 : 0)
|
||||
.scaleEffect(isVisible ? 1 : 0)
|
||||
.onAppear {
|
||||
withAnimation { isVisible = true }
|
||||
}
|
||||
.onDisappear {
|
||||
withAnimation { isVisible = false }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,10 @@ struct EmojiTableView: UIViewRepresentable {
|
||||
context.coordinator.items = items
|
||||
// guard itemsBefore != itemsAfter else { return }
|
||||
Task.detached {
|
||||
if itemsBefore.count-itemsAfter.count > 10_000 {
|
||||
//removing more than 10k
|
||||
if !(-10_000...10_000).contains(itemsBefore.count-itemsAfter.count) {
|
||||
//diff of more than 10k
|
||||
await context.coordinator.instantApplySnapshot()
|
||||
} else if itemsAfter == itemsBefore {
|
||||
await context.coordinator.instantApplySnapshot()
|
||||
} else {
|
||||
await context.coordinator.applySnapshot(animated: true)
|
||||
|
||||