add toolbar

This commit is contained in:
Nihaal Sharma committed 2026-10-16 08:42:43 +01:00
1 parent 8f30c18ce2
commit 34249aa56e
4 files changed
+158 -42

No files matched your search

+4
View File
@@ -22,6 +22,7 @@
A9164993307F8B3F008D1B9D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9164991307F8B3F008D1B9D /* SceneDelegate.swift */; };
A91649953080BA3D008D1B9D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9164991307F8B3F008D1B9D /* SceneDelegate.swift */; };
A91649983080BA69008D1B9D /* StickerSlackApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F12EA04E8200215164 /* StickerSlackApp.swift */; };
A91649CB308113C5008D1B9D /* MessagesToolbarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A91649CA308113BF008D1B9D /* MessagesToolbarView.swift */; };
A917BACE2F9B787B008DB31E /* EmojiCollectionViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A917BACD2F9B787B008DB31E /* EmojiCollectionViewRepresentable.swift */; };
A917BACF2F9B787B008DB31E /* EmojiCollectionViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A917BACD2F9B787B008DB31E /* EmojiCollectionViewRepresentable.swift */; };
A917BAD12F9B7B68008DB31E /* PlainEmojiCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A917BAD02F9B7B68008DB31E /* PlainEmojiCollectionViewCell.swift */; };
@@ -217,6 +218,7 @@
A9104C732EB3AE4700D160EA /* StickerSlack.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = StickerSlack.icon; sourceTree = "<group>"; };
A9104C7D2EB4022500D160EA /* MSSticker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSSticker.swift; sourceTree = "<group>"; };
A9164991307F8B3F008D1B9D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
A91649CA308113BF008D1B9D /* MessagesToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesToolbarView.swift; sourceTree = "<group>"; };
A917BACD2F9B787B008DB31E /* EmojiCollectionViewRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCollectionViewRepresentable.swift; sourceTree = "<group>"; };
A917BAD02F9B7B68008DB31E /* PlainEmojiCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlainEmojiCollectionViewCell.swift; sourceTree = "<group>"; };
A921C2DE2ED067BB00E57B1A /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
@@ -506,6 +508,7 @@
A986A6CC2EB659E000B6E0FA /* StickerSlackiMessageApp */ = {
isa = PBXGroup;
children = (
A91649CA308113BF008D1B9D /* MessagesToolbarView.swift */,
A950E8802EB6C13700A9F873 /* StickerSlackiMessageApp.entitlements */,
A986A6C62EB659E000B6E0FA /* Assets.xcassets */,
A986A6C72EB659E000B6E0FA /* Info.plist */,
@@ -829,6 +832,7 @@
A9E8C79B2FF7256B009A38B5 /* EmojiHoarder.Packs.swift in Sources */,
A986A6CD2EB659E000B6E0FA /* MessagesAppViewController.swift in Sources */,
A96D59963013D6450086948E /* MessagesPackListView.swift in Sources */,
A91649CB308113C5008D1B9D /* MessagesToolbarView.swift in Sources */,
A9BE30FF2F5FA78E00A57668 /* Hoarder.swift in Sources */,
A9C52F6C2F8988CE00078588 /* EmptyCollectionView.swift in Sources */,
A9C52F772F89A9BF00078588 /* URL.swift in Sources */,
@@ -0,0 +1,28 @@
{
"colors" : [
{
"color" : {
"platform" : "ios",
"reference" : "systemPurpleColor"
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"platform" : "ios",
"reference" : "systemPurpleColor"
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -0,0 +1,95 @@
//
// MessagesToolbarView.swift
// StickerSlack
//
// Created by neon443 on 15/10/2026.
//
import UIKit
class MessagesToolbarView: UIStackView {
var labelView: UIVisualEffectView
var labelTitle: UILabel
var labelSubTitle: UILabel
var goView: UIVisualEffectView
var goButton: UIButton
init() {
self.labelTitle = UILabel()
self.labelSubTitle = UILabel()
self.labelView = UIVisualEffectView(effect: nil)
var effect: UIVisualEffect
if #available(iOS 19, *) {
let glassEffect = UIGlassEffect()
glassEffect.isInteractive = true
effect = glassEffect
} else {
effect = UIBlurEffect(style: .systemThinMaterial)
}
labelView.effect = effect
self.goView = UIVisualEffectView(effect: nil)
var effect2: UIVisualEffect
if #available(iOS 19, *) {
let glassEffect = UIGlassEffect()
glassEffect.isInteractive = true
glassEffect.tintColor = .accent
effect2 = glassEffect
} else {
effect2 = UIBlurEffect(style: .systemThinMaterial)
}
goView.effect = effect2
self.goButton = UIButton(type: .custom)
super.init(frame: .zero)
setup()
refreshUI()
}
required init(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setup() {
self.axis = .horizontal
self.spacing = 4
let labelStack = UIStackView(arrangedSubviews: [labelTitle, labelSubTitle])
labelView.layer.masksToBounds = true
labelStack.axis = .vertical
labelStack.insetsLayoutMarginsFromSafeArea = false
labelStack.layoutMargins = UIEdgeInsets(top: 5, left: 10, bottom: 5, right: 10)
labelStack.isLayoutMarginsRelativeArrangement = true
labelView.contentView.addSubview(labelStack)
labelStack.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
labelStack.heightAnchor.constraint(equalTo: labelView.heightAnchor),
labelStack.widthAnchor.constraint(equalTo: labelView.widthAnchor)
])
labelTitle.textAlignment = .center
labelTitle.font = .preferredFont(forTextStyle: .subheadline)
labelSubTitle.textAlignment = .center
labelSubTitle.font = .preferredFont(forTextStyle: .caption1)
goButton.layer.masksToBounds = true
goButton.setImage(UIImage(named: "arrow.up.right.square"), for: .normal)
goView.addSubview(goButton)
goButton.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
goButton.widthAnchor.constraint(equalTo: goView.widthAnchor),
goButton.heightAnchor.constraint(equalTo: goView.heightAnchor)
])
self.addArrangedSubview(labelView)
self.addArrangedSubview(goView)
}
func refreshUI() {
}
}
@@ -14,28 +14,15 @@ class StickerBrowserViewController: MSStickerBrowserViewController {
var emojiHoarder: EmojiHoarder!
var pack: EmojiPack?
var msStickers: [MSSticker] = []
var labelStack: UIVisualEffectView
var labelTitle: UILabel
var labelSubTitle: UILabel
var toolbar: MessagesToolbarView
var emptyView: UIViewController
init(emojiHoarder: EmojiHoarder, pack: EmojiPack?) {
self.emojiHoarder = emojiHoarder
self.pack = pack
self.labelTitle = UILabel()
self.labelSubTitle = UILabel()
self.labelStack = UIVisualEffectView(effect: nil)
var effect: UIVisualEffect
if #available(iOS 19, *) {
let glassEffect = UIGlassEffect()
glassEffect.isInteractive = true
effect = glassEffect
} else {
effect = UIBlurEffect(style: .systemThinMaterial)
}
labelStack.effect = effect
self.emptyView = UIHostingController(
rootView: EmptyCollectionView(
title: "None Downloaded",
@@ -44,6 +31,7 @@ class StickerBrowserViewController: MSStickerBrowserViewController {
)
)
emptyView.view.tintColor = #colorLiteral(red: 0.7490000129, green: 0.3529999852, blue: 0.949000001, alpha: 1)
self.toolbar = MessagesToolbarView()
super.init(stickerSize: .small)
reload()
}
@@ -55,32 +43,32 @@ class StickerBrowserViewController: MSStickerBrowserViewController {
override func viewDidLoad() {
super.viewDidLoad()
let stack = UIStackView(arrangedSubviews: [labelTitle, labelSubTitle])
labelStack.contentView.addSubview(stack)
self.view.addSubview(labelStack)
stack.translatesAutoresizingMaskIntoConstraints = false
labelStack.translatesAutoresizingMaskIntoConstraints = false
// let stack = UIStackView(arrangedSubviews: [labelTitle, labelSubTitle])
// labelStack.contentView.addSubview(stack)
self.view.addSubview(toolbar)
// stack.translatesAutoresizingMaskIntoConstraints = false
toolbar.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
stack.heightAnchor.constraint(equalTo: labelStack.heightAnchor),
stack.widthAnchor.constraint(equalTo: labelStack.widthAnchor),
// stack.heightAnchor.constraint(equalTo: toolbar.heightAnchor),
// stack.widthAnchor.constraint(equalTo: toolbar.widthAnchor),
labelStack.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
labelStack.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: -4)
toolbar.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
toolbar.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: -4)
])
stack.axis = .vertical
stack.insetsLayoutMarginsFromSafeArea = false
stack.layoutMargins = UIEdgeInsets(top: 5, left: 10, bottom: 5, right: 10)
stack.isLayoutMarginsRelativeArrangement = true
// stack.axis = .vertical
// stack.insetsLayoutMarginsFromSafeArea = false
// stack.layoutMargins = UIEdgeInsets(top: 5, left: 10, bottom: 5, right: 10)
// stack.isLayoutMarginsRelativeArrangement = true
labelStack.layer.masksToBounds = true
toolbar.layer.masksToBounds = true
labelTitle.textColor = .white
labelTitle.font = UIFont.preferredFont(forTextStyle: .subheadline)
labelTitle.textAlignment = .center
labelSubTitle.textColor = .white
labelSubTitle.font = UIFont.preferredFont(forTextStyle: .caption1)
labelSubTitle.textAlignment = .center
// labelTitle.textColor = .white
// labelTitle.font = UIFont.preferredFont(forTextStyle: .subheadline)
// labelTitle.textAlignment = .center
//
// labelSubTitle.textColor = .white
// labelSubTitle.font = UIFont.preferredFont(forTextStyle: .caption1)
// labelSubTitle.textAlignment = .center
}
override func viewDidLayoutSubviews() {
@@ -90,16 +78,17 @@ class StickerBrowserViewController: MSStickerBrowserViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
labelStack.layer.cornerRadius = labelStack.frame.height/4
toolbar.labelView.layer.cornerRadius = toolbar.labelView.frame.height/4
toolbar.goButton.layer.cornerRadius = toolbar.labelView.frame.height/4
}
@objc func reload() {
UIView.transition(with: labelStack, duration: 0.25, options: [.transitionCrossDissolve, .allowUserInteraction]) {
self.labelTitle.text = self.pack?.name ?? "All Downloaded"
self.labelSubTitle.text = self.pack?.downloadedDescription(self.emojiHoarder) ??
UIView.transition(with: toolbar.labelView, duration: 0.25, options: [.transitionCrossDissolve, .allowUserInteraction]) {
self.toolbar.labelTitle.text = self.pack?.name ?? "All Downloaded"
self.toolbar.labelSubTitle.text = self.pack?.downloadedDescription(self.emojiHoarder) ??
"\(self.emojiHoarder.downloadedStickers.count) emoji\(self.emojiHoarder.downloadedStickers.count.plural)"
self.view.layoutIfNeeded()
self.toolbar.layoutIfNeeded()
}
msStickers = []
let names: [String]
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.