Compare commits

..
34 Commits
Author SHA1 Message Date
neon443 4f7898cf47 no i acc want to die now 2026-04-08 15:30:16 +01:00
neon443 8b0e2a73d8 swift 6 makes me wanna kms 2026-04-08 15:19:10 +01:00
neon443 b7f357fd2e added loading and error state for gifview (stickerpreview) with animations
redid stickerpreview logic cos it was messy
made gifFrom throwing
faster sticker.image when it doesnt exist
fix swift6 warning in hoarder downloaded stickers
added better padding to welcome view and disabled interactive dismiss
2026-04-08 14:27:22 +01:00
neon443 e5850d9ea4 fix closure compilation error 2026-04-08 13:20:09 +01:00
neon443 bb32c9e5bf adding emojis to emojipacks works
proper emojipack manager view with an add button
new emojipack function
fixed scrolling on emojipack editor add sticker
2026-04-08 13:18:37 +01:00
neon443 1c86d89a6b more stuff for emoji pack editor:
edit mode has red - buttons to remove it
also has a plus button to add more but it currently doesnt add
modified searchview to add a variant for the pack editor
2026-04-07 18:43:33 +01:00
neon443 ec6893b945 working on emoji pack stuff
making emojipackview actually look good and setting up edit functionality
2026-04-07 16:52:31 +01:00
neon443 359dc378cf build downloaded gifs on launch 2026-04-06 13:24:27 +01:00
neon443 18ee2267c9 implemented buildDownloadedStickers into basehoarder
and download/delete stickers
2026-04-06 13:22:26 +01:00
neon443 1575eae8ce blah 2026-04-05 22:56:50 +01:00
neon443 312f8b7468 added a base hoarder thingy so that its easier to share logic lol 2026-04-05 22:52:50 +01:00
neon443 a3629fe642 masssive changes sob
MUCH faster emojihoarder init, async stuff yaya
faster trie building
and downloaded sticker building
loading spinners if trie.dict is empty
put slack emojis in library/slack and giphy in /giphy
added a lil info thingy to stickerpicker and  a button to open stickerslack if no stickers downloaded
update file.contains to have a . when searching for fule name extensions
more logging for nil stuff in sticker data source
moved picker on browseview out of the overlay
fixed the contentinsets for uikit emoji list
haptic when u click the confetti thingy for having all the emojis lol
consolidated the continue button, added stickerslack icon to welcome view
2026-04-05 22:15:13 +01:00
neon443 18e7956037 fix search
nice overlayed picker gotta clean up tho
and gotta fix slow dl view
2026-04-05 02:05:19 +01:00
neon443 5e605fe1b8 okay cleanup:
a lot faster app loading
other stuff i forgor
2026-04-05 01:45:33 +01:00
neon443 1221724383 fix all warnings yay 2026-04-05 00:54:55 +01:00
neon443 5257c03f49 migrated datasource to tableviewcontroller, disabled selecting cells, set insetgrouped stype
ts lowk mostly works yay
2026-04-05 00:38:45 +01:00
neon443 1f937db771 use uikit in browseview
fix downloading gifs
remove some random test
2026-04-04 00:53:23 +01:00
neon443 cff99ac34c fix search not working after backspacing it all
put downloaded glyph below sticker type icon
2026-04-03 23:05:40 +01:00
neon443 d0d8b05035 YESSSSSSSSSSSSS
stickerpicker is optimised as FUCK
    calculations of how many stickers should be displayed occurs once, and is much faster as it just reads the files on disk to determine downloaded emojis instead of calling isLocal on each emoji
2026-04-03 22:19:26 +01:00
neon443 91edcb6441 redid how downloaded emojis are made, abolished isLocal cos its too slow lmao
adding name to each filename so its easier to make a list of downloaded thingeis
fix using absolutestring instead of path
ts lowk fried im optimising th out of ts
2026-04-03 21:36:04 +01:00
neon443 208f97b102 added clear logos for giphy stickers 2026-04-03 12:58:18 +01:00
neon443 7b91de576a upped the limit 2026-04-03 02:02:08 +01:00
neon443 077f6cd4c3 giphyImages in Gif
stickerrow use giphy preview instead of original sob
stickerRow argument is now sticker instead of emoji
2026-04-03 01:32:34 +01:00
Nihaal Sharma d49c5c1398 extract test structures to their own file 2026-03-22 19:12:03 +00:00
neon443 5f091b2b2e Merge remote-tracking branch 'refs/remotes/origin/main' 2026-03-21 11:07:14 +00:00
neon443 78477eec6a update tests 2026-03-21 11:07:06 +00:00
Nihaal Sharma 668382cbfd Merge remote-tracking branch 'refs/remotes/origin/main' 2026-03-21 11:06:03 +00:00
Nihaal Sharma 6e5cc2d845 fix searching again 2026-03-21 11:05:45 +00:00
Nihaal Sharma 0c216bb800 updated search algorithm to use previous search result to speed up when typing things out, eg
before
        "a": 47k -> 25k emojis
        "ab": 47k -> ~850
    after
        "a": 47k -> 25k
        "ab" 25k -> ~850
also sort search results
using a Task again
added a ui thingy for no downloaded emojis
2026-03-20 18:08:26 +00:00
neon443 046ede9475 m,lkk 2026-03-19 22:32:25 +00:00
neon443 a79bdd3e40 new test gif
made some things optional in gifobject
2026-03-19 20:11:35 +00:00
Nihaal Sharma d64ca5cd42 about 15% faster trie building not much but eh
also stopped using a Task for searching
2026-03-19 10:18:13 +00:00
Nihaal Sharma 4bd3442cf4 fix 2026-03-19 10:03:35 +00:00
neon443 1e72658f38 fix downloading gifs and improved search by making it interactive and fix the mamory leak hopefully 2026-03-19 09:26:21 +00:00
42 changed files with 1422 additions and 610 deletions

No files matched your search

@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "giphy black.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "giphy.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

