mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
working on jumbomoji
This commit is contained in:
4 files changed
+87
-11
No files matched your search
@@ -46,6 +46,9 @@
|
||||
A957C17E2ECFAA1100EA3EE9 /* 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 */; };
|
||||
A97322A12FA7B9C8004B657D /* 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 */; };
|
||||
A975F9192FA38C8D00A5C62E /* EmojiPackGridView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A975F9182FA38C8D00A5C62E /* EmojiPackGridView.swift */; };
|
||||
A975F91A2FA38C8D00A5C62E /* EmojiPackGridView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A975F9182FA38C8D00A5C62E /* EmojiPackGridView.swift */; };
|
||||
A975F9202FA52B3600A5C62E /* AddToPackMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A975F91F2FA52B3600A5C62E /* AddToPackMenuView.swift */; };
|
||||
@@ -215,6 +218,7 @@
|
||||
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>"; };
|
||||
A969D6932EA3E86500399C05 /* Messages.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Messages.framework; path = Library/Frameworks/Messages.framework; sourceTree = DEVELOPER_DIR; };
|
||||
A97322A02FA7B9C8004B657D /* JumboMoji.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JumboMoji.swift; sourceTree = "<group>"; };
|
||||
A975F9182FA38C8D00A5C62E /* EmojiPackGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackGridView.swift; sourceTree = "<group>"; };
|
||||
A975F91F2FA52B3600A5C62E /* AddToPackMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddToPackMenuView.swift; sourceTree = "<group>"; };
|
||||
A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerPreview.swift; sourceTree = "<group>"; };
|
||||
@@ -413,6 +417,7 @@
|
||||
A91C098E2EBBD7C700210C34 /* UIKit */,
|
||||
A91C098D2EBBD7C100210C34 /* SwiftUI */,
|
||||
A9BE30FD2F5FA47100A57668 /* Hoarder.swift */,
|
||||
A97322A02FA7B9C8004B657D /* JumboMoji.swift */,
|
||||
);
|
||||
path = StickerSlack;
|
||||
sourceTree = "<group>";
|
||||
@@ -748,6 +753,7 @@
|
||||
A9A7A4482F68361200BB84C6 /* Meta.swift in Sources */,
|
||||
A995D95C2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */,
|
||||
A9BE30FE2F5FA47100A57668 /* Hoarder.swift in Sources */,
|
||||
A97322A32FA7B9C8004B657D /* JumboMoji.swift in Sources */,
|
||||
A97BFFBF2F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */,
|
||||
A9C52F792F89BB0800078588 /* EmojiTableViewCell.swift in Sources */,
|
||||
A9C52F722F89A85F00078588 /* ShareSheet.swift in Sources */,
|
||||
@@ -760,6 +766,7 @@
|
||||
files = (
|
||||
A957C17B2ECE542D00EA3EE9 /* GifManager.swift in Sources */,
|
||||
A9BE30F82F5B02BF00A57668 /* StickerProtocol.swift in Sources */,
|
||||
A97322A12FA7B9C8004B657D /* JumboMoji.swift in Sources */,
|
||||
A986A6C32EB6598100B6E0FA /* FilterCategory.swift in Sources */,
|
||||
A9CD6C3A2EDDE6B500B7F421 /* EmojiPack.swift in Sources */,
|
||||
A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */,
|
||||
@@ -819,6 +826,7 @@
|
||||
A955B3ED2EC22C4A00E1732D /* DownloadedView.swift in Sources */,
|
||||
A9EC46AD2F6D9E4600E066E6 /* Hoarder.swift in Sources */,
|
||||
A9A7A4682F6AA17C00BB84C6 /* Int.swift in Sources */,
|
||||
A97322A22FA7B9C8004B657D /* JumboMoji.swift in Sources */,
|
||||
A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */,
|
||||
A9FB3EE32FA7AB3A00030E2A /* UIKitGifView.swift in Sources */,
|
||||
A9C52F7A2F89BB0800078588 /* EmojiTableViewCell.swift in Sources */,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// JumboMoji.swift
|
||||
// StickerSlack
|
||||
//
|
||||
// Created by neon443 on 03/05/2026.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct JumboMoji {
|
||||
var width: Int
|
||||
var height: Int
|
||||
var baseName: String
|
||||
var type: JumboMoji.Style
|
||||
var items: [String]
|
||||
|
||||
// init(baseName: String, items: [String]) {
|
||||
// let itemsBaseNameRemoved = items.map { String($0.dropFirst(baseName.count+1)) }
|
||||
//
|
||||
//
|
||||
// let coordinates = itemsBaseNameRemoved.map { $0.dropLast($0.split(separator: "-").last?.count ?? 0) }.split(separator: "-").map { Int(String($0)) }
|
||||
// self.width = width
|
||||
// self.height = height
|
||||
// self.baseName = baseName
|
||||
// self.type = type
|
||||
// self.items = items
|
||||
// }
|
||||
|
||||
enum Style {
|
||||
case grid
|
||||
case btn
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,36 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
Section("Debug") {
|
||||
NavigationLink {
|
||||
EmojiCollectionView(
|
||||
hoarder: hoarder,
|
||||
items: [
|
||||
"btn-3kh0-1",
|
||||
"btn-3kh0-2",
|
||||
"btn-3kh0-3",
|
||||
"btn-antinft-1",
|
||||
"btn-antinft-2",
|
||||
"btn-antinft-3",
|
||||
"btn-bsky-1",
|
||||
"btn-bsky-2",
|
||||
"btn-bsky-3",
|
||||
"btn-gideon-1",
|
||||
"btn-gideon-2",
|
||||
"btn-gideon-3",
|
||||
"btn-macos-1",
|
||||
"btn-macos-2",
|
||||
"btn-macos-3",
|
||||
"btn-microhate-1",
|
||||
"btn-microhate-2",
|
||||
"btn-microhate-3"
|
||||
],
|
||||
pack: nil,
|
||||
width: 3,
|
||||
style: .jumboMoji
|
||||
)
|
||||
} label: {
|
||||
Label("jumbomoji", systemImage: "square.split.2x2")
|
||||
}
|
||||
NavigationLink {
|
||||
EmojiCollectionView(
|
||||
hoarder: hoarder,
|
||||
|
||||
@@ -68,6 +68,7 @@ struct EmojiCollectionView: UIViewRepresentable {
|
||||
case plain
|
||||
case plainWithMenu
|
||||
case full
|
||||
case jumboMoji
|
||||
}
|
||||
|
||||
final class Coordinator: UICollectionViewController, UICollectionViewDelegateFlowLayout {
|
||||
@@ -104,7 +105,7 @@ struct EmojiCollectionView: UIViewRepresentable {
|
||||
self.width = width
|
||||
self.style = style
|
||||
|
||||
layout.minimumInteritemSpacing = 8
|
||||
layout.minimumInteritemSpacing = style == .jumboMoji ? 0 : 8
|
||||
super.init(collectionViewLayout: layout)
|
||||
|
||||
self.dataSource = UICollectionViewDiffableDataSource<Int, String>(collectionView: collectionView) { (collectionView: UICollectionView, indexPath: IndexPath, itemIdentifier: String) -> UICollectionViewCell? in
|
||||
@@ -129,7 +130,7 @@ struct EmojiCollectionView: UIViewRepresentable {
|
||||
) -> UICollectionViewCell {
|
||||
let cell: PlainEmojiCollectionViewCell
|
||||
switch style {
|
||||
case .plain, .plainWithMenu:
|
||||
case .plain, .plainWithMenu, .jumboMoji:
|
||||
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "plain", for: indexPath) as! PlainEmojiCollectionViewCell
|
||||
case .full:
|
||||
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "full", for: indexPath) as! EmojiCollectionViewCell
|
||||
@@ -179,7 +180,12 @@ struct EmojiCollectionView: UIViewRepresentable {
|
||||
) -> CGSize {
|
||||
let totalWidth = collectionView.bounds.width
|
||||
let availWidth = totalWidth-(collectionView.contentInset.left*2)
|
||||
let cols = max(1, floor(availWidth/width))
|
||||
let cols: CGFloat
|
||||
if style == .jumboMoji {
|
||||
cols = width
|
||||
} else {
|
||||
cols = max(1, floor(availWidth/width))
|
||||
}
|
||||
let totalSpacing = layout.minimumInteritemSpacing * (cols - 1)
|
||||
let itemWidth = (availWidth-totalSpacing)/cols
|
||||
let defaultSize = CGSize(width: itemWidth, height: itemWidth)
|
||||
@@ -204,15 +210,14 @@ struct EmojiCollectionView: UIViewRepresentable {
|
||||
EmojiCollectionView.Coordinator.labelSizeDict[itemWidth] = [emojiName: labelHeight]
|
||||
}
|
||||
}
|
||||
|
||||
let font = UIFont.preferredFont(forTextStyle: .caption1)
|
||||
let rect = (emojiName as NSString).boundingRect(
|
||||
with: CGSize(width: itemWidth, height: .greatestFiniteMagnitude),
|
||||
options: [.usesLineFragmentOrigin, .usesFontLeading],
|
||||
attributes: [.font: font],
|
||||
context: nil
|
||||
)
|
||||
return CGSize(width: itemWidth, height: itemWidth+labelHeight+4)
|
||||
// let font = UIFont.preferredFont(forTextStyle: .caption1)
|
||||
// let rect = (emojiName as NSString).boundingRect(
|
||||
// with: CGSize(width: itemWidth, height: .greatestFiniteMagnitude),
|
||||
// options: [.usesLineFragmentOrigin, .usesFontLeading],
|
||||
// attributes: [.font: font],
|
||||
// context: nil
|
||||
// )
|
||||
}
|
||||
|
||||
override func collectionView(
|
||||
|
||||