mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
fix search
nice overlayed picker gotta clean up tho and gotta fix slow dl view
This commit is contained in:
3 files changed
+27
-21
No files matched your search
@@ -131,7 +131,8 @@ class EmojiHoarder: Hoarder, ObservableObject {
|
||||
func buildTrie() {
|
||||
let start = Date().timeIntervalSince1970
|
||||
for emoji in emojis {
|
||||
// trie.insewrt(word: emoji.name)
|
||||
// trie.insert(word: emoji.name)
|
||||
trie.wordlist.insert(emoji.name)
|
||||
trie.dict[emoji.name] = emoji
|
||||
}
|
||||
buildDownloadedEmojis()
|
||||
|
||||
@@ -14,28 +14,33 @@ struct BrowseView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Picker("", selection: $browseWhat) {
|
||||
ForEach(StickerType.allCases) { type in
|
||||
Text(type.description).tag(type)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
switch browseWhat {
|
||||
case .slackEmoji:
|
||||
EmojiCollectionView(
|
||||
hoarder: emojiHoarder,
|
||||
items: emojiHoarder.emojis.map { $0.name }
|
||||
)
|
||||
.ignoresSafeArea(.container, edges: .bottom)
|
||||
.id(emojiHoarder.emojis)
|
||||
case .giphyGifs:
|
||||
ScrollView {
|
||||
ForEach(gifHoarder.trendingGifs) { gif in
|
||||
StickerRow(hoarder: emojiHoarder, sticker: gif)
|
||||
.listRowSeparator(.hidden)
|
||||
Group {
|
||||
switch browseWhat {
|
||||
case .slackEmoji:
|
||||
EmojiCollectionView(
|
||||
hoarder: emojiHoarder,
|
||||
items: emojiHoarder.emojis.map { $0.name }
|
||||
)
|
||||
.ignoresSafeArea(.container, edges: .bottom)
|
||||
.id(emojiHoarder.emojis)
|
||||
case .giphyGifs:
|
||||
ScrollView {
|
||||
ForEach(gifHoarder.trendingGifs) { gif in
|
||||
StickerRow(hoarder: emojiHoarder, sticker: gif)
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.overlay(alignment: .top) {
|
||||
Picker("", selection: $browseWhat) {
|
||||
ForEach(StickerType.allCases) { type in
|
||||
Text(type.description).tag(type)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ struct DownloadedView: View {
|
||||
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(emojiHoarder.downloadedStickers.sorted(), id: \.self) { name in
|
||||
ForEach(Array(emojiHoarder.downloadedStickers), id: \.self) { name in
|
||||
if let emoji = emojiHoarder.trie.dict[name] {
|
||||
ZStack {
|
||||
Rectangle()
|
||||
|
||||