mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 20:54:51 +00:00
adfg
This commit is contained in:
4 files changed
+19
-11
No files matched your search
@@ -139,8 +139,14 @@ struct EmojiPack: Identifiable, Codable, Equatable, Hashable {
|
||||
func downloadedFraction(in hoarder: EmojiHoarder) -> Double {
|
||||
guard !items.isEmpty else { return 0 }
|
||||
guard !allDownloaded(in: hoarder) else { return 1 }
|
||||
return Double(downloadCount(in: hoarder))/Double(items.count)
|
||||
}
|
||||
|
||||
func downloadCount(in hoarder: EmojiHoarder) -> Int {
|
||||
guard !items.isEmpty else { return 0 }
|
||||
guard !allDownloaded(in: hoarder) else { return self.items.count }
|
||||
let common = hoarder.downloadedStickers.intersection(items)
|
||||
return Double(common.count)/Double(items.count)
|
||||
return common.count
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,6 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
|
||||
cellForItemAt indexPath: IndexPath
|
||||
) -> UICollectionViewCell {
|
||||
let cell: PlainEmojiCollectionViewCell
|
||||
guard !hoarder.trie.dict.isEmpty else { return UICollectionViewCell() }
|
||||
let emojiName = items[indexPath.item]
|
||||
|
||||
switch style {
|
||||
@@ -206,7 +205,7 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
|
||||
let pack = hoarder.emojiPacks[packIndex]
|
||||
return UIAction(
|
||||
title: pack.name,
|
||||
subtitle: "\(pack.items.count) item\(pack.items.count.plural)",
|
||||
subtitle: "\(pack.items.count) emoji\(pack.items.count.plural)",
|
||||
image: pack.items.contains(emojiName) ? UIImage(systemName: "checkmark") : nil
|
||||
) { action in
|
||||
hoarder.emojiPacks[packIndex].addRemove(emojiName)
|
||||
|
||||
@@ -168,7 +168,14 @@ class EmojiPackDetailViewController: UIViewController {
|
||||
items = [self.collectionView.editButtonItem, self.adderSheetButton]
|
||||
}
|
||||
} else {
|
||||
let dotdotdotButton = UIBarButtonItem(title: "menu", image: UIImage(systemName: "ellipsis"), primaryAction: nil, menu: UIMenu(children: [shareButton, downloadButton]))
|
||||
let shareMenu = UIMenu(options: .displayInline, children: [shareButton])
|
||||
let menu = UIMenu(children: [downloadButton, shareMenu])
|
||||
let dotdotdotButton = UIBarButtonItem(
|
||||
title: "menu",
|
||||
image: UIImage(systemName: "ellipsis"),
|
||||
primaryAction: nil,
|
||||
menu: menu
|
||||
)
|
||||
items = [self.collectionView.editButtonItem, dotdotdotButton]
|
||||
}
|
||||
self.navigationItem.setRightBarButtonItems(items, animated: true)
|
||||
|
||||
@@ -34,7 +34,7 @@ class EmojiPackListView: UITableViewController {
|
||||
action: #selector(multiDelete)
|
||||
)
|
||||
self.multiDeleteButton.tintColor = .systemRed
|
||||
self.multiDeleteLabel = UIBarButtonItem(title: "8", style: .plain, target: self, action: nil)
|
||||
self.multiDeleteLabel = UIBarButtonItem(title: "X", style: .plain, target: self, action: nil)
|
||||
self.navigationItem.rightBarButtonItem = self.editButtonItem
|
||||
|
||||
self.navigationItem.leftBarButtonItem = UIBarButtonItem(
|
||||
@@ -56,7 +56,7 @@ class EmojiPackListView: UITableViewController {
|
||||
let pack = emojiHoarder.emojiPacks[indexPath.row]
|
||||
|
||||
content.text = pack.name
|
||||
content.secondaryText = "\(pack.items.count) item\(pack.items.count.plural)"
|
||||
content.secondaryText = "\(pack.items.count) emoji\(pack.items.count.plural)"
|
||||
|
||||
cell.contentConfiguration = content
|
||||
|
||||
@@ -142,7 +142,7 @@ class EmojiPackListView: UITableViewController {
|
||||
title.text = pack.name
|
||||
title.font = .boldSystemFont(ofSize: title.font.pointSize)
|
||||
let subtitle = UILabel()
|
||||
subtitle.text = "\(pack.items.count) item\(pack.items.count.plural)"
|
||||
subtitle.text = "\(pack.items.count) emoji\(pack.items.count.plural)"
|
||||
subtitle.textColor = .gray
|
||||
|
||||
let stackView = UIStackView(arrangedSubviews: [title, subtitle])
|
||||
@@ -205,10 +205,6 @@ class EmojiPackListView: UITableViewController {
|
||||
)
|
||||
}
|
||||
|
||||
@objc func refresh(_ notification: Notification) {
|
||||
// self.tableView.reloadData()
|
||||
}
|
||||
|
||||
func delete(_ indexPath: IndexPath) {
|
||||
guard let pack = packFor(indexPath: indexPath) else { return }
|
||||
|
||||
|
||||