mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
makes the add to pack button only show when editing.
wip uikit pack manager
This commit is contained in:
5 files changed
+67
-16
No files matched your search
@@ -149,6 +149,8 @@
|
||||
A9CD6C3A2EDDE6B500B7F421 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
|
||||
A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
|
||||
A9D15B8B2EB1142C00404792 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
|
||||
A9D53AEA2FFB0272001C1BB9 /* EmojiPackManagerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D53AE92FFB0272001C1BB9 /* EmojiPackManagerController.swift */; };
|
||||
A9D53AEB2FFB0272001C1BB9 /* EmojiPackManagerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D53AE92FFB0272001C1BB9 /* EmojiPackManagerController.swift */; };
|
||||
A9D6A8212F7014AE00F198FB /* TestStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */; };
|
||||
A9E8C78F2FF71D8C009A38B5 /* DownloadedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C78E2FF71D8C009A38B5 /* DownloadedViewController.swift */; };
|
||||
A9E8C7902FF71D8C009A38B5 /* DownloadedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C78E2FF71D8C009A38B5 /* DownloadedViewController.swift */; };
|
||||
@@ -282,6 +284,7 @@
|
||||
A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackDetailView.swift; sourceTree = "<group>"; };
|
||||
A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackManager.swift; sourceTree = "<group>"; };
|
||||
A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = "<group>"; };
|
||||
A9D53AE92FFB0272001C1BB9 /* EmojiPackManagerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackManagerController.swift; sourceTree = "<group>"; };
|
||||
A9E2ECD72EB74CE00038B2D6 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
|
||||
A9E8C78E2FF71D8C009A38B5 /* DownloadedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadedViewController.swift; sourceTree = "<group>"; };
|
||||
A9E8C7992FF7256B009A38B5 /* EmojiHoarder.Packs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiHoarder.Packs.swift; sourceTree = "<group>"; };
|
||||
@@ -402,6 +405,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A94693D62FEF0A4200E56AC5 /* TabbedContentView.swift */,
|
||||
A9D53AE92FFB0272001C1BB9 /* EmojiPackManagerController.swift */,
|
||||
A94F3E632F9E384D00FA6995 /* TableView */,
|
||||
A94F3E642F9E385300FA6995 /* CollectionView */,
|
||||
A9C52F712F89A85F00078588 /* ShareSheet.swift */,
|
||||
@@ -775,6 +779,7 @@
|
||||
A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */,
|
||||
A9C52F6F2F89A22000078588 /* Wiggle.metal in Sources */,
|
||||
A9BDEADE2F82BC93002798DF /* NoStickersView.swift in Sources */,
|
||||
A9D53AEB2FFB0272001C1BB9 /* EmojiPackManagerController.swift in Sources */,
|
||||
A955B3F52EC22EE900E1732D /* SearchView.swift in Sources */,
|
||||
A935437B2EB2A3C800BB80A4 /* FilterCategory.swift in Sources */,
|
||||
A917BAD12F9B7B68008DB31E /* PlainEmojiCollectionViewCell.swift in Sources */,
|
||||
@@ -857,6 +862,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A99C4B8E2FF2E8D30070CBA5 /* TabbedContentView.swift in Sources */,
|
||||
A9D53AEA2FFB0272001C1BB9 /* EmojiPackManagerController.swift in Sources */,
|
||||
A9A7A4462F68360900BB84C6 /* Pagination.swift in Sources */,
|
||||
A957C17C2ECE542D00EA3EE9 /* GifManager.swift in Sources */,
|
||||
A9104C7F2EB4022500D160EA /* MSSticker.swift in Sources */,
|
||||
|
||||
@@ -16,6 +16,7 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
|
||||
var style: EmojiCollectionView.Style
|
||||
var onRemove: ((String) -> Void)?
|
||||
var onTap: ((String) -> Void)?
|
||||
var onEditChange: ((Bool) -> Void)?
|
||||
|
||||
var dataSource: UICollectionViewDiffableDataSource<Int, String>!
|
||||
|
||||
@@ -174,24 +175,15 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
|
||||
|
||||
override func setEditing(_ editing: Bool, animated: Bool) {
|
||||
super.setEditing(editing, animated: animated)
|
||||
|
||||
onEditChange?(editing)
|
||||
|
||||
for cell in collectionView.visibleCells {
|
||||
if let cell = cell as? EmojiCollectionViewCell {
|
||||
cell.setEdit(to: isEditing)
|
||||
}
|
||||
}
|
||||
|
||||
if collectionView.isEditing {
|
||||
collectionView.navigationItem.setRightBarButtonItems(
|
||||
[self.editButtonItem, adderSheetButton],
|
||||
animated: true
|
||||
)
|
||||
} else {
|
||||
collectionView.navigationItem.setRightBarButtonItems(
|
||||
[self.editButtonItem],
|
||||
animated: true
|
||||
)
|
||||
}
|
||||
|
||||
if editing {
|
||||
self.startAnimating()
|
||||
|
||||
|
||||
@@ -50,14 +50,40 @@ class EmojiPackDetailViewController: UINavigationController {
|
||||
target: nil,
|
||||
action: #selector(share)
|
||||
)
|
||||
// super.init(nibName: nil, bundle: nil)
|
||||
// self.setviewcontrollers
|
||||
// self.addChild(collectionView)
|
||||
// self.view.addSubview(collectionView.view)
|
||||
// collectionView.view.translatesAutoresizingMaskIntoConstraints = false
|
||||
// NSLayoutConstraint.activate([
|
||||
// collectionView.view.topAnchor.constraint(equalTo: self.view.topAnchor),
|
||||
// collectionView.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
|
||||
// collectionView.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
|
||||
// collectionView.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)
|
||||
// ])
|
||||
|
||||
super.init(rootViewController: collectionView)
|
||||
collectionView.navigationItem.title = pack.name
|
||||
|
||||
collectionView.onEditChange = { editing in
|
||||
if editing {
|
||||
self.collectionView.navigationItem.setRightBarButtonItems(
|
||||
[self.collectionView.editButtonItem, self.adderSheetButton],
|
||||
animated: true
|
||||
)
|
||||
} else {
|
||||
self.collectionView.navigationItem.setRightBarButtonItems(
|
||||
[self.editButtonItem],
|
||||
animated: true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
self.isToolbarHidden = false
|
||||
collectionView.toolbarItems = [shareButton, downloadButton]
|
||||
// collectionView.toolbarItems = [editButton, adderSheetButton]
|
||||
|
||||
collectionView.navigationItem.rightBarButtonItems = [collectionView.editButtonItem, adderSheetButton]
|
||||
collectionView.navigationItem.rightBarButtonItems = [collectionView.editButtonItem]
|
||||
|
||||
NotificationCenter.default.addObserver(
|
||||
self,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// EmojiPackManagerController.swift
|
||||
// StickerSlack
|
||||
//
|
||||
// Created by neon443 on 05/07/2026.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
class EmojiPackManagerController: UINavigationController {
|
||||
var emojiHoarder: EmojiHoarder
|
||||
|
||||
|
||||
init(emojiHoarder: EmojiHoarder) {
|
||||
self.emojiHoarder = emojiHoarder
|
||||
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -16,9 +16,10 @@ final class TabbedContentView: UITabBarController {
|
||||
browseView.navigationItem.title = "Browse"
|
||||
browse.tabBarItem = UITabBarItem(title: "Browse", image: UIImage(systemName: "square.grid.2x2.fill"), tag: 0)
|
||||
|
||||
let packsView = EmojiPackManager(hoarder: emojiHoarder)
|
||||
let packs = UIHostingController(rootView: packsView)
|
||||
// let packs = EmojiPackDetailViewController(with: emojiHoarder, andPack: .test)
|
||||
// let packsView = EmojiPackManager(hoarder: emojiHoarder)
|
||||
// let packs = UIHostingController(rootView: packsView)
|
||||
// let packs = EmojiPackManagerController(emojiHoarder: emojiHoarder)
|
||||
let packs = EmojiPackDetailViewController(with: emojiHoarder, andPack: .test)
|
||||
packs.tabBarItem = UITabBarItem(title: "Packs", image: UIImage(systemName: "square.stack.3d.up.fill"), tag: 1)
|
||||
|
||||
let downloaded = DownloadedViewController(emojiHoarder: emojiHoarder)
|
||||
|
||||