mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
fix delete button not spawning half the time
This commit is contained in:
1 file changed
+3
-5
@@ -133,7 +133,7 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
|
|||||||
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "plain", for: indexPath) as! PlainEmojiCollectionViewCell
|
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "plain", for: indexPath) as! PlainEmojiCollectionViewCell
|
||||||
case .full, .plainWithLabel:
|
case .full, .plainWithLabel:
|
||||||
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "full", for: indexPath) as! EmojiCollectionViewCell
|
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "full", for: indexPath) as! EmojiCollectionViewCell
|
||||||
(cell as! EmojiCollectionViewCell).setEdit(to: isEditing)
|
(cell as! EmojiCollectionViewCell).setEdit(to: parent?.isEditing ?? false)
|
||||||
(cell as! EmojiCollectionViewCell).onRemove = {
|
(cell as! EmojiCollectionViewCell).onRemove = {
|
||||||
guard let index = self.items.firstIndex(of: $0) else { return }
|
guard let index = self.items.firstIndex(of: $0) else { return }
|
||||||
self.items.remove(at: index)
|
self.items.remove(at: index)
|
||||||
@@ -240,11 +240,9 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
|
|||||||
menuChildrem.append(UIMenu(options: .displayInline, children: [copyName, copyImage, share]))
|
menuChildrem.append(UIMenu(options: .displayInline, children: [copyName, copyImage, share]))
|
||||||
|
|
||||||
let delete = UIAction(title: "Delete", image: UIImage(systemName: "trash")) { action in
|
let delete = UIAction(title: "Delete", image: UIImage(systemName: "trash")) { action in
|
||||||
Task.detached {
|
|
||||||
await self.hoarder.delete(emoji: self.hoarder.trie.dict[emojiName])
|
|
||||||
}
|
|
||||||
self.items.remove(at: indexPath.row)
|
|
||||||
Task.detached { @MainActor in
|
Task.detached { @MainActor in
|
||||||
|
await self.hoarder.delete(emoji: self.hoarder.trie.dict[emojiName])
|
||||||
|
self.items.remove(at: indexPath.row)
|
||||||
await self.applySnapshot(animated: true)
|
await self.applySnapshot(animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||