got a split sticker picker setup, blank sticker pane tho

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
This commit is contained in:
Nihaal Sharma committed 2026-07-29 02:04:40 +05:30
1 parent 03d4deaa12
commit 21860a60c1
11 files changed
+252 -18

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
//
// MessagesSplitViewController.swift
// StickerSlackiMessageApp
//
// Created by neon443 on 24/07/2026.
//
import Foundation
import UIKit
import Messages
class MessagesSplitViewController: UISplitViewController, UISplitViewControllerDelegate {
var emojiHoarder: EmojiHoarder!
var tableView: MessagesPackListView!
init(hoarder: EmojiHoarder) {
self.emojiHoarder = hoarder
self.tableView = MessagesPackListView(hoarder: hoarder)
super.init(style: .doubleColumn)
tableView.onSelect = { pack in
let browser = MSStickerBrowserView(frame: .zero, stickerSize: .small)
let dataSource = StickerBrowserDataSource(hoarder: hoarder, pack: pack)
browser.dataSource = dataSource
let vc = MessagesViewController(nibName: nil, bundle: nil)
browser.translatesAutoresizingMaskIntoConstraints = false
vc.view.addSubview(browser)
browser.contentInset = .zero
NSLayoutConstraint.activate([
browser.leadingAnchor.constraint(equalTo: vc.view.leadingAnchor),
browser.trailingAnchor.constraint(equalTo: vc.view.trailingAnchor),
browser.topAnchor.constraint(equalTo: vc.view.topAnchor),
browser.bottomAnchor.constraint(equalTo: vc.view.bottomAnchor)
])
self.setViewController(vc, for: .secondary)
}
self.preferredSplitBehavior = .tile
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
self.setViewController(tableView, for: .primary)
self.setViewController(MessagesPackListView(hoarder: emojiHoarder), for: .secondary)
}
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 {
// <#code#>
// }
//
// override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// <#code#>
// }
}
+16
View File
@@ -44,6 +44,11 @@
A957C17E2ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; }; A957C17E2ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; };
A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; }; A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; };
A957C1802ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; }; A957C1802ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; };
A96D59963013D6450086948E /* MessagesPackListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A96D59953013D6450086948E /* MessagesPackListView.swift */; };
A96D59973013D6670086948E /* MessagesPackListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A96D59953013D6450086948E /* MessagesPackListView.swift */; };
A96D59993013D9050086948E /* MessagesSplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A96D59983013D9050086948E /* MessagesSplitViewController.swift */; };
A96D599A3013DE140086948E /* Int.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A4672F6AA17C00BB84C6 /* Int.swift */; };
A96D599C301945240086948E /* MessagesRootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A96D599B301945240086948E /* MessagesRootViewController.swift */; };
A97322A12FA7B9C8004B657D /* JumboMoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97322A02FA7B9C8004B657D /* JumboMoji.swift */; }; A97322A12FA7B9C8004B657D /* JumboMoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97322A02FA7B9C8004B657D /* JumboMoji.swift */; };
A97322A22FA7B9C8004B657D /* JumboMoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97322A02FA7B9C8004B657D /* JumboMoji.swift */; }; A97322A22FA7B9C8004B657D /* JumboMoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97322A02FA7B9C8004B657D /* JumboMoji.swift */; };
A97322A32FA7B9C8004B657D /* JumboMoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97322A02FA7B9C8004B657D /* JumboMoji.swift */; }; A97322A32FA7B9C8004B657D /* JumboMoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97322A02FA7B9C8004B657D /* JumboMoji.swift */; };
@@ -244,6 +249,9 @@
A957C1792ECE542D00EA3EE9 /* GifManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifManager.swift; sourceTree = "<group>"; }; A957C1792ECE542D00EA3EE9 /* GifManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifManager.swift; sourceTree = "<group>"; };
A957C17D2ECFAA1100EA3EE9 /* GifView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifView.swift; sourceTree = "<group>"; }; A957C17D2ECFAA1100EA3EE9 /* GifView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifView.swift; sourceTree = "<group>"; };
A969D6932EA3E86500399C05 /* Messages.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Messages.framework; path = Library/Frameworks/Messages.framework; sourceTree = DEVELOPER_DIR; }; A969D6932EA3E86500399C05 /* Messages.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Messages.framework; path = Library/Frameworks/Messages.framework; sourceTree = DEVELOPER_DIR; };
A96D59953013D6450086948E /* MessagesPackListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesPackListView.swift; sourceTree = "<group>"; };
A96D59983013D9050086948E /* MessagesSplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesSplitViewController.swift; sourceTree = "<group>"; };
A96D599B301945240086948E /* MessagesRootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesRootViewController.swift; sourceTree = "<group>"; };
A97322A02FA7B9C8004B657D /* JumboMoji.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JumboMoji.swift; sourceTree = "<group>"; }; A97322A02FA7B9C8004B657D /* JumboMoji.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JumboMoji.swift; sourceTree = "<group>"; };
A97322A42FA8CA2B004B657D /* JumboMojiTestView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JumboMojiTestView.swift; sourceTree = "<group>"; }; A97322A42FA8CA2B004B657D /* JumboMojiTestView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JumboMojiTestView.swift; sourceTree = "<group>"; };
A975F9182FA38C8D00A5C62E /* EmojiPackGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackGridView.swift; sourceTree = "<group>"; }; A975F9182FA38C8D00A5C62E /* EmojiPackGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackGridView.swift; sourceTree = "<group>"; };
@@ -426,6 +434,7 @@
A949B1D62EA04C0B00215164 = { A949B1D62EA04C0B00215164 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A96D59983013D9050086948E /* MessagesSplitViewController.swift */,
A9E2ECD72EB74CE00038B2D6 /* Config.xcconfig */, A9E2ECD72EB74CE00038B2D6 /* Config.xcconfig */,
A949B1F22EA04E8200215164 /* StickerSlack */, A949B1F22EA04E8200215164 /* StickerSlack */,
A9104C742EB3AE4700D160EA /* Resources */, A9104C742EB3AE4700D160EA /* Resources */,
@@ -517,6 +526,8 @@
A986A6C92EB659E000B6E0FA /* MainInterface.storyboard */, A986A6C92EB659E000B6E0FA /* MainInterface.storyboard */,
A986A6CA2EB659E000B6E0FA /* MessagesViewController.swift */, A986A6CA2EB659E000B6E0FA /* MessagesViewController.swift */,
A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */, A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */,
A96D59953013D6450086948E /* MessagesPackListView.swift */,
A96D599B301945240086948E /* MessagesRootViewController.swift */,
); );
path = StickerSlackiMessageApp; path = StickerSlackiMessageApp;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -832,6 +843,7 @@
A9E8C7A92FF95FEC009A38B5 /* SearchViewController.swift in Sources */, A9E8C7A92FF95FEC009A38B5 /* SearchViewController.swift in Sources */,
A9BE30FE2F5FA47100A57668 /* Hoarder.swift in Sources */, A9BE30FE2F5FA47100A57668 /* Hoarder.swift in Sources */,
A97322A32FA7B9C8004B657D /* JumboMoji.swift in Sources */, A97322A32FA7B9C8004B657D /* JumboMoji.swift in Sources */,
A96D59973013D6670086948E /* MessagesPackListView.swift in Sources */,
A97BFFBF2F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */, A97BFFBF2F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */,
A9C52F792F89BB0800078588 /* EmojiTableViewCell.swift in Sources */, A9C52F792F89BB0800078588 /* EmojiTableViewCell.swift in Sources */,
A9C52F722F89A85F00078588 /* ShareSheet.swift in Sources */, A9C52F722F89A85F00078588 /* ShareSheet.swift in Sources */,
@@ -853,12 +865,14 @@
A9E8C79B2FF7256B009A38B5 /* EmojiHoarder.Packs.swift in Sources */, A9E8C79B2FF7256B009A38B5 /* EmojiHoarder.Packs.swift in Sources */,
A986A6CD2EB659E000B6E0FA /* MessagesViewController.swift in Sources */, A986A6CD2EB659E000B6E0FA /* MessagesViewController.swift in Sources */,
A9A7A4572F69568700BB84C6 /* GifHoarder.swift in Sources */, A9A7A4572F69568700BB84C6 /* GifHoarder.swift in Sources */,
A96D59963013D6450086948E /* MessagesPackListView.swift in Sources */,
A9BE30FF2F5FA78E00A57668 /* Hoarder.swift in Sources */, A9BE30FF2F5FA78E00A57668 /* Hoarder.swift in Sources */,
A9C52F6C2F8988CE00078588 /* EmptyCollectionView.swift in Sources */, A9C52F6C2F8988CE00078588 /* EmptyCollectionView.swift in Sources */,
A9C52F772F89A9BF00078588 /* URL.swift in Sources */, A9C52F772F89A9BF00078588 /* URL.swift in Sources */,
A9A7A4582F69569100BB84C6 /* Trending.swift in Sources */, A9A7A4582F69569100BB84C6 /* Trending.swift in Sources */,
A9A7A4592F69569100BB84C6 /* Pagination.swift in Sources */, A9A7A4592F69569100BB84C6 /* Pagination.swift in Sources */,
A9A7A45A2F69569100BB84C6 /* Meta.swift in Sources */, A9A7A45A2F69569100BB84C6 /* Meta.swift in Sources */,
A96D599A3013DE140086948E /* Int.swift in Sources */,
A9A7A45B2F69569100BB84C6 /* GifObject.swift in Sources */, A9A7A45B2F69569100BB84C6 /* GifObject.swift in Sources */,
A9A7A45C2F69569100BB84C6 /* GiphyImages.swift in Sources */, A9A7A45C2F69569100BB84C6 /* GiphyImages.swift in Sources */,
A9A7A45D2F69569100BB84C6 /* GiphyUser.swift in Sources */, A9A7A45D2F69569100BB84C6 /* GiphyUser.swift in Sources */,
@@ -868,8 +882,10 @@
A9A7A45E2F6956B700BB84C6 /* StickerType.swift in Sources */, A9A7A45E2F6956B700BB84C6 /* StickerType.swift in Sources */,
A9D6A8212F7014AE00F198FB /* TestStructures.swift in Sources */, A9D6A8212F7014AE00F198FB /* TestStructures.swift in Sources */,
A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */, A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
A96D599C301945240086948E /* MessagesRootViewController.swift in Sources */,
A986A6C42EB6598500B6E0FA /* SlackResponse.swift in Sources */, A986A6C42EB6598500B6E0FA /* SlackResponse.swift in Sources */,
A9E8C79F2FF726DA009A38B5 /* EmojiHoarder.LetterStats.swift in Sources */, A9E8C79F2FF726DA009A38B5 /* EmojiHoarder.LetterStats.swift in Sources */,
A96D59993013D9050086948E /* MessagesSplitViewController.swift in Sources */,
A986A6C22EB6597600B6E0FA /* Emoji.swift in Sources */, A986A6C22EB6597600B6E0FA /* Emoji.swift in Sources */,
A986A6C12EB6595F00B6E0FA /* EmojiHoarder.swift in Sources */, A986A6C12EB6595F00B6E0FA /* EmojiHoarder.swift in Sources */,
); );
@@ -9,11 +9,15 @@ import Foundation
import SwiftUI import SwiftUI
import UniformTypeIdentifiers import UniformTypeIdentifiers
struct EmojiPack: Identifiable, Codable, Equatable, Hashable { struct EmojiPack: Identifiable, Codable, Equatable, Hashable, CustomStringConvertible {
var id: UUID var id: UUID
var name: String var name: String
var items: [String] var items: [String]
var description: String {
return "\(items.count) emoji\(items.count.plural)"
}
init(id: UUID, name: String, items: [String]) { init(id: UUID, name: String, items: [String]) {
self.id = id self.id = id
self.name = name self.name = name
@@ -71,7 +71,7 @@ struct EmojiPackDetailView: View {
} }
if !pack.items.isEmpty { if !pack.items.isEmpty {
Text("\(pack.items.count) Emoji\(pack.items.count.plural)") Text(pack.description)
.bold() .bold()
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.shadow(radius: 5) .shadow(radius: 5)
@@ -39,7 +39,7 @@ struct EmojiPackPreview: View {
) )
if !pack.items.isEmpty { if !pack.items.isEmpty {
Text("\(pack.items.count) Emoji\(pack.items.count.plural)") Text(pack.description)
.bold() .bold()
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.shadow(radius: 5) .shadow(radius: 5)
@@ -205,7 +205,7 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
let pack = hoarder.emojiPacks[packIndex] let pack = hoarder.emojiPacks[packIndex]
return UIAction( return UIAction(
title: pack.name, title: pack.name,
subtitle: "\(pack.items.count) emoji\(pack.items.count.plural)", subtitle: pack.description,
image: pack.items.contains(emojiName) ? UIImage(systemName: "checkmark") : nil image: pack.items.contains(emojiName) ? UIImage(systemName: "checkmark") : nil
) { action in ) { action in
hoarder.emojiPacks[packIndex].addRemove(emojiName) hoarder.emojiPacks[packIndex].addRemove(emojiName)
@@ -145,6 +145,7 @@ class EmojiPackListView: UITableViewController {
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
refresh() refresh()
} }
@@ -169,7 +170,7 @@ class EmojiPackListView: UITableViewController {
guard let pack = packFor(indexPath: indexPath) else { return cell } guard let pack = packFor(indexPath: indexPath) else { return cell }
content.text = pack.name content.text = pack.name
content.secondaryText = "\(pack.items.count) emoji\(pack.items.count.plural)" content.secondaryText = pack.description
cell.contentConfiguration = content cell.contentConfiguration = content
return cell return cell
} }
@@ -243,7 +244,7 @@ class EmojiPackListView: UITableViewController {
title.text = pack.name title.text = pack.name
title.font = .boldSystemFont(ofSize: title.font.pointSize) title.font = .boldSystemFont(ofSize: title.font.pointSize)
let subtitle = UILabel() let subtitle = UILabel()
subtitle.text = "\(pack.items.count) emoji\(pack.items.count.plural)" subtitle.text = pack.description
subtitle.textColor = .gray subtitle.textColor = .gray
let stackView = UIStackView(arrangedSubviews: [title, subtitle]) let stackView = UIStackView(arrangedSubviews: [title, subtitle])
@@ -0,0 +1,60 @@
//
// 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])
}
}
@@ -0,0 +1,53 @@
//
// MessagesRootViewController.swift
// StickerSlackiMessageApp
//
// Created by neon443 on 29/07/2026.
//
import Foundation
import UIKit
import Messages
class MessagesRootViewController: UIViewController {
let leadingVC: UIViewController
let trailingVC: UIViewController
init(leading: UIViewController, trailing: UIViewController) {
self.leadingVC = leading
self.trailingVC = trailing
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
addChild(leadingVC)
addChild(trailingVC)
view.addSubview(leadingVC.view)
view.addSubview(trailingVC.view)
leadingVC.view.translatesAutoresizingMaskIntoConstraints = false
trailingVC.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
leadingVC.view.topAnchor.constraint(equalTo: view.topAnchor),
leadingVC.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
leadingVC.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
leadingVC.view.trailingAnchor.constraint(equalTo: view.leadingAnchor, constant: view.bounds.width*0.25),
trailingVC.view.topAnchor.constraint(equalTo: view.topAnchor),
trailingVC.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
trailingVC.view.leadingAnchor.constraint(equalTo: leadingVC.view.leadingAnchor),
trailingVC.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])
leadingVC.didMove(toParent: self)
trailingVC.didMove(toParent: self)
}
}
@@ -10,11 +10,14 @@ import Messages
import SwiftUI import SwiftUI
class MessagesViewController: MSMessagesAppViewController { class MessagesViewController: MSMessagesAppViewController {
let dataSource: StickerBrowserDataSource = StickerBrowserDataSource() var emojiHoarder: EmojiHoarder!
var dataSource: StickerBrowserDataSource!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
// Do any additional setup after loading the view.
self.emojiHoarder = EmojiHoarder(localOnly: true, skipIndex: true)
self.dataSource = StickerBrowserDataSource(hoarder: emojiHoarder, pack: nil)
} }
// MARK: - Conversation Handling // MARK: - Conversation Handling
@@ -38,16 +41,46 @@ class MessagesViewController: MSMessagesAppViewController {
return return
} }
stickerBrowser.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(stickerBrowser) let browser = MSStickerBrowserView(frame: .zero, stickerSize: .small)
stickerBrowser.contentInset = .zero let dataSource = StickerBrowserDataSource(hoarder: emojiHoarder, pack: nil)
browser.dataSource = dataSource
let vc = UIViewController()
browser.translatesAutoresizingMaskIntoConstraints = false
vc.view.addSubview(browser)
browser.contentInset = .zero
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
stickerBrowser.leadingAnchor.constraint(equalTo: view.leadingAnchor), browser.leadingAnchor.constraint(equalTo: vc.view.leadingAnchor),
stickerBrowser.trailingAnchor.constraint(equalTo: view.trailingAnchor), browser.trailingAnchor.constraint(equalTo: vc.view.trailingAnchor),
stickerBrowser.topAnchor.constraint(equalTo: view.topAnchor), browser.topAnchor.constraint(equalTo: vc.view.topAnchor),
stickerBrowser.bottomAnchor.constraint(equalTo: view.bottomAnchor) browser.bottomAnchor.constraint(equalTo: vc.view.bottomAnchor)
]) ])
let splitView = MessagesRootViewController(
leading: MessagesPackListView(hoarder: emojiHoarder),
trailing: vc
)
self.addChild(splitView)
splitView.view.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(splitView.view)
NSLayoutConstraint.activate([
splitView.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
splitView.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
splitView.view.topAnchor.constraint(equalTo: view.topAnchor),
splitView.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
return
// stickerBrowser.translatesAutoresizingMaskIntoConstraints = false
// view.addSubview(stickerBrowser)
// stickerBrowser.contentInset = .zero
// NSLayoutConstraint.activate([
// stickerBrowser.leadingAnchor.constraint(equalTo: view.leadingAnchor),
// stickerBrowser.trailingAnchor.constraint(equalTo: view.trailingAnchor),
// stickerBrowser.topAnchor.constraint(equalTo: view.topAnchor),
// stickerBrowser.bottomAnchor.constraint(equalTo: view.bottomAnchor)
// ])
// Called when the extension is about to move from the inactive to active state. // Called when the extension is about to move from the inactive to active state.
// This will happen when the extension is about to present UI. // This will happen when the extension is about to present UI.
@@ -9,15 +9,18 @@ import Foundation
import Messages import Messages
class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource { class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource {
var hoarder: EmojiHoarder = EmojiHoarder(localOnly: true, skipIndex: true) let pack: EmojiPack?
var msStickers: [MSSticker] = [] var msStickers: [MSSticker] = []
override init() { init(hoarder: EmojiHoarder, pack: EmojiPack?) {
self.pack = pack
super.init() super.init()
Task { Task {
await hoarder.buildDownloadedStickers() await hoarder.buildDownloadedStickers()
for emojiName in hoarder.downloadedStickers { for emojiName in hoarder.downloadedStickers {
if let pack {
guard pack.items.contains(emojiName) else { continue }
}
guard let emoji = hoarder.trie.dict[emojiName], guard let emoji = hoarder.trie.dict[emojiName],
let msSticker = emoji.msSticker else { continue } let msSticker = emoji.msSticker else { continue }
self.msStickers.append(msSticker) self.msStickers.append(msSticker)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.