fae1159536
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
879 B
Swift
37 lines
879 B
Swift
import Messages
|
|
import UIKit
|
|
|
|
final class StickerBrowserViewController: MSStickerBrowserViewController {
|
|
private var stickers: [MSSticker] = []
|
|
|
|
init() {
|
|
super.init(stickerSize: .small)
|
|
}
|
|
|
|
@available(*, unavailable)
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) is not supported")
|
|
}
|
|
|
|
func reloadStickers() {
|
|
let urls = StickerStore.shared.stickerFileURLs()
|
|
stickers = urls.compactMap { url in
|
|
try? MSSticker(
|
|
contentsOfFileURL: url,
|
|
localizedDescription: url.deletingLastPathComponent().lastPathComponent
|
|
)
|
|
}
|
|
stickerBrowserView.reloadData()
|
|
}
|
|
|
|
// MARK: - MSStickerBrowserViewDataSource
|
|
|
|
override func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {
|
|
stickers.count
|
|
}
|
|
|
|
override func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker {
|
|
stickers[index]
|
|
}
|
|
}
|