mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 13:26:17 +00:00
add welcome view with how to use steps
add listrow for reusability added stats like total, downloaded emojis added letterstats to count how many emojis there are starting with each letter fix lag when opening settigns cos we were initing a new hoarder in trietestingview fix downloaded view using screen width instead of window width now its good on mac and ipad split screen added designed for ipad support
This commit is contained in:
@@ -26,8 +26,13 @@ class EmojiHoarder: ObservableObject {
|
||||
@Published var downloadedEmojis: Set<String> = []
|
||||
@Published var downloadedEmojisArr: [String] = []
|
||||
@Published var searchTerm: String = ""
|
||||
@Published var letterStats: [EmojiHoarder.LetterStat] = []
|
||||
|
||||
@Published var showWelcome: Bool = true
|
||||
|
||||
init(localOnly: Bool = false, skipIndex: Bool = false) {
|
||||
self.showWelcome = !UserDefaults.standard.bool(forKey: "showWelcome")
|
||||
|
||||
let localDB = loadLocalDB()
|
||||
withAnimation { self.emojis = localDB }
|
||||
loadTrie()
|
||||
@@ -196,6 +201,26 @@ class EmojiHoarder: ObservableObject {
|
||||
Haptic.heavy.trigger()
|
||||
}
|
||||
|
||||
func setShowWelcome(to newValue: Bool) {
|
||||
UserDefaults.standard.set(!newValue, forKey: "shownWelcome")
|
||||
self.showWelcome = newValue
|
||||
}
|
||||
|
||||
func generateLetterStats() -> [EmojiHoarder.LetterStat] {
|
||||
var result: [EmojiHoarder.LetterStat] = []
|
||||
for child in trie.root.children {
|
||||
let count = trie.collectWords(startingWith: child.key, from: child.value).count
|
||||
let stat = LetterStat(char: child.key, count: count)
|
||||
result.append(stat)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
struct LetterStat: Hashable {
|
||||
var char: String
|
||||
var count: Int
|
||||
}
|
||||
|
||||
// func filterEmojis(byCategory category: FilterCategory, searchTerm: String) {
|
||||
// guard category != .none else {
|
||||
// filterEmojis(by: searchTerm)
|
||||
|
||||
Reference in New Issue
Block a user