mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
added messagesrootviewcontroller for the split pane thingy added messagespacklistview to select packs n stuff added .description to packs for easier display updated stickerdatasource to take a pack for filtering messagesvc needs to be cleaned ps i tried a splitviewcontroller but it didnt do the split
61 lines
1.6 KiB
Swift
61 lines
1.6 KiB
Swift
//
|
|
// MessagesPackListView.swift
|
|
// StickerSlackiMessageApp
|
|
//
|
|
// Created by neon443 on 24/07/2026.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
class MessagesPackListView: UITableViewController {
|
|
var emojiHoarder: EmojiHoarder!
|
|
var onSelect: ((EmojiPack) -> Void)?
|
|
|
|
init(hoarder: EmojiHoarder) {
|
|
self.emojiHoarder = hoarder
|
|
super.init(style: .plain)
|
|
}
|
|
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
func packFor(indexPath: IndexPath) -> EmojiPack? {
|
|
guard emojiHoarder.emojiPacks.indices.contains(indexPath.row) else { return nil }
|
|
return emojiHoarder.emojiPacks[indexPath.row]
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
// self.splitViewController?.preferredPrimaryColumnWidth = UIScreen.main.bounds.width/4
|
|
return
|
|
}
|
|
|
|
override func viewWillAppear(_ animated: Bool) {
|
|
super.viewWillAppear(animated)
|
|
}
|
|
|
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
return emojiHoarder.emojiPacks.count
|
|
}
|
|
|
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
let cell = UITableViewCell()
|
|
var config = cell.defaultContentConfiguration()
|
|
|
|
if let pack = packFor(indexPath: indexPath) {
|
|
config.text = pack.name
|
|
config.secondaryText = pack.description
|
|
config.textProperties.font = UIFont.systemFont(ofSize: 14)
|
|
config.secondaryTextProperties.font = UIFont.systemFont(ofSize: 14)
|
|
}
|
|
|
|
cell.contentConfiguration = config
|
|
return cell
|
|
}
|
|
|
|
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
onSelect?(emojiHoarder.emojiPacks[indexPath.row])
|
|
}
|
|
}
|