+54 -30
View File
@@ -44,7 +44,7 @@
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 */; };
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */; }; A9773C2F2EA54AF000F3B753 /* StickerPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */; };
A986A6AE2EB658DF00B6E0FA /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A969D6932EA3E86500399C05 /* Messages.framework */; }; A986A6AE2EB658DF00B6E0FA /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A969D6932EA3E86500399C05 /* Messages.framework */; };
A986A6BA2EB658E100B6E0FA /* StickerSlackiMessageApp.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; A986A6BA2EB658E100B6E0FA /* StickerSlackiMessageApp.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
A986A6C12EB6595F00B6E0FA /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; }; A986A6C12EB6595F00B6E0FA /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
@@ -58,6 +58,8 @@
A99589AF2F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; }; A99589AF2F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; };
A99589B02F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; }; A99589B02F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; };
A99589B12F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; }; A99589B12F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; };
A995D95B2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */; };
A995D95C2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */; };
A9A7A43F2F6835F800BB84C6 /* Trending.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A43E2F6835F800BB84C6 /* Trending.swift */; }; A9A7A43F2F6835F800BB84C6 /* Trending.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A43E2F6835F800BB84C6 /* Trending.swift */; };
A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A43E2F6835F800BB84C6 /* Trending.swift */; }; A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A43E2F6835F800BB84C6 /* Trending.swift */; };
A9A7A4422F68360200BB84C6 /* GifObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A4412F68360200BB84C6 /* GifObject.swift */; }; A9A7A4422F68360200BB84C6 /* GifObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A4412F68360200BB84C6 /* GifObject.swift */; };
@@ -89,6 +91,9 @@
A9BBC5182EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; }; A9BBC5182EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; };
A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; }; A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; };
A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; }; A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */; };
A9BDEADE2F82BC93002798DF /* NoStickersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BDEADD2F82BC93002798DF /* NoStickersView.swift */; };
A9BDEADF2F82BC93002798DF /* NoStickersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BDEADD2F82BC93002798DF /* NoStickersView.swift */; };
A9BDEAE02F82BCB4002798DF /* NoStickersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BDEADD2F82BC93002798DF /* NoStickersView.swift */; };
A9BE30EC2F5AFE1E00A57668 /* StickerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EB2F5AFE1E00A57668 /* StickerType.swift */; }; A9BE30EC2F5AFE1E00A57668 /* StickerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EB2F5AFE1E00A57668 /* StickerType.swift */; };
A9BE30EF2F5B004800A57668 /* GifHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EE2F5B004800A57668 /* GifHoarder.swift */; }; A9BE30EF2F5B004800A57668 /* GifHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EE2F5B004800A57668 /* GifHoarder.swift */; };
A9BE30F02F5B004800A57668 /* GifHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EE2F5B004800A57668 /* GifHoarder.swift */; }; A9BE30F02F5B004800A57668 /* GifHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EE2F5B004800A57668 /* GifHoarder.swift */; };
@@ -104,21 +109,24 @@
A9BE30FF2F5FA78E00A57668 /* Hoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30FD2F5FA47100A57668 /* Hoarder.swift */; }; A9BE30FF2F5FA78E00A57668 /* Hoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30FD2F5FA47100A57668 /* Hoarder.swift */; };
A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; }; A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; };
A9C172DD2EB8C9AC008A7885 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; }; A9C172DD2EB8C9AC008A7885 /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; };
A9CD6C352EDDE22800B7F421 /* EmojiPackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C342EDDE22800B7F421 /* EmojiPackView.swift */; }; A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */; };
A9CD6C362EDDE22800B7F421 /* EmojiPackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C342EDDE22800B7F421 /* EmojiPackView.swift */; }; A9CD6C362EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */; };
A9CD6C382EDDE37500B7F421 /* EmojiPackManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */; }; A9CD6C382EDDE37500B7F421 /* EmojiPackManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */; };
A9CD6C392EDDE37500B7F421 /* EmojiPackManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */; }; A9CD6C392EDDE37500B7F421 /* EmojiPackManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */; };
A9CD6C3A2EDDE6B500B7F421 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; }; A9CD6C3A2EDDE6B500B7F421 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
A9CD6C3B2EDDE6B500B7F421 /* 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 */; }; A9D15B8B2EB1142C00404792 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
A9EB72392EB93FDB00658CEB /* EmojiCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiCollectionView.swift */; }; A9D6A8212F7014AE00F198FB /* TestStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */; };
A9EB72392EB93FDB00658CEB /* EmojiTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */; };
A9EB72472EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; }; A9EB72472EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; };
A9EB72492EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; }; A9EB72492EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; };
A9EB724A2EB948E000658CEB /* EmojiCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiCollectionView.swift */; }; A9EB724A2EB948E000658CEB /* EmojiTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */; };
A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; }; A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; };
A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */; }; A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */; };
A9EB724F2EB94A6B00658CEB /* TrieTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */; }; A9EB724F2EB94A6B00658CEB /* TrieTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */; };
A9EB72502EB94FAD00658CEB /* EmojiPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */; }; A9EB72502EB94FAD00658CEB /* StickerPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */; };
A9EC46AD2F6D9E4600E066E6 /* Hoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30FD2F5FA47100A57668 /* Hoarder.swift */; };
A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EB2F5AFE1E00A57668 /* StickerType.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@@ -177,7 +185,7 @@
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; };
A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPreview.swift; sourceTree = "<group>"; }; A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerPreview.swift; sourceTree = "<group>"; };
A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = StickerSlackiMessageApp.appex; sourceTree = BUILT_PRODUCTS_DIR; }; A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = StickerSlackiMessageApp.appex; sourceTree = BUILT_PRODUCTS_DIR; };
A986A6C62EB659E000B6E0FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; A986A6C62EB659E000B6E0FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
A986A6C72EB659E000B6E0FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; A986A6C72EB659E000B6E0FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -185,6 +193,7 @@
A986A6CA2EB659E000B6E0FA /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; }; A986A6CA2EB659E000B6E0FA /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerBrowserDataSource.swift; sourceTree = "<group>"; }; A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerBrowserDataSource.swift; sourceTree = "<group>"; };
A99589AE2F5E0D83003A4A8C /* image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image.png; sourceTree = "<group>"; }; A99589AE2F5E0D83003A4A8C /* image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image.png; sourceTree = "<group>"; };
A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestStructures.swift; sourceTree = "<group>"; };
A9A7A43E2F6835F800BB84C6 /* Trending.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trending.swift; sourceTree = "<group>"; }; A9A7A43E2F6835F800BB84C6 /* Trending.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trending.swift; sourceTree = "<group>"; };
A9A7A4412F68360200BB84C6 /* GifObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifObject.swift; sourceTree = "<group>"; }; A9A7A4412F68360200BB84C6 /* GifObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifObject.swift; sourceTree = "<group>"; };
A9A7A4442F68360900BB84C6 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = "<group>"; }; A9A7A4442F68360900BB84C6 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = "<group>"; };
@@ -195,6 +204,8 @@
A9B9A8232EB2CCB5004C9245 /* StickerSlackTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = StickerSlackTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; A9B9A8232EB2CCB5004C9245 /* StickerSlackTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = StickerSlackTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
A9B9A82C2EB2CCBE004C9245 /* StickerSlackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerSlackTests.swift; sourceTree = "<group>"; }; A9B9A82C2EB2CCBE004C9245 /* StickerSlackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerSlackTests.swift; sourceTree = "<group>"; };
A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModifiers.swift; sourceTree = "<group>"; }; A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModifiers.swift; sourceTree = "<group>"; };
A9BDEADD2F82BC93002798DF /* NoStickersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoStickersView.swift; sourceTree = "<group>"; };
A9BDEAE12F82BFF8002798DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
A9BE30EB2F5AFE1E00A57668 /* StickerType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerType.swift; sourceTree = "<group>"; }; A9BE30EB2F5AFE1E00A57668 /* StickerType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerType.swift; sourceTree = "<group>"; };
A9BE30EE2F5B004800A57668 /* GifHoarder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifHoarder.swift; sourceTree = "<group>"; }; A9BE30EE2F5B004800A57668 /* GifHoarder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifHoarder.swift; sourceTree = "<group>"; };
A9BE30F12F5B004E00A57668 /* Gif.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Gif.swift; sourceTree = "<group>"; }; A9BE30F12F5B004E00A57668 /* Gif.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Gif.swift; sourceTree = "<group>"; };
@@ -202,11 +213,11 @@
A9BE30F92F5B03F400A57668 /* Sticker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sticker.swift; sourceTree = "<group>"; }; A9BE30F92F5B03F400A57668 /* Sticker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sticker.swift; sourceTree = "<group>"; };
A9BE30FD2F5FA47100A57668 /* Hoarder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hoarder.swift; sourceTree = "<group>"; }; A9BE30FD2F5FA47100A57668 /* Hoarder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hoarder.swift; sourceTree = "<group>"; };
A9C172DB2EB8C9AC008A7885 /* Trie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trie.swift; sourceTree = "<group>"; }; A9C172DB2EB8C9AC008A7885 /* Trie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trie.swift; sourceTree = "<group>"; };
A9CD6C342EDDE22800B7F421 /* EmojiPackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackView.swift; sourceTree = "<group>"; }; 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>"; }; 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>"; }; A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = "<group>"; };
A9E2ECD72EB74CE00038B2D6 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; }; A9E2ECD72EB74CE00038B2D6 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
A9EB72382EB93FDB00658CEB /* EmojiCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCollectionView.swift; sourceTree = "<group>"; }; A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiTableView.swift; sourceTree = "<group>"; };
A9EB72462EB948C400658CEB /* StickerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerRow.swift; sourceTree = "<group>"; }; A9EB72462EB948C400658CEB /* StickerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerRow.swift; sourceTree = "<group>"; };
A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrieTestingView.swift; sourceTree = "<group>"; }; A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrieTestingView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@@ -257,6 +268,7 @@
A9104C7D2EB4022500D160EA /* MSSticker.swift */, A9104C7D2EB4022500D160EA /* MSSticker.swift */,
A957C1762ECD008E00EA3EE9 /* Bundle.swift */, A957C1762ECD008E00EA3EE9 /* Bundle.swift */,
A9A7A4672F6AA17C00BB84C6 /* Int.swift */, A9A7A4672F6AA17C00BB84C6 /* Int.swift */,
A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */,
); );
path = Extensions; path = Extensions;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -283,9 +295,7 @@
A91C098C2EBBD7AB00210C34 /* Emoji */ = { A91C098C2EBBD7AB00210C34 /* Emoji */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */, A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */,
A9EB72462EB948C400658CEB /* StickerRow.swift */,
A9CD6C342EDDE22800B7F421 /* EmojiPackView.swift */,
); );
path = Emoji; path = Emoji;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -297,12 +307,15 @@
A949B1F02EA04E8200215164 /* ContentView.swift */, A949B1F02EA04E8200215164 /* ContentView.swift */,
A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */, A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */,
A91C098C2EBBD7AB00210C34 /* Emoji */, A91C098C2EBBD7AB00210C34 /* Emoji */,
A955B3EC2EC22C4A00E1732D /* DownloadedView.swift */,
A955B3F02EC22E9700E1732D /* BrowseView.swift */,
A955B3F42EC22EE900E1732D /* SearchView.swift */,
A957C1732ECCE2CE00EA3EE9 /* SettingsView.swift */,
A921C2DE2ED067BB00E57B1A /* WelcomeView.swift */,
A921C2E12ED071C900E57B1A /* ListRow.swift */, A921C2E12ED071C900E57B1A /* ListRow.swift */,
A921C2DE2ED067BB00E57B1A /* WelcomeView.swift */,
A9EB72462EB948C400658CEB /* StickerRow.swift */,
A957C1732ECCE2CE00EA3EE9 /* SettingsView.swift */,
A955B3F42EC22EE900E1732D /* SearchView.swift */,
A955B3F02EC22E9700E1732D /* BrowseView.swift */,
A9BDEADD2F82BC93002798DF /* NoStickersView.swift */,
A955B3EC2EC22C4A00E1732D /* DownloadedView.swift */,
A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */,
); );
path = SwiftUI; path = SwiftUI;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -310,7 +323,7 @@
A91C098E2EBBD7C700210C34 /* UIKit */ = { A91C098E2EBBD7C700210C34 /* UIKit */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A9EB72382EB93FDB00658CEB /* EmojiCollectionView.swift */, A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */,
); );
path = UIKit; path = UIKit;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -341,6 +354,7 @@
A949B1F22EA04E8200215164 /* StickerSlack */ = { A949B1F22EA04E8200215164 /* StickerSlack */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A9BDEAE12F82BFF8002798DF /* Info.plist */,
A9A7A4502F68447F00BB84C6 /* Models */, A9A7A4502F68447F00BB84C6 /* Models */,
A924C3742EA9134C00F20781 /* StickerSlack.entitlements */, A924C3742EA9134C00F20781 /* StickerSlack.entitlements */,
A949B1F12EA04E8200215164 /* StickerSlackApp.swift */, A949B1F12EA04E8200215164 /* StickerSlackApp.swift */,
@@ -617,13 +631,14 @@
A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */, A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */,
A957C1742ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */, A957C1742ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */,
A9A7A44B2F6837A800BB84C6 /* GiphyUser.swift in Sources */, A9A7A44B2F6837A800BB84C6 /* GiphyUser.swift in Sources */,
A9EB72392EB93FDB00658CEB /* EmojiCollectionView.swift in Sources */, A9EB72392EB93FDB00658CEB /* EmojiTableView.swift in Sources */,
A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */, A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */,
A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */, A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */,
A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */, A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */,
A9BDEADE2F82BC93002798DF /* NoStickersView.swift in Sources */,
A955B3F52EC22EE900E1732D /* SearchView.swift in Sources */, A955B3F52EC22EE900E1732D /* SearchView.swift in Sources */,
A935437B2EB2A3C800BB80A4 /* FilterCategory.swift in Sources */, A935437B2EB2A3C800BB80A4 /* FilterCategory.swift in Sources */,
A9CD6C352EDDE22800B7F421 /* EmojiPackView.swift in Sources */, A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */,
A9A7A44E2F68383900BB84C6 /* GiphyImages.swift in Sources */, A9A7A44E2F68383900BB84C6 /* GiphyImages.swift in Sources */,
A9C172DD2EB8C9AC008A7885 /* Trie.swift in Sources */, A9C172DD2EB8C9AC008A7885 /* Trie.swift in Sources */,
A955B3F22EC22E9700E1732D /* BrowseView.swift in Sources */, A955B3F22EC22E9700E1732D /* BrowseView.swift in Sources */,
@@ -638,11 +653,12 @@
A9BBC5182EB8FA4500FFE82F /* ViewModifiers.swift in Sources */, A9BBC5182EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
A9EB72492EB948C400658CEB /* StickerRow.swift in Sources */, A9EB72492EB948C400658CEB /* StickerRow.swift in Sources */,
A921C2E22ED071C900E57B1A /* ListRow.swift in Sources */, A921C2E22ED071C900E57B1A /* ListRow.swift in Sources */,
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */, A9773C2F2EA54AF000F3B753 /* StickerPreview.swift in Sources */,
A9BE30F02F5B004800A57668 /* GifHoarder.swift in Sources */, A9BE30F02F5B004800A57668 /* GifHoarder.swift in Sources */,
A9BE30F22F5B004E00A57668 /* Gif.swift in Sources */, A9BE30F22F5B004E00A57668 /* Gif.swift in Sources */,
A9BE30EC2F5AFE1E00A57668 /* StickerType.swift in Sources */, A9BE30EC2F5AFE1E00A57668 /* StickerType.swift in Sources */,
A9A7A4482F68361200BB84C6 /* Meta.swift in Sources */, A9A7A4482F68361200BB84C6 /* Meta.swift in Sources */,
A995D95C2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */,
A9BE30FE2F5FA47100A57668 /* Hoarder.swift in Sources */, A9BE30FE2F5FA47100A57668 /* Hoarder.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -656,6 +672,7 @@
A986A6C32EB6598100B6E0FA /* FilterCategory.swift in Sources */, A986A6C32EB6598100B6E0FA /* FilterCategory.swift in Sources */,
A9CD6C3A2EDDE6B500B7F421 /* EmojiPack.swift in Sources */, A9CD6C3A2EDDE6B500B7F421 /* EmojiPack.swift in Sources */,
A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */, A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */,
A9BDEAE02F82BCB4002798DF /* NoStickersView.swift in Sources */,
A9BE30FA2F5B03F400A57668 /* Sticker.swift in Sources */, A9BE30FA2F5B03F400A57668 /* Sticker.swift in Sources */,
A986A6CD2EB659E000B6E0FA /* MessagesViewController.swift in Sources */, A986A6CD2EB659E000B6E0FA /* MessagesViewController.swift in Sources */,
A9A7A4572F69568700BB84C6 /* GifHoarder.swift in Sources */, A9A7A4572F69568700BB84C6 /* GifHoarder.swift in Sources */,
@@ -670,6 +687,7 @@
A957C17E2ECFAA1100EA3EE9 /* GifView.swift in Sources */, A957C17E2ECFAA1100EA3EE9 /* GifView.swift in Sources */,
A9A7A45F2F69570200BB84C6 /* Gif.swift in Sources */, A9A7A45F2F69570200BB84C6 /* Gif.swift in Sources */,
A9A7A45E2F6956B700BB84C6 /* StickerType.swift in Sources */, A9A7A45E2F6956B700BB84C6 /* StickerType.swift in Sources */,
A9D6A8212F7014AE00F198FB /* TestStructures.swift in Sources */,
A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */, A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
A986A6C42EB6598500B6E0FA /* SlackResponse.swift in Sources */, A986A6C42EB6598500B6E0FA /* SlackResponse.swift in Sources */,
A986A6C22EB6597600B6E0FA /* Emoji.swift in Sources */, A986A6C22EB6597600B6E0FA /* Emoji.swift in Sources */,
@@ -689,22 +707,26 @@
A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */, A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */,
A9BE30F72F5B011A00A57668 /* StickerProtocol.swift in Sources */, A9BE30F72F5B011A00A57668 /* StickerProtocol.swift in Sources */,
A9BE30FC2F5B03F400A57668 /* Sticker.swift in Sources */, A9BE30FC2F5B03F400A57668 /* Sticker.swift in Sources */,
A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */,
A9B9A82F2EB2CCED004C9245 /* EmojiHoarder.swift in Sources */, A9B9A82F2EB2CCED004C9245 /* EmojiHoarder.swift in Sources */,
A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */, A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */,
A921C2E32ED071C900E57B1A /* ListRow.swift in Sources */, A921C2E32ED071C900E57B1A /* ListRow.swift in Sources */,
A9BE30EF2F5B004800A57668 /* GifHoarder.swift in Sources */, A9BE30EF2F5B004800A57668 /* GifHoarder.swift in Sources */,
A9A7A4492F68361200BB84C6 /* Meta.swift in Sources */, A9A7A4492F68361200BB84C6 /* Meta.swift in Sources */,
A9EB724A2EB948E000658CEB /* EmojiCollectionView.swift in Sources */, A9EB724A2EB948E000658CEB /* EmojiTableView.swift in Sources */,
A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */, A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */,
A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */, A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
A995D95B2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */,
A955B3ED2EC22C4A00E1732D /* DownloadedView.swift in Sources */, A955B3ED2EC22C4A00E1732D /* DownloadedView.swift in Sources */,
A9EC46AD2F6D9E4600E066E6 /* Hoarder.swift in Sources */,
A9A7A4682F6AA17C00BB84C6 /* Int.swift in Sources */, A9A7A4682F6AA17C00BB84C6 /* Int.swift in Sources */,
A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */, A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */,
A957C1752ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */, A957C1752ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */,
A9CD6C362EDDE22800B7F421 /* EmojiPackView.swift in Sources */, A9CD6C362EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */,
A9EB72472EB948C400658CEB /* StickerRow.swift in Sources */, A9EB72472EB948C400658CEB /* StickerRow.swift in Sources */,
A9CD6C392EDDE37500B7F421 /* EmojiPackManager.swift in Sources */, A9CD6C392EDDE37500B7F421 /* EmojiPackManager.swift in Sources */,
A955B3F62EC22EE900E1732D /* SearchView.swift in Sources */, A955B3F62EC22EE900E1732D /* SearchView.swift in Sources */,
A9BDEADF2F82BC93002798DF /* NoStickersView.swift in Sources */,
A9B9A8322EB2CD29004C9245 /* SlackResponse.swift in Sources */, A9B9A8322EB2CD29004C9245 /* SlackResponse.swift in Sources */,
A957C1782ECD008E00EA3EE9 /* Bundle.swift in Sources */, A957C1782ECD008E00EA3EE9 /* Bundle.swift in Sources */,
A921C2E02ED067BB00E57B1A /* WelcomeView.swift in Sources */, A921C2E02ED067BB00E57B1A /* WelcomeView.swift in Sources */,
@@ -714,7 +736,7 @@
A9A7A44C2F6837A800BB84C6 /* GiphyUser.swift in Sources */, A9A7A44C2F6837A800BB84C6 /* GiphyUser.swift in Sources */,
A9B9A8312EB2CD14004C9245 /* FilterCategory.swift in Sources */, A9B9A8312EB2CD14004C9245 /* FilterCategory.swift in Sources */,
A957C1802ECFAA1100EA3EE9 /* GifView.swift in Sources */, A957C1802ECFAA1100EA3EE9 /* GifView.swift in Sources */,
A9EB72502EB94FAD00658CEB /* EmojiPreview.swift in Sources */, A9EB72502EB94FAD00658CEB /* StickerPreview.swift in Sources */,
A9A7A4432F68360200BB84C6 /* GifObject.swift in Sources */, A9A7A4432F68360200BB84C6 /* GifObject.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -879,6 +901,7 @@
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly; ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = StickerSlack/Info.plist;
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
@@ -909,7 +932,7 @@
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2,7"; TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 1; XROS_DEPLOYMENT_TARGET = 1;
}; };
@@ -930,6 +953,7 @@
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly; ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = StickerSlack/Info.plist;
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
@@ -960,7 +984,7 @@
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2,7"; TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 1; XROS_DEPLOYMENT_TARGET = 1;
}; };
@@ -993,7 +1017,7 @@
SWIFT_APPROACHABLE_CONCURRENCY = YES; SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Debug; name = Debug;
@@ -1025,7 +1049,7 @@
SWIFT_APPROACHABLE_CONCURRENCY = YES; SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
}; };
@@ -1048,7 +1072,7 @@
SWIFT_APPROACHABLE_CONCURRENCY = YES; SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StickerSlack.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StickerSlack"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StickerSlack.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StickerSlack";
}; };
@@ -1071,7 +1095,7 @@
SWIFT_APPROACHABLE_CONCURRENCY = YES; SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StickerSlack.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StickerSlack"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StickerSlack.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StickerSlack";
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2630"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A986A6AC2EB658DF00B6E0FA"
BuildableName = "StickerSlackiMessageApp.appex"
BlueprintName = "StickerSlackiMessageApp"
ReferencedContainer = "container:StickerSlack.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A949B1DE2EA04C0B00215164"
BuildableName = "StickerSlack.app"
BlueprintName = "StickerSlack"
ReferencedContainer = "container:StickerSlack.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
askForAppToLaunch = "Yes"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A949B1DE2EA04C0B00215164"
BuildableName = "StickerSlack.app"
BlueprintName = "StickerSlack"
ReferencedContainer = "container:StickerSlack.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A949B1DE2EA04C0B00215164"
BuildableName = "StickerSlack.app"
BlueprintName = "StickerSlack"
ReferencedContainer = "container:StickerSlack.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -12,22 +12,15 @@ struct EmojiPack: Identifiable, Codable {
var name: String var name: String
var description: String var description: String
var emojiNames: [String] var emojiNames: [String]
}
static var test: EmojiPack {
extension EmojiPack {
static func new() -> EmojiPack {
EmojiPack( EmojiPack(
id: UUID(), id: UUID(),
name: "test pack", name: "New Pack",
description: "neon443's debug emoji pack", description: "Emoji Pack at \(Date().formatted())",
emojiNames: [ emojiNames: []
"pf",
"heavysob",
"yay",
"skulk",
"loll",
"bleh",
"uhh",
"communist"
]
) )
} }
} }
@@ -11,9 +11,46 @@ struct EmojiPackManager: View {
@ObservedObject var hoarder: EmojiHoarder @ObservedObject var hoarder: EmojiHoarder
var body: some View { var body: some View {
ForEach(hoarder.emojiPacks) { pack in NavigationStack {
EmojiPackView(hoarder: hoarder, pack: pack) List {
ForEach($hoarder.emojiPacks) { $pack in
NavigationLink {
EmojiPackDetailView(hoarder: hoarder, pack: $pack)
} label: {
Text(pack.name)
}
.swipeActions(edge: .trailing) {
Button {
withAnimation {
hoarder.emojiPacks.removeAll { $0.id == pack.id }
}
} label: {
Label("Delete", systemImage: "trash")
}
.tint(.red)
}
}
NavigationLink {
EmojiPackDetailView(hoarder: hoarder, pack: .constant(.test))
} label: {
Text("test")
}
}
.navigationTitle("Emoji Packs")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem {
Button {
hoarder.emojiPacks.append(.new())
} label: {
Image(systemName: "plus")
}
.tint(.accentColor)
.modifier(glassButtonIfAv())
}
}
} }
Divider()
} }
} }
+2 -16
View File
@@ -11,15 +11,11 @@ import SwiftUI
import Messages import Messages
import UniformTypeIdentifiers import UniformTypeIdentifiers
@MainActor
struct Emoji: StickerProtocol { struct Emoji: StickerProtocol {
var id: String var id: String
var name: String var name: String
var localImageURLString: String { var typeGlyph: String = "slack.logo"
let urlString = remoteImageURL.absoluteString
let split = urlString.split(separator: ".")
let fileExtension = ".\(split.last ?? "png")"
return EmojiHoarder.container.absoluteString+id+fileExtension
}
var remoteImageURL: URL var remoteImageURL: URL
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
@@ -44,14 +40,4 @@ struct Emoji: StickerProtocol {
self.name = name self.name = name
self.remoteImageURL = url self.remoteImageURL = url
} }
static var test: Emoji = Emoji(
name: "a test slack emoji",
url: Bundle.main.url(forResource: "image", withExtension: "png")!
)
static var testLongName: Emoji = Emoji(
name: "ForEach<Array<String>, String, EmojiRow>: the ID jarjarbinks occurs multiple times within the collection, this will give undefined results!",
url: Bundle.main.url(forResource: "image", withExtension: "png")!
)
} }
+64 -86
View File
@@ -11,19 +11,18 @@ import Combine
import UniformTypeIdentifiers import UniformTypeIdentifiers
import Haptics import Haptics
class EmojiHoarder: Hoarder, ObservableObject { class EmojiHoarder: BaseHoarder {
static let container: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.neon443.StickerSlack")!.appendingPathComponent("Library", conformingTo: .directory) nonisolated static let container: URL = library.appendingPathComponent("Emojis", conformingTo: .directory)
nonisolated static let localEmojiDB: URL = EmojiHoarder.container.appendingPathComponent("_localEmojiDB.json", conformingTo: .fileURL) nonisolated static let localEmojiDB: URL = EmojiHoarder.library.appendingPathComponent("_____localEmojiDB.json", conformingTo: .fileURL)
nonisolated static let localTrie: URL = EmojiHoarder.container.appendingPathComponent("_localTrie.json", conformingTo: .fileURL) nonisolated static let localTrieDict: URL = EmojiHoarder.library.appendingPathComponent("_____localTrieDict.json", conformingTo: .fileURL)
nonisolated static let localTrieDict: URL = EmojiHoarder.container.appendingPathComponent("_localTrieDict.json", conformingTo: .fileURL)
let endpoint: URL = URL(string: "https://cachet.dunkirk.sh/emojis")! let endpoint: URL = URL(string: "https://cachet.dunkirk.sh/emojis")!
@Published var emojis: [Emoji] = [] @Published var emojis: [Emoji] = []
@Published var emojiPacks: [EmojiPack] = [] @Published var emojiPacks: [EmojiPack] = [.test]
@Published var trie: Trie = Trie() @Published var trie: Trie = Trie()
@Published var downloadedStickers: Set<String> = [] // @Published var downloadedStickers: Set<String> = []
@Published var downloadedEmojisArr: [String] = [] var downloadedStickersArr: [String] = []
@Published var letterStats: [EmojiHoarder.LetterStat] = [] @Published var letterStats: [EmojiHoarder.LetterStat] = []
@Published var letterStatsSorting: EmojiHoarder.LetterStatSorting = .init(by: .letter, ascending: true) @Published var letterStatsSorting: EmojiHoarder.LetterStatSorting = .init(by: .letter, ascending: true)
@@ -31,18 +30,29 @@ class EmojiHoarder: Hoarder, ObservableObject {
@Published var showWelcome: Bool = false @Published var showWelcome: Bool = false
init(localOnly: Bool = false, skipIndex: Bool = false) { init(localOnly: Bool = false, skipIndex: Bool = false) {
super.init()
self.showWelcome = !UserDefaults.standard.bool(forKey: "showWelcome") self.showWelcome = !UserDefaults.standard.bool(forKey: "showWelcome")
let localDB = loadLocalDB() if !FileManager.default.fileExists(atPath: EmojiHoarder.container.path()) {
withAnimation(.snappy) { self.emojis = localDB } try! FileManager.default.createDirectory(at: EmojiHoarder.container, withIntermediateDirectories: true)
loadTrie() }
if !skipIndex { buildTrie() }
guard !localOnly else { return } self.emojis = loadLocalDB()
Task { loadTrie()
startLoading(localOnly: localOnly, skipIndex: skipIndex)
}
func startLoading(localOnly: Bool, skipIndex: Bool) {
Task.detached {
if !skipIndex { await self.buildTrie() }
guard !localOnly else { return }
print("start loading remote db") print("start loading remote db")
await self.loadRemoteDB() await self.loadRemoteDB()
print("end") print("end")
if !skipIndex { if !skipIndex {
await self.buildTrie() await self.buildTrie()
} }
@@ -52,9 +62,6 @@ class EmojiHoarder: Hoarder, ObservableObject {
@MainActor @MainActor
func downloadAllStickers() async { func downloadAllStickers() async {
let start: Date = .now let start: Date = .now
downloadedEmojisArr = []
let cores = ProcessInfo.processInfo.processorCount-1 let cores = ProcessInfo.processInfo.processorCount-1
var ranges: [Range<Int>] = [] var ranges: [Range<Int>] = []
for i in 0..<cores { for i in 0..<cores {
@@ -71,11 +78,10 @@ class EmojiHoarder: Hoarder, ObservableObject {
for range in ranges { for range in ranges {
group.addTask { group.addTask {
for i in range { for i in range {
await MainActor.run { self.downloadedEmojisArr.append(self.emojis[i].name) } guard await !self.downloadedStickers.contains(await self.emojis[i].name) else { continue }
guard !self.downloadedStickers.contains(await self.emojis[i].name) else { continue } await self.download(emoji: self.emojis[i], skipStoreIndex: true)
Task { await self.download(emoji: self.emojis[i], skipStoreIndex: true) } let _ = await MainActor.run { self.downloadedStickers.insert(self.emojis[i].name) }
await MainActor.run { self.downloadedStickers.insert(self.emojis[i].name) } if await i == self.emojis.count {
if i == self.emojis.count {
Task { @MainActor in Task { @MainActor in
self.storeDownloadedIndexes() self.storeDownloadedIndexes()
} }
@@ -95,7 +101,6 @@ class EmojiHoarder: Hoarder, ObservableObject {
delete(emoji: emojis[i], skipStoreIndex: true) delete(emoji: emojis[i], skipStoreIndex: true)
} }
downloadedStickers = [] downloadedStickers = []
downloadedEmojisArr = []
storeDownloadedIndexes() storeDownloadedIndexes()
} }
@@ -108,24 +113,14 @@ class EmojiHoarder: Hoarder, ObservableObject {
trie.dict = [:] trie.dict = [:]
trie.wordlist = [] trie.wordlist = []
try? FileManager.default.removeItem(at: EmojiHoarder.localEmojiDB) try? FileManager.default.removeItem(at: EmojiHoarder.localEmojiDB)
try? FileManager.default.removeItem(at: EmojiHoarder.localTrie)
try? FileManager.default.removeItem(at: EmojiHoarder.localTrieDict) try? FileManager.default.removeItem(at: EmojiHoarder.localTrieDict)
downloadedStickers = [] downloadedStickers = []
downloadedEmojisArr = []
UserDefaults.standard.removeObject(forKey: "downloadedEmojis") UserDefaults.standard.removeObject(forKey: "downloadedEmojis")
UserDefaults.standard.removeObject(forKey: "downloadedEmojisArr")
letterStats = [] letterStats = []
} }
//cl i disabled ts cos its quicker to rebuild it then to load ts
private func saveTrie() { private func saveTrie() {
// return
// guard let data = try? encoder.encode(trie.root) else {
// fatalError("failed to encode trie")
// }
// try! data.write(to: EmojiHoarder.localTrie)
guard let dataDict = try? encoder.encode(trie.dict) else { guard let dataDict = try? encoder.encode(trie.dict) else {
fatalError("failed to encode trie dict") fatalError("failed to encode trie dict")
} }
@@ -133,15 +128,7 @@ class EmojiHoarder: Hoarder, ObservableObject {
} }
private func loadTrie() { private func loadTrie() {
// return guard FileManager.default.fileExists(atPath: EmojiHoarder.localTrieDict.path()) else { return }
// guard FileManager.default.fileExists(atPath: EmojiHoarder.localTrie.path) else { return }
// guard let data = try? Data(contentsOf: EmojiHoarder.localTrie) else { return }
// guard let decoded = try? decoder.decode(TrieNode.self, from: data) else {
// fatalError("failed to decode trie")
// }
// self.trie.root = decoded
guard FileManager.default.fileExists(atPath: EmojiHoarder.localTrieDict.path) else { return }
guard let dataDict = try? Data(contentsOf: EmojiHoarder.localTrieDict) else { return } guard let dataDict = try? Data(contentsOf: EmojiHoarder.localTrieDict) else { return }
guard let decodedDict = try? decoder.decode([String:Emoji].self, from: dataDict) else { guard let decodedDict = try? decoder.decode([String:Emoji].self, from: dataDict) else {
fatalError("failed to decode dict") fatalError("failed to decode dict")
@@ -149,45 +136,34 @@ class EmojiHoarder: Hoarder, ObservableObject {
self.trie.dict = decodedDict self.trie.dict = decodedDict
} }
func buildTrie() { nonisolated
func buildTrie() async {
let start = Date().timeIntervalSince1970 let start = Date().timeIntervalSince1970
for emoji in emojis { var wordlist = await trie.wordlist
trie.insert(word: emoji.name) var dict = await trie.dict
for emoji in await emojis {
// trie.insert(word: emoji.name)
wordlist.insert(emoji.name)
dict[emoji.name] = emoji
} }
buildTrieDict() await trie.wordlist = wordlist
saveTrie() await trie.dict = dict
generateLetterStats()
await buildDownloadedStickers()
await saveTrie()
print("done building trie in", Date().timeIntervalSince1970-start) print("done building trie in", Date().timeIntervalSince1970-start)
} }
private func buildTrieDict() { override func buildDownloadedStickers(for stickerType: String = "Emojis") async {
for emoji in emojis { await super.buildDownloadedStickers(for: stickerType)
trie.dict[emoji.name] = emoji downloadedStickersArr = Array(downloadedStickers).sorted()
}
buildDownloadedEmojis()
}
private func buildDownloadedEmojis() {
downloadedStickers = []
downloadedEmojisArr = []
downloadedEmojisArr = (try? decoder.decode([String].self, from: UserDefaults.standard.data(forKey: "downloadedEmojisArr") ?? Data())) ?? []
downloadedStickers = (try? decoder.decode(Set<String>.self, from: UserDefaults.standard.data(forKey: "downloadedEmojis") ?? Data())) ?? []
if downloadedStickers.isEmpty || downloadedEmojisArr.isEmpty {
for emoji in emojis {
guard emoji.isLocal else { continue }
downloadedStickers.insert(emoji.name)
downloadedEmojisArr.append(emoji.name)
}
}
} }
func storeDownloadedIndexes() { func storeDownloadedIndexes() {
UserDefaults.standard.set(try! encoder.encode(downloadedStickers), forKey: "downloadedEmojis") UserDefaults.standard.set(try! encoder.encode(downloadedStickers), forKey: "downloadedEmojis")
UserDefaults.standard.set(try! encoder.encode(downloadedEmojisArr), forKey: "downloadedEmojisArr")
} }
nonisolated // nonisolated
private func loadLocalDB() -> [Emoji] { private func loadLocalDB() -> [Emoji] {
if let localEmojiDB = try? Data(contentsOf: EmojiHoarder.localEmojiDB) { if let localEmojiDB = try? Data(contentsOf: EmojiHoarder.localEmojiDB) {
let decoded = try! decoder.decode([Emoji].self, from: localEmojiDB) let decoded = try! decoder.decode([Emoji].self, from: localEmojiDB)
@@ -196,10 +172,13 @@ class EmojiHoarder: Hoarder, ObservableObject {
return [] return []
} }
nonisolated
private func loadRemoteDB() async { private func loadRemoteDB() async {
async let fetched = self.fetchRemoteDB() async let fetched = self.fetchRemoteDB()
if let fetched = await fetched { if let fetched = await fetched {
withAnimation(.snappy) { self.emojis = fetched } await MainActor.run {
withAnimation(.snappy) { self.emojis = fetched }
}
} }
} }
@@ -207,8 +186,7 @@ class EmojiHoarder: Hoarder, ObservableObject {
private func fetchRemoteDB() async -> [Emoji]? { private func fetchRemoteDB() async -> [Emoji]? {
do { do {
async let (data, _) = try URLSession.shared.data(from: endpoint) async let (data, _) = try URLSession.shared.data(from: endpoint)
decoder.dateDecodingStrategy = .iso8601 let decoded: [SlackResponse] = try await decoder.decode([SlackResponse].self, from: await data)
let decoded: [SlackResponse] = try decoder.decode([SlackResponse].self, from: await data)
try await storeDB(data: await data) try await storeDB(data: await data)
return await SlackResponse.toEmojis(from: decoded) return await SlackResponse.toEmojis(from: decoded)
} catch { } catch {
@@ -222,41 +200,41 @@ class EmojiHoarder: Hoarder, ObservableObject {
let local = loadLocalDB() let local = loadLocalDB()
await MainActor.run { await MainActor.run {
emojis = local emojis = local
buildTrie()
} }
await buildTrie()
return return
} }
await MainActor.run { await MainActor.run {
withAnimation(.snappy) { self.emojis = fetched } withAnimation(.snappy) { self.emojis = fetched }
buildTrie()
} }
await buildTrie()
} }
nonisolated func download(emoji: StickerProtocol, skipStoreIndex: Bool = false) async { override nonisolated func download(emoji: any StickerProtocol, skipStoreIndex: Bool = false) async {
try? await emoji.downloadImage() await super.download(emoji: emoji, skipStoreIndex: skipStoreIndex)
// try? await emoji.downloadImage()
await MainActor.run { await MainActor.run {
if !skipStoreIndex { if !skipStoreIndex {
withAnimation(.snappy) { let _ = withAnimation(.snappy) {
self.downloadedStickers.insert(emoji.name) self.downloadedStickers.insert(emoji.name)
self.downloadedEmojisArr.append(emoji.name) self.downloadedStickersArr.append(emoji.name)
} }
self.storeDownloadedIndexes() self.storeDownloadedIndexes()
} }
if !skipStoreIndex { Haptic.success.trigger() }
} }
} }
@MainActor override func delete(emoji: any StickerProtocol, skipStoreIndex: Bool = false) {
func delete(emoji: StickerProtocol, skipStoreIndex: Bool = false) { super.delete(emoji: emoji, skipStoreIndex: skipStoreIndex)
emoji.deleteImage() // emoji.deleteImage()
if !skipStoreIndex { if !skipStoreIndex {
withAnimation(.snappy) { let _ = withAnimation(.snappy) {
downloadedStickers.remove(emoji.name) downloadedStickers.remove(emoji.name)
downloadedEmojisArr.removeAll(where: { $0 == emoji.name }) downloadedStickersArr.removeAll(where: { $0 == emoji.name })
} }
storeDownloadedIndexes() storeDownloadedIndexes()
} }
if !skipStoreIndex { Haptic.heavy.trigger() }
} }
func setShowWelcome(to newValue: Bool) { func setShowWelcome(to newValue: Bool) {
+2 -3
View File
@@ -12,9 +12,8 @@ class GifManager {
//from clock-run, 12 frames one second //from clock-run, 12 frames one second
static let defaultDuration: Double = 0.083333333333333329 static let defaultDuration: Double = 0.083333333333333329
static func gifFrom(url: URL) async -> [(frame: CGImage, showFor: Double)] { static func gifFrom(url: URL) async throws -> [(frame: CGImage, showFor: Double)] {
guard let (data, _) = try? await URLSession.shared.data(from: url) else { return [] } let (data, _) = try await URLSession.shared.data(from: url)
return gifFrom(data: data) return gifFrom(data: data)
} }
+56 -22
View File
@@ -16,47 +16,81 @@ struct GifView: View {
@State var currentI: Int = 0 @State var currentI: Int = 0
@State var timer: Timer? @State var timer: Timer?
@State var error: Error?
@State var failed: Bool = false
func run() async {
do {
if gif.isEmpty {
let frames = try await GifManager.gifFrom(url: url)
withAnimation(.spring) {
self.gif = frames
}
}
} catch {
self.error = error
}
guard self.error == nil && !self.gif.isEmpty else {
print("falied loading or empty gif")
withAnimation(.spring) { self.failed = true }
return
}
guard gif.count > 0 else { return }
if timer != nil {
timer!.invalidate()
timer = nil
}
timer = Timer(timeInterval: gif[0].showFor, repeats: true) { timer in
if currentI == (gif.count-1) {
currentI = 0
} else {
currentI += 1
}
}
RunLoop.main.add(timer!, forMode: .common)
}
var body: some View { var body: some View {
// /*@START_MENU_TOKEN@*//*@PLACEHOLDER=Hello, world!@*/Text("Hello, world!")/*@END_MENU_TOKEN@*/ // /*@START_MENU_TOKEN@*//*@PLACEHOLDER=Hello, world!@*/Text("Hello, world!")/*@END_MENU_TOKEN@*/
TimelineView(.animation) { tl in TimelineView(.animation) { tl in
VStack { VStack {
if currentI < gif.count { if gif.isEmpty && error == nil {
let image = Image(uiImage: .init(cgImage: gif[currentI].frame)) ProgressView()
image .controlSize(.large)
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else if failed {
Image(systemName: "xmark")
.resizable().scaledToFit() .resizable().scaledToFit()
.padding()
.padding()
.background(.red)
} else {
if currentI < gif.count {
let image = Image(uiImage: .init(cgImage: gif[currentI].frame))
image
.resizable().scaledToFit()
}
} }
} }
.transition(.scale)
} }
.onDisappear { .onDisappear {
timer?.invalidate() timer?.invalidate()
timer = nil timer = nil
} }
.task { .task {
if gif.isEmpty { await run()
self.gif = await GifManager.gifFrom(url: url)
}
guard gif.count > 0 else { return }
if timer != nil {
timer!.invalidate()
timer = nil
}
timer = Timer(timeInterval: gif[0].showFor, repeats: true) { timer in
if currentI == (gif.count-1) {
currentI = 0
} else {
currentI += 1
}
}
RunLoop.main.add(timer!, forMode: .common)
} }
} }
} }
#Preview { #Preview {
GifView( GifView(
url: URL(string: "https://emoji.slack-edge.com/T0266FRGM/clockrun/ec33c513d30a6ed8.gif")! url: URL(string: "https://emoji.slack-edge.com/T09V59WQY1E/clockrun/f6641714fa6748ac.gif")!
) )
GifView(url: Emoji.test.remoteImageURL)
GifView(url: Emoji.testLongName.localImageURL)
GifView(url: Gif.test.remoteImageURL)
} }
@@ -0,0 +1,144 @@
//
// TestStructures.swift
// StickerSlack
//
// Created by neon443 on 21/03/2026.
//
import Foundation
@MainActor
extension Emoji {
static var test: Emoji = Emoji(
name: "a test slack emoji",
url: Bundle.main.url(forResource: "image", withExtension: "png")!
)
static var testLongName: Emoji = Emoji(
name: "ForEach<Array<String>, String, EmojiRow>: the ID jarjarbinks occurs multiple times within the collection, this will give undefined results!",
url: Bundle.main.url(forResource: "image", withExtension: "png")!
)
}
@MainActor
extension Gif {
static var test: Gif = GifObject(
type: "gif",
id: "XAeEGyCbp8UehBPkSA",
slug: "know-does-he-XAeEGyCbp8UehBPkSA",
url: "https://giphy.com/gifs/know-does-he-XAeEGyCbp8UehBPkSA",
bitly_url: "https://gph.is/g/4AKMQlV",
embed_url: "https://giphy.com/embed/XAeEGyCbp8UehBPkSA",
username: "Ommarbisafool",
source: "",
rating: "g",
source_tld: "",
source_post_url: "",
import_datetime: "2025-11-06 15:48:02",
images: GiphyImages(
fixed_height: .init(
url: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200.gif?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200.gif&ct=g",
width: "270",
height: "200",
size: "74672",
mp4: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200.mp4?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200.mp4&ct=g",
mp4_size: "11433",
webp: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200.webp?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200.webp&ct=g",
webp_size: "10962"
),
fixed_height_still: nil,
fixed_height_downsampled: .init(
url: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200_d.gif?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200_d.gif&ct=g",
width: "270",
height: "200",
size: "51332",
webp: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200_d.webp?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200_d.webp&ct=g",
webp_size: "44850"
),
fixed_height_small: .init(
url: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/100.gif?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=100.gif&ct=g",
width: "134",
height: "100",
size: "16461",
mp4: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/100.mp4?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=100.mp4&ct=g",
mp4_size: "5340",
webp: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/100.webp?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=100.webp&ct=g",
webp_size: "3142"
),
fixed_height_small_still: nil,
fixed_width: .init(
url: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200w.gif?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200w.gif&ct=g",
width: "200",
height: "148",
size: "42579",
mp4: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200w.mp4?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200w.mp4&ct=g",
mp4_size: "8158",
webp: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200w.webp?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200w.webp&ct=g",
webp_size: "4458"
),
fixed_width_still: nil,
fixed_width_downsampled: .init(
url: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200w_d.gif?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200w_d.gif&ct=g",
width: "200",
height: "148",
size: "23483",
webp: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/200w_d.webp?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=200w_d.webp&ct=g",
webp_size: "22586"
),
fixed_width_small: .init(
url: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/100w.gif?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=100w.gif&ct=g",
width: "100",
height: "74",
size: "8150",
mp4: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/100w.mp4?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=100w.mp4&ct=g",
mp4_size: "4103",
webp: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/100w.webp?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=100w.webp&ct=g",
webp_size: "1814"
),
fixed_width_small_still: nil,
downsized: nil,
downsized_still: nil,
downsized_large: nil,
downsized_medium: nil,
downsized_small: nil,
original: .init(
url: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/giphy.gif?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=giphy.gif&ct=g",
width: "480",
height: "356",
size: "245829",
mp4: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/giphy.mp4?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=giphy.mp4&ct=g",
mp4_size: "23259",
webp: "https://media2.giphy.com/media/XAeEGyCbp8UehBPkSA/giphy.webp?cid=acd65332fv0sn3gzwa5vi4jw834l2hhwmfm6d90329p1590n&ep=v1_gifs_search&rid=giphy.webp&ct=g",
webp_size: "26984"
),
original_still: nil,
// looping: nil,
preview: nil,
preview_gif: nil
),
title: "Know GIF",
alt_text: "",
is_low_contrast: false
).toGif
}
@MainActor
extension EmojiPack {
static var test: EmojiPack {
EmojiPack(
id: UUID(),
name: "test pack",
description: "neon443's debug emoji pack",
emojiNames: [
"pf",
"heavysob",
"yay",
"skulk",
"loll",
"bleh",
"uhh",
"communist"
]
)
}
}
+9 -34
View File
@@ -9,53 +9,28 @@ import Foundation
import SwiftUI import SwiftUI
import UniformTypeIdentifiers import UniformTypeIdentifiers
@MainActor
struct Gif: StickerProtocol { struct Gif: StickerProtocol {
var id: String var id: String
var name: String var name: String
var localImageURLString: String { var typeGlyph: String = "giphy.logo"
let urlString = remoteImageURL.absoluteString
let split = urlString.split(separator: ".")
let fileExtension = ".\(split.last ?? "png")"
return EmojiHoarder.container.appendingPathComponent("gifs", conformingTo: .directory).absoluteString+id+fileExtension
}
var remoteImageURL: URL var remoteImageURL: URL
// enum CodingKeys: String, CodingKey { var giphyImages: GiphyImages?
//
// } // enum CodingKeys: String, CodingKey {
//
// }
init( init(
name: String, name: String,
url: URL, url: URL,
giphyImages: GiphyImages?,
id: String = UUID().uuidString id: String = UUID().uuidString
) { ) {
self.id = id self.id = id
self.name = name self.name = name
self.giphyImages = giphyImages
self.remoteImageURL = url self.remoteImageURL = url
} }
func downloadImage() async throws {
if let data = try? Data(contentsOf: localImageURL),
let _ = UIImage(data: data) {
return
}
var (data, _) = try await URLSession.shared.data(from: remoteImageURL)
if let uiImage = UIImage(data: data),
let cgImage = uiImage.cgImage,
!self.localImageURLString.contains(".gif"),
cgImage.width < 300 || cgImage.height < 300 {
data = resize(image: uiImage, to: CGSize(width: 300, height: 300)).pngData()!
}
try! data.write(to: localImageURL)
return
}
static var test: Gif = Gif(
name: "doesheknow",
url: URL(string: "https://media1.tenor.com/m/FN9udnZmQU8AAAAd/does-he-know-batman.gif")!
)
} }
+35 -15
View File
@@ -10,8 +10,8 @@ import SwiftUI
import UniformTypeIdentifiers import UniformTypeIdentifiers
import Combine import Combine
class GifHoarder: Hoarder, ObservableObject { class GifHoarder: BaseHoarder {
static let container: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.neon443.StickerSlack")!.appendingPathComponent("Library", conformingTo: .directory) nonisolated static let container: URL = library.appendingPathComponent("Gifs", conformingTo: .directory)
static var apiKey: String = "a2mFsDTpX5blodY8ltkG6Q1xy5NgFSbc" static var apiKey: String = "a2mFsDTpX5blodY8ltkG6Q1xy5NgFSbc"
var endpoint: URL = URL(string: "https://api.giphy.com/v1/gifs/trending")! var endpoint: URL = URL(string: "https://api.giphy.com/v1/gifs/trending")!
@@ -19,27 +19,28 @@ class GifHoarder: Hoarder, ObservableObject {
@Published var searchTerm: String = "" @Published var searchTerm: String = ""
@Published var trendingGifs: [Gif] = [] @Published var trendingGifs: [Gif] = []
@Published var downloadedStickers: Set<String> = [] // @Published override var downloadedStickers: Set<String> = []
func download(emoji: any StickerProtocol, skipStoreIndex: Bool = false) {
// <#code#>
}
func delete(emoji: any StickerProtocol, skipStoreIndex: Bool = false) {
// <#code#>
}
init(localOnly: Bool = false) { init(localOnly: Bool = false) {
super.init()
if !FileManager.default.fileExists(atPath: GifHoarder.container.path()) {
try! FileManager.default.createDirectory(at: GifHoarder.container, withIntermediateDirectories: true)
}
startLoadingTrending()
}
func startLoadingTrending() {
var components = URLComponents(url: endpoint, resolvingAgainstBaseURL: false) var components = URLComponents(url: endpoint, resolvingAgainstBaseURL: false)
components?.queryItems = [ components?.queryItems = [
URLQueryItem(name: "api_key", value: GifHoarder.apiKey), URLQueryItem(name: "api_key", value: GifHoarder.apiKey),
URLQueryItem(name: "limit", value: "100") URLQueryItem(name: "limit", value: "500")
] ]
guard let finalURL = components?.url else { fatalError("invalid URL for request for trending gifs") }
Task { Task {
do { do {
async let (data, _) = try URLSession.shared.data(from: components!.url!) let (data, _) = try await URLSession.shared.data(from: finalURL)
let object: Trending = try JSONDecoder().decode(Trending.self, from: await data) let object: Trending = try JSONDecoder().decode(Trending.self, from: data)
guard object.meta.status == 200 else { guard object.meta.status == 200 else {
fatalError("non ok status code") fatalError("non ok status code")
} }
@@ -47,6 +48,25 @@ class GifHoarder: Hoarder, ObservableObject {
} catch { } catch {
print(error) print(error)
} }
await buildDownloadedStickers()
} }
} }
override func download(emoji: any StickerProtocol, skipStoreIndex: Bool = false) async {
await super.download(emoji: emoji, skipStoreIndex: skipStoreIndex)
let _ = withAnimation(.snappy) {
downloadedStickers.insert(emoji.name)
}
}
override func delete(emoji: any StickerProtocol, skipStoreIndex: Bool = false) {
super.delete(emoji: emoji, skipStoreIndex: skipStoreIndex)
let _ = withAnimation(.snappy) {
downloadedStickers.remove(emoji.name)
}
}
override func buildDownloadedStickers(for stickerType: String = "Gifs") async {
await super.buildDownloadedStickers(for: stickerType)
}
} }
+47 -5
View File
@@ -9,10 +9,10 @@ import Foundation
import SwiftUI import SwiftUI
import Combine import Combine
import UniformTypeIdentifiers import UniformTypeIdentifiers
import Haptics
protocol Hoarder: ObservableObject { protocol Hoarder: ObservableObject {
static var container: URL { get } static var library: URL { get }
var endpoint: URL { get }
var downloadedStickers: Set<String> { get set } var downloadedStickers: Set<String> { get set }
var encoder: JSONEncoder { get } var encoder: JSONEncoder { get }
var decoder: JSONDecoder { get } var decoder: JSONDecoder { get }
@@ -21,7 +21,49 @@ protocol Hoarder: ObservableObject {
func delete(emoji: any StickerProtocol, skipStoreIndex: Bool) func delete(emoji: any StickerProtocol, skipStoreIndex: Bool)
} }
extension Hoarder { class BaseHoarder: Hoarder {
var encoder: JSONEncoder { JSONEncoder() } nonisolated static let library: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.neon443.StickerSlack")!.appendingPathComponent("Library", conformingTo: .directory)
var decoder: JSONDecoder { JSONDecoder() }
@Published var downloadedStickers: Set<String> = []
var encoder: JSONEncoder = JSONEncoder()
var decoder: JSONDecoder = JSONDecoder()
func download(emoji: any StickerProtocol, skipStoreIndex: Bool) async {
try? await emoji.downloadImage()
await MainActor.run {
Haptic.success.trigger()
}
}
func delete(emoji: any StickerProtocol, skipStoreIndex: Bool) {
emoji.deleteImage()
}
nonisolated func buildDownloadedStickers(for stickerType: String) async {
if let data = UserDefaults.standard.data(forKey: "downloaded\(stickerType)"),
let decoded = try? await decoder.decode(Set<String>.self, from: data) {
await MainActor.run {
downloadedStickers = decoded
}
} else {
var newSet: Set<String> = []
let url = BaseHoarder.library.appendingPathComponent(stickerType, conformingTo: .directory)
if let files = try? FileManager.default.contentsOfDirectory(atPath: url.path()) {
for file in files {
let name = String(file.split(separator: ".")[0])
newSet.insert(name)
}
}
newSet.remove("DS_Store")
let immutable = newSet
await MainActor.run {
self.downloadedStickers = []
self.downloadedStickers = immutable
}
return
}
}
init() { }
} }
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>com.neon443.stickerslack</string>
<key>CFBundleURLSchemes</key>
<array>
<string>stickerslack</string>
</array>
</dict>
</array>
</dict>
</plist>
@@ -7,6 +7,7 @@
import Foundation import Foundation
@MainActor
struct SlackResponse: Identifiable, Codable { struct SlackResponse: Identifiable, Codable {
var type: String var type: String
var id: String var id: String
+7 -1
View File
@@ -7,6 +7,7 @@
import Foundation import Foundation
@MainActor
struct GifObject: Codable, Identifiable { struct GifObject: Codable, Identifiable {
var type: String var type: String
var id: String var id: String
@@ -31,6 +32,11 @@ struct GifObject: Codable, Identifiable {
var is_low_contrast: Bool var is_low_contrast: Bool
var toGif: Gif { var toGif: Gif {
return Gif(name: self.title, url: URL(string: self.images.fixed_width.url)!, id: self.id) return Gif(
name: self.title,
url: URL(string: self.images.fixed_width.url)!,
giphyImages: images,
id: self.id
)
} }
} }
+20 -20
View File
@@ -7,54 +7,54 @@
import Foundation import Foundation
struct GiphyImages: Codable { struct GiphyImages: Codable, Equatable, Hashable {
//fixed height of 200px //fixed height of 200px
var fixed_height: motion var fixed_height: motion
//fixed height of 200px still //fixed height of 200px still
var fixed_height_still: still var fixed_height_still: still?
//fixed height 200px with 6 frames //fixed height 200px with 6 frames
var fixed_height_downsampled: downsampled var fixed_height_downsampled: downsampled
//fixed height of 100px //fixed height of 100px
var fixed_height_small: motion var fixed_height_small: motion
//fixed height of 100px still //fixed height of 100px still
var fixed_height_small_still: still var fixed_height_small_still: still?
//fixed width of 200px //fixed width of 200px
var fixed_width: motion var fixed_width: motion
//fixed width of 200px //fixed width of 200px
var fixed_width_still: still var fixed_width_still: still?
//fixed width 200px with 6 frames //fixed width 200px with 6 frames
var fixed_width_downsampled: downsampled var fixed_width_downsampled: downsampled
//fixed width of 100px //fixed width of 100px
var fixed_width_small: motion var fixed_width_small: motion
//fixed width of 100px still //fixed width of 100px still
var fixed_width_small_still: still var fixed_width_small_still: still?
//under 2mb //under 2mb
var downsized: downsized var downsized: downsized?
//downsized still //downsized still
var downsized_still: still var downsized_still: still?
//under 8mb //under 8mb
var downsized_large: downsized var downsized_large: downsized?
//under 5mb //under 5mb
var downsized_medium: downsized var downsized_medium: downsized?
//under 200kb //under 200kb
var downsized_small: video var downsized_small: video?
var original: motion var original: motion
var original_still: still var original_still: still?
//15s looping version //15s looping version
// var looping: looping // var looping: looping?
//mp4 format 50kb, first 1-2s of the gif //mp4 format 50kb, first 1-2s of the gif
var preview: video var preview: video?
//50kb first 1-2s of the gif //50kb first 1-2s of the gif
var preview_gif: still var preview_gif: still?
struct motion: Codable { struct motion: Codable, Equatable, Hashable {
var url: String var url: String
var width: String var width: String
var height: String var height: String
@@ -64,12 +64,12 @@ struct GiphyImages: Codable {
var webp: String var webp: String
var webp_size: String var webp_size: String
} }
struct still: Codable { struct still: Codable, Equatable, Hashable {
var url: String var url: String
var width: String var width: String
var height: String var height: String
} }
struct downsampled: Codable { struct downsampled: Codable, Equatable, Hashable {
var url: String var url: String
var width: String var width: String
var height: String var height: String
@@ -77,16 +77,16 @@ struct GiphyImages: Codable {
var webp: String var webp: String
var webp_size: String var webp_size: String
} }
struct downsized: Codable { struct downsized: Codable, Equatable, Hashable {
var url: String var url: String
var width: String var width: String
var height: String var height: String
var size: String var size: String
} }
struct looping: Codable { struct looping: Codable, Equatable, Hashable {
var mp4: String var mp4: String
} }
struct video: Codable { struct video: Codable, Equatable, Hashable {
var mp4: String var mp4: String
var mp4_size: String var mp4_size: String
var width: String var width: String
+35 -25
View File
@@ -8,34 +8,23 @@
import Foundation import Foundation
import Messages import Messages
nonisolated
extension StickerProtocol { extension StickerProtocol {
var localImageURL: URL { nonisolated var localImageURLString: String {
return URL(string: localImageURLString)! let urlString = remoteImageURL.absoluteString
let split = urlString.split(separator: ".")
let fileExtension = ".\(split.last ?? "png")"
return GifHoarder.container.path()+name+"."+id+fileExtension
} }
var isLocal: Bool { nonisolated var localImageURL: URL {
return (try? Data(contentsOf: localImageURL)) != nil return URL(filePath: localImageURLString)
}
var msSticker: MSSticker? {
guard isLocal else {
return nil
}
return try? MSSticker(contentsOfFileURL: localImageURL, localizedDescription: name)
}
var image: UIImage? {
if let data = try? Data(contentsOf: localImageURL),
let img = UIImage(data: data) {
return img
} else {
return nil
}
} }
nonisolated nonisolated
func downloadImage() async throws { func downloadImage() async throws {
if let data = try? await Data(contentsOf: localImageURL), if let data = try? Data(contentsOf: localImageURL),
let _ = UIImage(data: data) { let _ = UIImage(data: data) {
return return
} }
@@ -44,19 +33,23 @@ extension StickerProtocol {
if let uiImage = UIImage(data: data), if let uiImage = UIImage(data: data),
let cgImage = uiImage.cgImage, let cgImage = uiImage.cgImage,
await !self.localImageURLString.contains(".gif"), !self.localImageURLString.contains(".gif"),
cgImage.width < 300 || cgImage.height < 300 { cgImage.width < 300 || cgImage.height < 300 {
data = await resize(image: uiImage, to: CGSize(width: 300, height: 300)).pngData()! data = resize(image: uiImage, to: CGSize(width: 300, height: 300)).pngData()!
} }
try! await data.write(to: localImageURL) try! data.write(to: localImageURL)
return return
} }
nonisolated
func deleteImage() { func deleteImage() {
try? FileManager.default.removeItem(at: localImageURL) try? FileManager.default.removeItem(at: localImageURL)
return return
} }
}
@MainActor
extension StickerProtocol {
func resize(image: UIImage, to targetSize: CGSize) -> UIImage { func resize(image: UIImage, to targetSize: CGSize) -> UIImage {
let oldSize = image.size let oldSize = image.size
let ratio: (x: CGFloat, y: CGFloat) let ratio: (x: CGFloat, y: CGFloat)
@@ -87,4 +80,21 @@ extension StickerProtocol {
image.draw(in: rect) image.draw(in: rect)
return UIGraphicsGetImageFromCurrentImageContext() ?? UIImage() return UIGraphicsGetImageFromCurrentImageContext() ?? UIImage()
} }
/*nonisolated*/ var msSticker: MSSticker? {
guard FileManager.default.fileExists(atPath: localImageURLString) else {
return nil
}
return try? MSSticker(contentsOfFileURL: localImageURL, localizedDescription: name)
}
/*nonisolated*/ var image: UIImage? {
if FileManager.default.fileExists(atPath: localImageURLString),
let data = try? Data(contentsOf: localImageURL),
let img = UIImage(data: data) {
return img
} else {
return nil
}
}
} }
+13 -12
View File
@@ -8,21 +8,22 @@
import Foundation import Foundation
import Messages import Messages
nonisolated
protocol StickerProtocol: Codable, Identifiable, Hashable { protocol StickerProtocol: Codable, Identifiable, Hashable {
var id: String { get set } nonisolated var id: String { get set }
var name: String { get set } nonisolated var name: String { get set }
var localImageURL: URL { get } nonisolated var typeGlyph: String { get }
var localImageURLString: String { get }
var remoteImageURL: URL { get set }
var isLocal: Bool { get } nonisolated var localImageURL: URL { get }
nonisolated var localImageURLString: String { get }
nonisolated var remoteImageURL: URL { get set }
var msSticker: MSSticker? { get } nonisolated var msSticker: MSSticker? { get }
var image: UIImage? { get } nonisolated var image: UIImage? { get }
func downloadImage() async throws nonisolated func downloadImage() async throws
func deleteImage() nonisolated func deleteImage()
func resize(image: UIImage, to targetSize: CGSize) -> UIImage nonisolated func resize(image: UIImage, to targetSize: CGSize) -> UIImage
static var test: Self { get } nonisolated static var test: Self { get }
} }
+22 -14
View File
@@ -12,27 +12,35 @@ struct BrowseView: View {
@ObservedObject var emojiHoarder: EmojiHoarder @ObservedObject var emojiHoarder: EmojiHoarder
@ObservedObject var gifHoarder: GifHoarder @ObservedObject var gifHoarder: GifHoarder
var body: some View { var body: some View {
List { VStack {
Picker("", selection: $browseWhat) { Picker("", selection: $browseWhat) {
ForEach(StickerType.allCases, id: \.self) { type in ForEach(StickerType.allCases) { type in
Text(type.description) Text(type.description).tag(type)
} }
} }
.pickerStyle(.segmented) .pickerStyle(.segmented)
switch browseWhat { .padding(.horizontal)
case .slackEmoji: Group {
ForEach(emojiHoarder.emojis, id: \.self) { emoji in switch browseWhat {
StickerRow(hoarder: emojiHoarder, emoji: emoji) case .slackEmoji:
.listRowSeparator(.hidden) EmojiTableView(
} hoarder: emojiHoarder,
case .giphyGifs: items: emojiHoarder.emojis.map { $0.name }
ForEach(gifHoarder.trendingGifs) { gif in )
StickerRow(hoarder: emojiHoarder, emoji: gif) .ignoresSafeArea(.container, edges: .bottom)
.id(emojiHoarder.emojis)
case .giphyGifs:
ScrollView {
ForEach(gifHoarder.trendingGifs) { gif in
StickerRow(hoarder: gifHoarder, sticker: gif)
.listRowSeparator(.hidden)
}
}
} }
} }
} }
} }
} }
#Preview { #Preview {
+8
View File
@@ -20,6 +20,10 @@ struct ContentView: View {
BrowseView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder) BrowseView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder)
} }
Tab("Packs", systemImage: "square.stack.3d.up.fill") {
EmojiPackManager(hoarder: emojiHoarder)
}
Tab("Downloaded", systemImage: "arrow.down.circle.fill") { Tab("Downloaded", systemImage: "arrow.down.circle.fill") {
DownloadedView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder) DownloadedView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder)
} }
@@ -38,6 +42,10 @@ struct ContentView: View {
.tabItem { .tabItem {
Label("Browse", systemImage: "square.grid.2x2.fill") Label("Browse", systemImage: "square.grid.2x2.fill")
} }
EmojiPackManager(hoarder: emojiHoarder)
.tabItem {
Label("Packs", systemImage: "square.stack.3d.up.fill")
}
DownloadedView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder) DownloadedView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder)
.tabItem { .tabItem {
Label("Downloaded", systemImage: "arrow.down.circle.fill") Label("Downloaded", systemImage: "arrow.down.circle.fill")
+14 -2
View File
@@ -13,6 +13,7 @@ struct DownloadedView: View {
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
var isDark: Bool { colorScheme == .dark } var isDark: Bool { colorScheme == .dark }
@State var browseWhat: StickerType = .slackEmoji
var minColWidth: CGFloat { 75 } var minColWidth: CGFloat { 75 }
var spacing: CGFloat { 5 } var spacing: CGFloat { 5 }
@@ -25,17 +26,28 @@ struct DownloadedView: View {
} }
var body: some View { var body: some View {
Picker("", selection: $browseWhat) {
ForEach(StickerType.allCases) { type in
Text(type.description)
.tag(type)
}
}
.pickerStyle(.segmented)
if emojiHoarder.downloadedStickers.isEmpty && gifHoarder.downloadedStickers.isEmpty {
NoStickersView()
.padding()
}
GeometryReader { geo in GeometryReader { geo in
ScrollView { ScrollView {
let columns: Int = max(1, Int((geo.size.width - 2*spacing) / (minColWidth + spacing))) let columns: Int = max(1, Int((geo.size.width - 2*spacing) / (minColWidth + spacing)))
let layout = Array(repeating: col, count: columns) let layout = Array(repeating: col, count: columns)
LazyVGrid(columns: layout, spacing: spacing) { LazyVGrid(columns: layout, spacing: spacing) {
ForEach(emojiHoarder.downloadedEmojisArr, id: \.self) { name in ForEach(emojiHoarder.downloadedStickersArr, id: \.self) { name in
if let emoji = emojiHoarder.trie.dict[name] { if let emoji = emojiHoarder.trie.dict[name] {
ZStack { ZStack {
Rectangle() Rectangle()
.foregroundStyle(isDark ? .black : .white) .foregroundStyle(isDark ? .black : .white)
StickerPreview(emoji: emoji) StickerPreview(sticker: emoji)
RoundedRectangle(cornerRadius: 15) RoundedRectangle(cornerRadius: 15)
.stroke(.gray, lineWidth: 1) .stroke(.gray, lineWidth: 1)
} }
@@ -0,0 +1,153 @@
//
// EmojiPackView.swift
// StickerSlack
//
// Created by neon443 on 01/12/2025.
//
import SwiftUI
struct EmojiPackDetailView: View {
@ObservedObject var hoarder: EmojiHoarder
@Binding var pack: EmojiPack
@State var edit: Bool = false
@State var editName: Bool = false
@State var editDescription: Bool = false
@State var showAdder: Bool = false
var minColWidth: CGFloat { 75 }
var spacing: CGFloat { 10 }
var col: GridItem {
GridItem(
.flexible(minimum: minColWidth, maximum: 100),
spacing: spacing,
alignment: .center
)
}
@Environment(\.dismiss) var dismiss
var body: some View {
NavigationStack {
GeometryReader { geo in
VStack {
Button() {
editName.toggle()
} label: {
Text(pack.name)
.bold()
.foregroundStyle(edit ? .blue : .primary)
.font(.title)
}
.disabled(!edit)
.alert("Edit Name", isPresented: $editName) {
TextField("", text: $pack.name)
}
Button() {
editDescription.toggle()
} label: {
Text(pack.description)
.foregroundStyle(edit ? .blue : .primary)
}
.disabled(!edit)
.alert("Edit Description", isPresented: $editDescription) {
TextField("", text: $pack.description)
}
let columns: Int = max(1, Int((geo.size.width - 2*spacing) / (minColWidth + spacing)))
let layout = Array(repeating: col, count: columns)
LazyVGrid(columns: layout, spacing: spacing) {
ForEach(pack.emojiNames, id: \.self) { name in
let emoji = hoarder.trie.dict[name] ?? .test
VStack {
StickerPreview(sticker: emoji)
Text(emoji.name)
.multilineTextAlignment(.center)
.font(.caption)
Spacer()
}
.overlay(alignment: .topLeading) {
if edit {
Button(role: .destructive) {
withAnimation {
pack.emojiNames.removeAll { $0 == name }
}
} label: {
Image(systemName: "minus.circle.fill")
.resizable().scaledToFit()
}
.frame(maxWidth: 25)
.padding(-10)
}
}
}
if edit {
Button() {
showAdder.toggle()
} label: {
VStack {
Image(systemName: "plus.square.dashed")
.resizable().scaledToFit()
.foregroundStyle(.green.opacity(0.5))
Text("Add")
.multilineTextAlignment(.center)
.font(.caption)
.foregroundStyle(.green.opacity(0.5))
Spacer()
}
}
.sheet(isPresented: $showAdder) {
SearchView(hoarder: hoarder, fromPackEditor: true) { selection in
print(selection)
withAnimation {
pack.emojiNames.append(selection)
}
}
}
}
}
.padding(.vertical)
Text("\(pack.emojiNames.count) Emoji\(pack.emojiNames.count.plural)")
.bold()
.multilineTextAlignment(.center)
}
.padding()
.navigationTitle(edit ? "Editing" : "Pack Details")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem() {
Button(
"",
systemImage: edit ? "checkmark" : "pencil"
) {
withAnimation { edit.toggle() }
}
.modifier(glassButtonIfAv(edit))
.tint(edit ? .blue : .primary)
}
if #available(iOS 19, *) {
ToolbarSpacer()
}
ToolbarItem() {
ShareLink(item: URL(string: "stickerslack://")!) {
Image(systemName: "square.and.arrow.up")
}
}
}
.onDisappear {
print("disappear")
}
}
}
}
}
@available(iOS 17, *)
#Preview {
@Previewable @State var pack: EmojiPack = .test
EmojiPackDetailView(
hoarder: EmojiHoarder(localOnly: true, skipIndex: false),
pack: $pack
)
}
@@ -1,30 +0,0 @@
//
// EmojiPackView.swift
// StickerSlack
//
// Created by neon443 on 01/12/2025.
//
import SwiftUI
struct EmojiPackView: View {
@ObservedObject var hoarder: EmojiHoarder
@State var pack: EmojiPack
var body: some View {
Text(pack.name)
.bold()
Text(pack.description)
.foregroundStyle(.gray)
ForEach(pack.emojiNames, id: \.self) { name in
StickerPreview(emoji: hoarder.trie.dict[name] ?? .test)
}
}
}
#Preview {
EmojiPackView(
hoarder: EmojiHoarder(localOnly: true, skipIndex: true),
pack: .test
)
}
@@ -1,39 +0,0 @@
//
// EmojiPreview.swift
// StickerSlack
//
// Created by neon443 on 19/10/2025.
//
import SwiftUI
import Haptics
struct StickerPreview: View {
@State var emoji: any StickerProtocol
@State var gifImage: Image?
var body: some View {
if let image = emoji.image {
GifView(url: emoji.localImageURL)
} else {
GifView(url: emoji.remoteImageURL)
}
}
}
struct ImageErrorView: View {
var body: some View {
Image(systemName: "xmark.app.fill")
.resizable().scaledToFit()
.padding()
.symbolRenderingMode(.hierarchical)
.foregroundStyle(.red)
}
}
#Preview {
StickerPreview(
emoji: Emoji.test
)
}
+28
View File
@@ -0,0 +1,28 @@
//
// NoStickersView.swift
// StickerSlack
//
// Created by neon443 on 05/04/2026.
//
import SwiftUI
struct NoStickersView: View {
var body: some View {
VStack(alignment: .center) {
Image(systemName: "questionmark.app.dashed")
.resizable().scaledToFit()
.frame(width: 75, height: 75)
Text("No Downloaded Stickers")
.font(.title)
.bold()
Text("Download some Slack Emojis or GIFs to use in iMessage!")
.foregroundStyle(.gray)
.multilineTextAlignment(.center)
}
}
}
#Preview {
NoStickersView()
}
+64 -11
View File
@@ -12,33 +12,81 @@ struct SearchView: View {
@State private var currentSearch: Task<Void, Never>? @State private var currentSearch: Task<Void, Never>?
@State var searchTerm: String = "" @State var searchTerm: String = ""
@State var previousSearches: [String] = []
@State var searchResult: [String] = [] @State var searchResult: [String] = []
@State var stickerType: StickerType = .slackEmoji
@State var fromPackEditor: Bool = false
@State var callback: ((String) -> Void) = { _ in }
var minColWidth: CGFloat { 75 }
var spacing: CGFloat { 10 }
var col: GridItem {
GridItem(
.flexible(minimum: minColWidth, maximum: 100),
spacing: spacing,
alignment: .center
)
}
@Environment(\.dismiss) var dismiss
var body: some View { var body: some View {
NavigationStack { NavigationStack {
List() { if fromPackEditor {
Text("\(searchResult.count) Result\(searchResult.count.plural)") GeometryReader { geo in
ForEach(searchResult, id: \.self) { name in let columns: Int = max(1, Int((geo.size.width - 2*spacing) / (minColWidth + spacing)))
StickerRow(hoarder: hoarder, emoji: hoarder.trie.dict[name]!) let layout = Array(repeating: col, count: columns)
ScrollView {
LazyVGrid(columns: layout, spacing: spacing) {
ForEach(searchResult, id: \.self) { name in
let emoji = hoarder.trie.dict[name] ?? .test
StickerPreview(sticker: emoji)
.onTapGesture {
callback(emoji.name)
dismiss()
}
}
}
.padding()
}
}
} else {
Picker("", selection: $stickerType) {
ForEach(StickerType.allCases) { type in
Text(type.description).tag(type)
}
}
.pickerStyle(.segmented)
switch stickerType {
case .slackEmoji:
EmojiTableView(hoarder: hoarder, items: searchResult)
.id(searchResult)
.ignoresSafeArea(edges: .bottom)
case .giphyGifs:
Text("uhh")
} }
} }
} }
.searchable(text: $searchTerm) .searchable(text: $searchTerm)
.onChange(of: searchTerm) { _ in .onChange(of: searchTerm) { new in
if searchTerm.isEmpty { searchResult = [] } if currentSearch != nil { currentSearch?.cancel() }
}
.onSubmit(of: .search) {
guard !searchTerm.isEmpty else { guard !searchTerm.isEmpty else {
currentSearch?.cancel() currentSearch?.cancel()
searchResult = [] searchResult = []
previousSearches = []
return return
} }
if currentSearch != nil { currentSearch?.cancel() }
currentSearch = Task.detached { currentSearch = Task.detached {
let result = await hoarder.trie.search(for: searchTerm) let result = await hoarder.trie.search(
for: searchTerm,
previousQuery: previousSearches.last,
previousResult: Set(searchResult)
)
await MainActor.run { await MainActor.run {
withAnimation(.snappy) { withAnimation(.snappy) {
searchResult = result searchResult = result
previousSearches.append(searchTerm)
} }
} }
} }
@@ -47,5 +95,10 @@ struct SearchView: View {
} }
#Preview { #Preview {
SearchView(hoarder: EmojiHoarder(localOnly: true)) SearchView(
hoarder: EmojiHoarder(localOnly: true),
fromPackEditor: true
) {
print($0)
}
} }
+44 -35
View File
@@ -6,6 +6,7 @@
// //
import SwiftUI import SwiftUI
import Haptics
struct SettingsView: View { struct SettingsView: View {
@ObservedObject var hoarder: EmojiHoarder @ObservedObject var hoarder: EmojiHoarder
@@ -50,41 +51,47 @@ struct SettingsView: View {
if hoarder.downloadedStickers.count == hoarder.emojis.count { if hoarder.downloadedStickers.count == hoarder.emojis.count {
Text("🎉") Text("🎉")
.font(.largeTitle) .font(.largeTitle)
.onTapGesture {
Haptic.rigid.trigger()
}
} }
NavigationLink { // NavigationLink {
List { // List {
Picker(selection: $hoarder.letterStatsSorting.by) { // Picker(selection: $hoarder.letterStatsSorting.by) {
ForEach(EmojiHoarder.SortLetterStatsBy.allCases, id: \.self) { sortType in // ForEach(EmojiHoarder.SortLetterStatsBy.allCases, id: \.self) { sortType in
Text(sortType.rawValue).tag(sortType) // Text(sortType.rawValue).tag(sortType)
} // }
} label: { // } label: {
Label("Sort by", systemImage: "arrow.up.arrow.down") // Label("Sort by", systemImage: "arrow.up.arrow.down")
} // }
.onChange(of: hoarder.letterStatsSorting.by) { _ in // .onChange(of: hoarder.letterStatsSorting.by) { _ in
hoarder.sortLetterStats(by: hoarder.letterStatsSorting) // hoarder.sortLetterStats(by: hoarder.letterStatsSorting)
} // }
//
Picker(selection: $hoarder.letterStatsSorting.ascending) { // Picker(selection: $hoarder.letterStatsSorting.ascending) {
Text("Ascending").tag(true) // Text("Ascending").tag(true)
Text("Descending").tag(false) // Text("Descending").tag(false)
} label: { // } label: {
Label("Order", systemImage: "greaterthan") // Label("Order", systemImage: "greaterthan")
} // }
.onChange(of: hoarder.letterStatsSorting.ascending) { _ in // .onChange(of: hoarder.letterStatsSorting.ascending) { _ in
hoarder.sortLetterStats(by: hoarder.letterStatsSorting) // hoarder.sortLetterStats(by: hoarder.letterStatsSorting)
} // }
//
ForEach(hoarder.letterStats, id: \.self) { stat in // ForEach(hoarder.letterStats, id: \.self) { stat in
HStack { // HStack {
Text("\(stat.char)") // Text("\(stat.char)")
Spacer() // Spacer()
Text("\(stat.count)") // Text("\(stat.count)")
} // }
} // }
} // }
} label: { // .onAppear {
Label("Letter Stats", systemImage: "textformat") // hoarder.generateLetterStats()
} // }
// } label: {
// Label("Letter Stats", systemImage: "textformat")
// }
} }
Button("Show Welcome", systemImage: "arrow.trianglehead.clockwise") { Button("Show Welcome", systemImage: "arrow.trianglehead.clockwise") {
@@ -119,7 +126,9 @@ struct SettingsView: View {
Button("Reindex", systemImage: "list.bullet.clipboard", role: .destructive) { Button("Reindex", systemImage: "list.bullet.clipboard", role: .destructive) {
hoarder.resetAllIndexes() hoarder.resetAllIndexes()
hoarder.buildTrie() Task {
await hoarder.buildTrie()
}
} }
.foregroundStyle(.red) .foregroundStyle(.red)
} }
+74
View File
@@ -0,0 +1,74 @@
//
// EmojiPreview.swift
// StickerSlack
//
// Created by neon443 on 19/10/2025.
//
import SwiftUI
import Haptics
struct StickerPreview: View {
@State var sticker: any StickerProtocol
@State var gifImage: Image?
var type: StickerType {
let type = Swift.type(of: sticker)
if type == Emoji.self {
return .slackEmoji
} else if type == Gif.self {
return .giphyGifs
} else {
fatalError()
}
}
var body: some View {
if sticker.image != nil {
//local
GifView(url: sticker.localImageURL)
} else {
//remote
if type == .slackEmoji {
GifView(url: sticker.remoteImageURL)
} else {
let gif = sticker as! Gif
if let giphyImages = gif.giphyImages,
let preview_gif = giphyImages.preview_gif,
let url = URL(string: preview_gif.url) {
GifView(url: url)
} else {
GifView(url: gif.remoteImageURL)
.overlay {
Image(systemName:
"square.arrowtriangle.4.outward")
.resizable().scaledToFit()
.foregroundStyle(.red)
.background(.black)
.padding()
}
}
}
}
}
}
struct ImageErrorView: View {
var body: some View {
Image(systemName: "xmark.app.fill")
.resizable().scaledToFit()
.padding()
.symbolRenderingMode(.hierarchical)
.foregroundStyle(.red)
}
}
#Preview {
VStack {
StickerPreview(
sticker: Emoji.test
)
StickerPreview(
sticker: Gif.test
)
}
}
@@ -10,40 +10,40 @@ import Haptics
struct StickerRow<T: Hoarder>: View { struct StickerRow<T: Hoarder>: View {
@ObservedObject var hoarder: T @ObservedObject var hoarder: T
@State var emoji: any StickerProtocol @State var sticker: any StickerProtocol
@State var showTooltip: Bool = false @State var showTooltip: Bool = false
var isLocal: Bool { var isDownloaded: Bool {
return hoarder.downloadedStickers.contains(emoji.name) return hoarder.downloadedStickers.contains(sticker.name)
} }
var body: some View { var body: some View {
HStack { HStack {
StickerPreview(emoji: emoji) StickerPreview(sticker: sticker)
.frame(width: 100, height: 100) .frame(width: 100, height: 100)
.transition(.scale) .transition(.scale)
VStack(alignment: .leading, spacing: 5) { VStack(alignment: .leading, spacing: 5) {
Text(emoji.name) Text(sticker.name)
.font(.caption) .font(.caption)
.bold(isLocal) .bold(isDownloaded)
.foregroundColor(isLocal ? .green : .primary) .foregroundColor(isDownloaded ? .green : .primary)
.lineLimit(nil) .lineLimit(nil)
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
HStack(spacing: 5) { VStack(alignment: .leading, spacing: 5) {
Button { Button {
showTooltip.toggle() showTooltip.toggle()
} label: { } label: {
Image("slack.logo") Image(sticker.typeGlyph)
.resizable().scaledToFit() .resizable().scaledToFit()
.frame(width: 20, height: 20) .frame(maxHeight: 20)
.foregroundStyle(.gray) .foregroundStyle(.gray)
} }
.buttonStyle(.borderless) .buttonStyle(.borderless)
.alert("From Slack", isPresented: $showTooltip) { .alert("From Slack", isPresented: $showTooltip) {
Button("Done") {} Button("Done") {}
} }
if isLocal { if isDownloaded {
Image(systemName: "arrow.down.circle.fill") Image(systemName: "arrow.down.circle.fill")
.resizable().scaledToFit() .resizable().scaledToFit()
.frame(width: 20, height: 20) .frame(width: 20, height: 20)
@@ -56,22 +56,21 @@ struct StickerRow<T: Hoarder>: View {
.padding(5) .padding(5)
.background( .background(
RoundedRectangle(cornerRadius: 15) RoundedRectangle(cornerRadius: 15)
.foregroundStyle(.gray.opacity(0.1)) .foregroundStyle(.gray.opacity(0.2))
.shadow(radius: 2)
) )
Spacer() Spacer()
if isLocal { if isDownloaded {
Button("", systemImage: "trash") { Button("", systemImage: "trash") {
hoarder.delete(emoji: emoji, skipStoreIndex: false) hoarder.delete(emoji: sticker, skipStoreIndex: false)
} }
.buttonStyle(.plain) .buttonStyle(.plain)
.transition(.scale) .transition(.scale)
} else { } else {
Button("", systemImage: "arrow.down.circle") { Button("", systemImage: "arrow.down.circle") {
Task.detached { Task.detached {
await hoarder.download(emoji: emoji, skipStoreIndex: false) await hoarder.download(emoji: sticker, skipStoreIndex: false)
} }
} }
.buttonStyle(.plain) .buttonStyle(.plain)
@@ -87,21 +86,17 @@ struct StickerRow<T: Hoarder>: View {
#Preview { #Preview {
@Previewable var hoarder = EmojiHoarder(localOnly: true) @Previewable var hoarder = EmojiHoarder(localOnly: true)
List { List {
StickerRow(hoarder: hoarder, emoji: Emoji.test) StickerRow(hoarder: hoarder, sticker: Emoji.test)
StickerRow(hoarder: hoarder, emoji: Emoji.testLongName) StickerRow(hoarder: hoarder, sticker: Emoji.testLongName)
StickerRow(hoarder: hoarder, emoji: Gif.test) StickerRow(hoarder: hoarder, sticker: Gif.test)
StickerRow(hoarder: hoarder, emoji: Emoji(name: "a", url: Emoji.test.remoteImageURL)) StickerRow(hoarder: hoarder, sticker: Emoji(name: "a", url: Emoji.test.remoteImageURL))
StickerRow(hoarder: hoarder, emoji: Emoji(name: "ab", url: Emoji.test.remoteImageURL)) StickerRow(hoarder: hoarder, sticker: Emoji(name: "ab", url: Emoji.test.remoteImageURL))
StickerRow(hoarder: hoarder, emoji: Emoji(name: "abc", url: Emoji.test.remoteImageURL)) StickerRow(hoarder: hoarder, sticker: Emoji(name: "abc", url: Emoji.test.remoteImageURL))
StickerRow(hoarder: hoarder, emoji: Emoji(name: "abcd", url: Emoji.test.remoteImageURL)) StickerRow(hoarder: hoarder, sticker: Emoji(name: "abcd", url: Emoji.test.remoteImageURL))
StickerRow(hoarder: hoarder, emoji: Emoji(name: "abcde", url: Emoji.test.remoteImageURL)) StickerRow(hoarder: hoarder, sticker: Emoji(name: "abcde", url: Emoji.test.remoteImageURL))
StickerRow(hoarder: hoarder, emoji: Emoji(name: "abcdef", url: Emoji.test.remoteImageURL)) StickerRow(hoarder: hoarder, sticker: Emoji(name: "abcdef", url: Emoji.test.remoteImageURL))
StickerRow(hoarder: hoarder, emoji: Emoji(name: "abcdefg", url: Emoji.test.remoteImageURL)) StickerRow(hoarder: hoarder, sticker: Emoji(name: "abcdefg", url: Emoji.test.remoteImageURL))
StickerRow(hoarder: hoarder, emoji: Emoji(name: "abcdefgh", url: Emoji.test.remoteImageURL)) StickerRow(hoarder: hoarder, sticker: Emoji(name: "abcdefgh", url: Emoji.test.remoteImageURL))
ForEach(hoarder.downloadedEmojisArr, id: \.self) { name in
if let emoji = hoarder.trie.dict[name] {
StickerRow(hoarder: hoarder, emoji: emoji)
}
}
} }
.listStyle(.plain)
} }
+20
View File
@@ -27,3 +27,23 @@ struct tabViewActivationSearchActivation: ViewModifier {
} }
} }
} }
struct glassButtonIfAv: ViewModifier {
var enabled: Bool
init(_ enabled: Bool = true) {
self.enabled = enabled
}
func body(content: Content) -> some View {
if enabled {
if #available(iOS 19, *) {
content.buttonStyle(.glassProminent)
} else {
content.buttonStyle(.borderedProminent)
}
} else {
content
}
}
}
+44 -25
View File
@@ -9,14 +9,26 @@ import SwiftUI
struct WelcomeView: View { struct WelcomeView: View {
@Environment(\.dismiss) var dismiss @Environment(\.dismiss) var dismiss
@Environment(\.colorScheme) var colourScheme
var isDark: Bool {
return colourScheme == .dark
}
var body: some View { var body: some View {
VStack { VStack(spacing: 0) {
Text("StickerSlack") HStack {
.bold() Image("icon\(isDark ? "-dark" : "")")
.font(.largeTitle) .resizable().scaledToFit()
.monospaced() .frame(maxWidth: 75)
.padding() Spacer()
Text("StickerSlack")
.bold()
.font(.largeTitle)
.monospaced()
Spacer()
}
.padding(.vertical, 20)
.padding(.leading, 20)
List { List {
Section("How to use") { Section("How to use") {
ListRow(number: 1, text: "Browse or search for an emoji") ListRow(number: 1, text: "Browse or search for an emoji")
@@ -29,31 +41,38 @@ struct WelcomeView: View {
} }
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
Spacer() Spacer()
if #available(iOS 19, *) { Group {
Button() { if #available(iOS 19, *) {
dismiss() Button() {
} label: { dismiss()
Text("Continue") } label: {
.font(.title) ContinueButtonView()
.bold() }
.buttonStyle(.glassProminent)
} else {
Button() {
dismiss()
} label: {
ContinueButtonView()
}
.buttonStyle(.borderedProminent)
} }
.buttonStyle(.glassProminent)
.padding(.bottom)
} else {
Button() {
dismiss()
} label: {
Text("Continue")
.font(.title)
.bold()
}
.buttonStyle(.borderedProminent)
.padding(.bottom)
} }
.padding(.bottom)
.tint(.purple)
.interactiveDismissDisabled()
} }
} }
} }
fileprivate struct ContinueButtonView: View {
var body: some View {
Text("Continue")
.font(.title)
.bold()
}
}
#Preview { #Preview {
Color.gray.opacity(0.5) Color.gray.opacity(0.5)
.ignoresSafeArea(.all) .ignoresSafeArea(.all)
+13 -5
View File
@@ -9,20 +9,23 @@ import Foundation
import SwiftUI import SwiftUI
import Combine import Combine
nonisolated
class TrieNode: Codable { class TrieNode: Codable {
var children: [String: TrieNode] = [:] var children: [String: TrieNode] = [:]
var isEndOfWord: Bool = false var isEndOfWord: Bool = false
} }
//nonisolated
class Trie: ObservableObject { class Trie: ObservableObject {
var root: TrieNode = TrieNode() var root: TrieNode = TrieNode()
var dict: [String:Emoji] = [:] var dict: [String:Emoji] = [:]
var wordlist: [String] = [] var wordlist: Set<String> = []
// var previousSearchTerm
func insert(word: String) { func insert(word: String) {
let word = word.lowercased() let word = word.lowercased()
wordlist.append(word) wordlist.insert(word)
var currentNode = root var currentNode = root
let indices = word.indices let indices = word.indices
let last = indices.last let last = indices.last
@@ -41,12 +44,17 @@ class Trie: ObservableObject {
} }
} }
func search(for query: String) -> [String] { func search(for query: String, previousQuery: String?, previousResult: Set<String>?) -> [String] {
var result: Set<String> = Set(wordlist) var result: Set<String> = wordlist
if let previousQuery,
let previousResult,
query.hasPrefix(previousQuery) {
result = previousResult
}
for word in query.split(separator: " ") { for word in query.split(separator: " ") {
result = result.filter { $0.localizedCaseInsensitiveContains(word) } result = result.filter { $0.localizedCaseInsensitiveContains(word) }
} }
return Array(result) return Array(result).sorted()
} }
func search(exactly query: String) -> Bool { func search(exactly query: String) -> Bool {
+6 -4
View File
@@ -37,7 +37,7 @@ struct TrieTestingView: View {
case .contains: case .contains:
if searchTask != nil { searchTask?.cancel() } if searchTask != nil { searchTask?.cancel() }
searchTask = Task.detached { searchTask = Task.detached {
let result = await hoarder.trie.search(for: searchTerm) let result = await hoarder.trie.search(for: searchTerm, previousQuery: nil, previousResult: nil)
await MainActor.run { await MainActor.run {
withAnimation(.snappy) { searchResults = result } withAnimation(.snappy) { searchResults = result }
print("testing: contains search complete") print("testing: contains search complete")
@@ -62,7 +62,9 @@ struct TrieTestingView: View {
} }
Spacer() Spacer()
Button("add emojis!") { Button("add emojis!") {
hoarder.buildTrie() Task {
await hoarder.buildTrie()
}
} }
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
} }
@@ -114,11 +116,11 @@ struct TrieTestingView: View {
} }
if uikit { if uikit {
EmojiCollectionView(hoarder: hoarder, items: searchResults) EmojiTableView(hoarder: hoarder, items: searchResults)
.animation(.snappy, value: searchResults) .animation(.snappy, value: searchResults)
} else { } else {
List(searchResults, id: \.self) { item in List(searchResults, id: \.self) { item in
StickerRow(hoarder: hoarder, emoji: hoarder.trie.dict[item]!) StickerRow(hoarder: hoarder, sticker: hoarder.trie.dict[item]!)
} }
.animation(.snappy, value: searchResults) .animation(.snappy, value: searchResults)
} }
@@ -1,71 +0,0 @@
//
// EmojiCollectionView.swift
// StickerSlack
//
// Created by neon443 on 03/11/2025.
//
import Foundation
import UIKit
import SwiftUI
import Haptics
struct EmojiCollectionView: UIViewRepresentable {
let hoarder: EmojiHoarder
let items: [String]
func makeUIView(context: Context) -> UITableView {
let tableView = UITableView()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.dataSource = context.coordinator
return tableView
}
func updateUIView(_ uiView: UITableView, context: Context) {
context.coordinator.hoarder = hoarder
context.coordinator.items = items
uiView.reloadData()
}
func makeCoordinator() -> Coordinator {
Coordinator(hoarder: hoarder, items: items)
}
final class Coordinator: NSObject, UITableViewDataSource {
var hoarder: EmojiHoarder
var items: [String]
init(hoarder: EmojiHoarder, items: [String]) {
self.hoarder = hoarder
self.items = items
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let emojiName = items[indexPath.row]
let emoji = hoarder.trie.dict[emojiName]!
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.contentConfiguration = UIHostingConfiguration {
StickerRow(hoarder: hoarder, emoji: emoji)
.id(emoji)
}
return cell
}
}
}
//
//class EmojiCell: UITableViewCell {
// override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
// let l = UILabel()
// l.text = "ifosa"
// self.view = l
// }
//
// required init?(coder: NSCoder) {
// fatalError("init(coder:) has not been implemented")
// }
//}
+103
View File
@@ -0,0 +1,103 @@
//
// EmojiTableView.swift
// StickerSlack
//
// Created by neon443 on 03/11/2025.
//
import Foundation
import UIKit
import SwiftUI
import Haptics
struct EmojiTableView: UIViewRepresentable {
let hoarder: EmojiHoarder
let items: [String]
func makeUIView(context: Context) -> UITableView {
let tableView = context.coordinator as UITableViewController
tableView.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.tableView.dataSource = context.coordinator
tableView.tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 50, right: 0)
tableView.tableView.separatorStyle = .none
return tableView.tableView
}
func updateUIView(_ uiView: UITableView, context: Context) {
context.coordinator.hoarder = hoarder
context.coordinator.items = items
uiView.reloadData()
}
func makeCoordinator() -> Coordinator {
Coordinator(hoarder: hoarder, items: items)
}
final class Coordinator: UITableViewController {
var hoarder: EmojiHoarder
var items: [String]
init(hoarder: EmojiHoarder, items: [String]) {
self.hoarder = hoarder
self.items = items
super.init(style: .insetGrouped)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard !hoarder.trie.dict.isEmpty else {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
let spinner = UIActivityIndicatorView()
spinner.startAnimating()
spinner.style = .large
spinner.frame = cell.frame
spinner.autoresizingMask = .flexibleWidth
cell.addSubview(spinner)
tableView.reloadData()
return cell
}
let emojiName = items[indexPath.row]
let emoji = hoarder.trie.dict[emojiName]!
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.selectedBackgroundView = nil
cell.selectionStyle = .none
cell.contentConfiguration = UIHostingConfiguration {
StickerRow(hoarder: hoarder, sticker: emoji)
.id(emoji)
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// <#code#>
}
override func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
// <#code#>
}
override func tableView(_ tableView: UITableView, shouldBeginMultipleSelectionInteractionAt indexPath: IndexPath) -> Bool {
return true
}
}
}
//
//class EmojiCell: UITableViewCell {
// override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
// let l = UILabel()
// l.text = "ifosa"
// self.view = l
// }
//
// required init?(coder: NSCoder) {
// fatalError("init(coder:) has not been implemented")
// }
//}
+2 -1
View File
@@ -24,7 +24,8 @@
{ {
"name" : "PerformanceTests", "name" : "PerformanceTests",
"testFunctions" : [ "testFunctions" : [
"downloadAll()" "downloadAll()",
"fakeDownloadAllStickers()"
] ]
} }
] ]
+57 -48
View File
@@ -14,27 +14,21 @@ struct StickerSlackTests {
@Test func MSStickerValidation() async throws { @Test func MSStickerValidation() async throws {
let goodEmoji = Emoji( let goodEmoji = Emoji(
name: "name", name: "name",
url: URL(string: "https://neon443.github.io/images/fav.ico")!, url: URL(string: "https://neon443.xyz/images/fav.ico")!,
id: UUID(uuidString: "0c48f4c3-1c63-41ed-96db-909e50e35dfc")! id: "0c48f4c3-1c63-41ed-96db-909e50e35dfc"
) )
try! await goodEmoji.downloadImage() try! await goodEmoji.downloadImage()
#expect(goodEmoji.sticker!.validate(), "should be true") #expect(goodEmoji.msSticker!.validate(), "should be true")
let badEmoji = Emoji( let badEmoji = Emoji(
name: "160chars:shttps://emoji.slack-edge.com/T0266FRGM/100906/ddeb22d813b83b0f.pngs,sexpirationfds2025-10-28T08:00:02.011Zs},{gtypeh:jemojieeeidggg9cab2003-ad74-492a-", name: "160chars:shttps://emoji.slack-edge.com/T0266FRGM/100906/ddeb22d813b83b0f.pngs,sexpirationfds2025-10-28T08:00:02.011Zs},{gtypeh:jemojieeeidggg9cab2003-ad74-492a-",
url: URL(string: "https://files.catbox.moe/ifh710.png")!, url: URL(string: "https://files.catbox.moe/ifh710.png")!,
id: UUID(uuidString: "0c48f4c3-1c63-41ed-96db-909e50e35dfc")! id: "0c48f4c3-1c63-41ed-96db-909e50e35dfc"
) )
try! await badEmoji.downloadImage() try! await badEmoji.downloadImage()
#expect(goodEmoji.sticker!.validate(), "should be true") #expect(goodEmoji.msSticker!.validate(), "should be true")
badEmoji.deleteImage() badEmoji.deleteImage()
} }
@Test func deleteAllEmojis() async throws {
let performanceTests = PerformanceTests(hoarder: .shared)
try! await performanceTests.fakeDownloadAllStickers()
await hoarder.deleteAllStickers()
}
} }
struct PerformanceTests { struct PerformanceTests {
@@ -43,7 +37,7 @@ struct PerformanceTests {
@Test func stickerConversion() async throws { @Test func stickerConversion() async throws {
// Write your test here and use APIs like `#expect(...)` to check expected conditions. // Write your test here and use APIs like `#expect(...)` to check expected conditions.
for emoji in hoarder.emojis { for emoji in hoarder.emojis {
let _ = emoji.sticker let _ = emoji.msSticker
} }
} }
@@ -53,16 +47,7 @@ struct PerformanceTests {
} }
} }
@Test func filteringEmojis() async throws { /*
let searchQueries = ["heavysob", "yay", "afsdjk", "afhjskf", "g4", "aqua-osx", "neotunes", "", "", ""]
for query in searchQueries {
print(query)
hoarder.filteredEmojis = []
hoarder.filterEmojis(by: query)
print(hoarder.filteredEmojis.count)
}
}
@Test func downloadAll() async throws { @Test func downloadAll() async throws {
let downloadedEmojisBefore = hoarder.emojis.filter { $0.isLocal }.map { $0.id } let downloadedEmojisBefore = hoarder.emojis.filter { $0.isLocal }.map { $0.id }
@@ -99,13 +84,14 @@ struct PerformanceTests {
} }
} }
} }
*/
func doThing(on emoji: Emoji, i: inout Int) async throws { func doThing(on emoji: Emoji, i: inout Int) async throws {
do { do {
guard !emoji.isLocal else { return } guard !emoji.isLocal else { return }
async let (data, _) = try URLSession.shared.data(from: emoji.remoteImageURL) async let (data, _) = try URLSession.shared.data(from: emoji.remoteImageURL)
try! await data.write(to: emoji.localImageURL) try! await data.write(to: emoji.localImageURL)
let _ = emoji.sticker?.validate() let _ = emoji.msSticker?.validate()
i+=1 i+=1
print("\(i)/\(hoarder.emojis.count) \(emoji.name)") print("\(i)/\(hoarder.emojis.count) \(emoji.name)")
} catch { } catch {
@@ -113,43 +99,66 @@ struct PerformanceTests {
} }
} }
@Test func fakeDownloadAllStickers() async throws { // @Test func fakeDownloadAllStickers() async throws {
await withDiscardingTaskGroup { group in // await withDiscardingTaskGroup { group in
for emoji in hoarder.emojis { // for emoji in hoarder.emojis {
group.addTask { // group.addTask {
try! Data().write(to: emoji.localImageURL) // try! Data().write(to: emoji.localImageURL)
} // }
} // }
} // }
} // }
@Test func deleteAllImages() async throws { @Test func deleteAllImages() async throws {
try! await fakeDownloadAllStickers() // try! await fakeDownloadAllStickers()
await hoarder.deleteAllStickers() await hoarder.deleteAllStickers()
} }
@Test func buildTrie() async throws { @Test func buildTrie() async throws {
hoarder.resetTrie() hoarder.resetAllIndexes()
hoarder.buildTrie() hoarder.buildTrie()
} }
@Test func testSearching() async throws {
try! await buildTrie()
let terms = ["h", "j", "s", "2", "heavysob", "hs", "asjasdklf", "a", "w", "t", "h", "z", "b", "c", "m", "n"]
for term in terms {
let _ = hoarder.trie.search(prefix: term)
}
}
@Test func testIsLocal() async throws {
for emoji in hoarder.emojis {
let x = emoji.isLocal
}
}
@Test func testDownloadedEmojis() async throws { @Test func testDownloadedEmojis() async throws {
for emoji in hoarder.emojis { for emoji in hoarder.emojis {
let x = hoarder.downloadedStickers.contains(emoji.name) let x = hoarder.downloadedStickers.contains(emoji.name)
} }
} }
@Test func testSearching() async throws {
try await testSearchingExactly()
try await testSearchingFor()
try await testSearchingPrefixes()
}
@Test func testSearchingFor() async throws {
let queries = hoarder.emojis.choose(10_000).map { $0.name }
for query in queries {
let _ = hoarder.trie.search(for: query, previousQuery: nil, previousResult: nil)
}
}
@Test func testSearchingExactly() async throws {
let queries = hoarder.emojis.choose(10_000).map { $0.name }
for query in queries {
let _ = hoarder.trie.search(exactly: query)
}
}
@Test func testSearchingPrefixes() async throws {
let queries = hoarder.emojis.choose(10_000).map { $0.name }
for query in queries {
let _ = hoarder.trie.search(prefix: query)
}
}
}
extension Array {
func choose(_ x: Int) -> Self {
var x = x
var result: Self = []
while x != 0 {
guard let randElement = self.randomElement() else { continue }
result.append(randElement)
x-=1
}
return result
}
} }
@@ -7,6 +7,7 @@
import UIKit import UIKit
import Messages import Messages
import SwiftUI
class MessagesViewController: MSMessagesAppViewController { class MessagesViewController: MSMessagesAppViewController {
let dataSource: StickerBrowserDataSource = StickerBrowserDataSource() let dataSource: StickerBrowserDataSource = StickerBrowserDataSource()
@@ -24,6 +25,37 @@ class MessagesViewController: MSMessagesAppViewController {
stickerBrowser.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height) stickerBrowser.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)
stickerBrowser.dataSource = dataSource stickerBrowser.dataSource = dataSource
stickerBrowser.autoresizingMask = [.flexibleWidth] stickerBrowser.autoresizingMask = [.flexibleWidth]
guard stickerBrowser.dataSource?.numberOfStickers(in: stickerBrowser) != 0 else {
let swiftUIView = NoStickersView()
let hostingController = UIHostingController(rootView: swiftUIView)
addChild(hostingController)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(hostingController.view)
hostingController.didMove(toParent: self)
let link = UIButton()
link.setTitle("Open StickerSlack", for: .normal)
link.setImage(UIImage(systemName: "arrow.up.right.square"), for: .normal)
link.setTitleColor(.systemBlue, for: .normal)
link.frame = view.frame
link.translatesAutoresizingMaskIntoConstraints = false
link.addTarget(self, action: #selector(openStickerSlack), for: .touchUpInside)
view.addSubview(link)
NSLayoutConstraint.activate([
hostingController.view.centerXAnchor.constraint(equalTo: view.centerXAnchor),
hostingController.view.centerYAnchor.constraint(equalTo: view.centerYAnchor),
hostingController.view.widthAnchor.constraint(equalTo: view.widthAnchor),
hostingController.view.heightAnchor.constraint(equalTo: view.heightAnchor),
link.centerXAnchor.constraint(equalTo: view.centerXAnchor),
link.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
link.heightAnchor.constraint(equalToConstant: 50)
])
return
}
view.addSubview(stickerBrowser) view.addSubview(stickerBrowser)
stickerBrowser.reloadData() stickerBrowser.reloadData()
view.bringSubviewToFront(stickerBrowser) view.bringSubviewToFront(stickerBrowser)
@@ -73,4 +105,12 @@ class MessagesViewController: MSMessagesAppViewController {
// Use this method to finalize any behaviors associated with the change in presentation style. // Use this method to finalize any behaviors associated with the change in presentation style.
} }
@objc
func openStickerSlack() {
if let url = URL(string: "stickerslack://") {
self.extensionContext?.open(url) { success in
print("open url: \(success)")
}
}
}
} }
@@ -11,18 +11,40 @@ import Messages
class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource { class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource {
var hoarder: EmojiHoarder = EmojiHoarder(localOnly: true, skipIndex: true) var hoarder: EmojiHoarder = EmojiHoarder(localOnly: true, skipIndex: true)
var emojis: [MSSticker] = [] var msStickers: [MSSticker] = []
var emojis: [Emoji] = []
override init() {
super.init()
msStickers = []
guard let files = try? FileManager.default.contentsOfDirectory(atPath: EmojiHoarder.container.path()) else { return }
for file in files {
guard file.contains(".png") ||
file.contains(".jpg") ||
file.contains(".gif") else { continue }
let name = String(file.split(separator: ".")[0])
if let emoji = hoarder.trie.dict[name],
let msSticker = emoji.msSticker {
msStickers.append(msSticker)
} else {
print(
"name, emoji has value, mssticker has value:",
name,
hoarder.trie.dict[name] != nil,
hoarder.trie.dict[name]?.msSticker != nil
)
}
}
print(msStickers.count, "init")
}
func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int { func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {
guard emojis.isEmpty else { return emojis.count } print(msStickers.count, "numberofstickers")
for emoji in hoarder.emojis { return msStickers.count
guard let sticker = emoji.msSticker else { continue }
emojis.append(sticker)
}
return emojis.count
} }
func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker { func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker {
return emojis[index] return msStickers[index]
} }
} }
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.