mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 13:26:17 +00:00
the emojipicker works!
added stickerbrowserdatasorce to give msstickerbrowserview stikcers update messagesviewcontroller to add the msstickerbrowser added Emoji.sticker to get MSSticker from Emoji
This commit is contained in:
@@ -9,23 +9,30 @@ import UIKit
|
||||
import Messages
|
||||
|
||||
class MessagesViewController: MSMessagesAppViewController {
|
||||
var hoard: EmojiHoarder = EmojiHoarder()
|
||||
let dataSource: StickerBrowserDataSource = StickerBrowserDataSource()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view.
|
||||
// sleep(5)
|
||||
}
|
||||
|
||||
// MARK: - Conversation Handling
|
||||
|
||||
override func willBecomeActive(with conversation: MSConversation) {
|
||||
print(hoard.emojis.count)
|
||||
let l = UILabel()
|
||||
l.frame = CGRect(x: 20, y: 20, width: 1000, height: 40)
|
||||
l.frame = CGRect(x: 20, y: 20, width: 200, height: 40)
|
||||
l.textColor = .systemOrange
|
||||
l.text = "\(hoard.emojis.count)"
|
||||
l.text = "hii!"
|
||||
view.addSubview(l)
|
||||
view.bringSubviewToFront(l)
|
||||
|
||||
let stickerBrowser = MSStickerBrowserView(frame: .zero, stickerSize: .regular)
|
||||
stickerBrowser.frame = CGRect(x: 60, y: 20, width: 200, height: 600)
|
||||
stickerBrowser.dataSource = dataSource
|
||||
view.addSubview(stickerBrowser)
|
||||
stickerBrowser.reloadData()
|
||||
view.bringSubviewToFront(stickerBrowser)
|
||||
// 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.
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// StickerBroswerViewController.swift
|
||||
// StickerSlackiMessageExtension
|
||||
//
|
||||
// Created by neon443 on 29/10/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Messages
|
||||
|
||||
class StickerBroswerViewController: MSStickerBrowserViewController {
|
||||
var hoarder: EmojiHoarder = EmojiHoarder()
|
||||
|
||||
var emojis: [Emoji] = []
|
||||
|
||||
override func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {
|
||||
emojis = hoarder.emojis.filter { $0.isLocal }
|
||||
return emojis.count
|
||||
}
|
||||
|
||||
override func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker {
|
||||
return emojis[index].sticker
|
||||
}
|
||||
}
|
||||
21
StickerSlackiMessageExtension/StickerBrowserDataSource.swift
Normal file
21
StickerSlackiMessageExtension/StickerBrowserDataSource.swift
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// StickerBrowserDataSource.swift
|
||||
// StickerSlackiMessageExtension
|
||||
//
|
||||
// Created by neon443 on 29/10/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Messages
|
||||
|
||||
class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource {
|
||||
var hoarder: EmojiHoarder = EmojiHoarder()
|
||||
|
||||
func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {
|
||||
return hoarder.emojis.filter { $0.isLocal }.count
|
||||
}
|
||||
|
||||
func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker {
|
||||
return hoarder.emojis.filter { $0.isLocal }[index].sticker
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user