diff --git a/Resources/SlackGlyph Light.png b/Resources/SlackGlyph Light.png deleted file mode 100644 index be3e4d1..0000000 Binary files a/Resources/SlackGlyph Light.png and /dev/null differ diff --git a/Resources/SlackGlyph Light.pxd b/Resources/SlackGlyph Light.pxd deleted file mode 100644 index c0c0a5b..0000000 Binary files a/Resources/SlackGlyph Light.pxd and /dev/null differ diff --git a/Resources/SlackGlyph.png b/Resources/SlackGlyph.png deleted file mode 100644 index ddca45c..0000000 Binary files a/Resources/SlackGlyph.png and /dev/null differ diff --git a/Resources/SlackGlyph.pxd b/Resources/SlackGlyph.pxd index dbe27ae..0e0dfc4 100644 Binary files a/Resources/SlackGlyph.pxd and b/Resources/SlackGlyph.pxd differ diff --git a/Resources/square.and.arrow.up.svg b/Resources/slackGlyph.svg similarity index 100% rename from Resources/square.and.arrow.up.svg rename to Resources/slackGlyph.svg diff --git a/Resources/square.and.arrow.up.pxd b/Resources/square.and.arrow.up.pxd deleted file mode 100644 index 0e0dfc4..0000000 Binary files a/Resources/square.and.arrow.up.pxd and /dev/null differ diff --git a/StickerSlack.xcodeproj/project.pbxproj b/StickerSlack.xcodeproj/project.pbxproj index b198f24..730efe3 100644 --- a/StickerSlack.xcodeproj/project.pbxproj +++ b/StickerSlack.xcodeproj/project.pbxproj @@ -70,6 +70,15 @@ A9A7A44C2F6837A800BB84C6 /* GiphyUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A44A2F6837A800BB84C6 /* GiphyUser.swift */; }; A9A7A44E2F68383900BB84C6 /* GiphyImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A44D2F68383900BB84C6 /* GiphyImages.swift */; }; A9A7A44F2F68383900BB84C6 /* GiphyImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A44D2F68383900BB84C6 /* GiphyImages.swift */; }; + A9A7A4572F69568700BB84C6 /* GifHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EE2F5B004800A57668 /* GifHoarder.swift */; }; + A9A7A4582F69569100BB84C6 /* Trending.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A43E2F6835F800BB84C6 /* Trending.swift */; }; + A9A7A4592F69569100BB84C6 /* Pagination.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A4442F68360900BB84C6 /* Pagination.swift */; }; + A9A7A45A2F69569100BB84C6 /* Meta.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A4472F68361200BB84C6 /* Meta.swift */; }; + A9A7A45B2F69569100BB84C6 /* GifObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A4412F68360200BB84C6 /* GifObject.swift */; }; + A9A7A45C2F69569100BB84C6 /* GiphyImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A44D2F68383900BB84C6 /* GiphyImages.swift */; }; + A9A7A45D2F69569100BB84C6 /* GiphyUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A7A44A2F6837A800BB84C6 /* GiphyUser.swift */; }; + A9A7A45E2F6956B700BB84C6 /* StickerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EB2F5AFE1E00A57668 /* StickerType.swift */; }; + A9A7A45F2F69570200BB84C6 /* Gif.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30F12F5B004E00A57668 /* Gif.swift */; }; A9B9A82E2EB2CCBE004C9245 /* StickerSlackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9B9A82C2EB2CCBE004C9245 /* StickerSlackTests.swift */; }; A9B9A82F2EB2CCED004C9245 /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; }; A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924C3712EA9127200F20781 /* Emoji.swift */; }; @@ -280,6 +289,7 @@ A91C098D2EBBD7C100210C34 /* SwiftUI */ = { isa = PBXGroup; children = ( + A9A7A4602F69597000BB84C6 /* Gifs */, A949B1F02EA04E8200215164 /* ContentView.swift */, A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */, A91C098C2EBBD7AB00210C34 /* Emoji */, @@ -406,6 +416,13 @@ path = Cachet; sourceTree = ""; }; + A9A7A4602F69597000BB84C6 /* Gifs */ = { + isa = PBXGroup; + children = ( + ); + path = Gifs; + sourceTree = ""; + }; A9B9A82D2EB2CCBE004C9245 /* StickerSlackTests */ = { isa = PBXGroup; children = ( @@ -506,9 +523,6 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - KnownAssetTags = ( - New, - ); LastSwiftUpdateCheck = 2600; LastUpgradeCheck = 2600; TargetAttributes = { @@ -639,9 +653,18 @@ A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */, A9BE30FA2F5B03F400A57668 /* Sticker.swift in Sources */, A986A6CD2EB659E000B6E0FA /* MessagesViewController.swift in Sources */, + A9A7A4572F69568700BB84C6 /* GifHoarder.swift in Sources */, A9BE30FF2F5FA78E00A57668 /* Hoarder.swift in Sources */, + A9A7A4582F69569100BB84C6 /* Trending.swift in Sources */, + A9A7A4592F69569100BB84C6 /* Pagination.swift in Sources */, + A9A7A45A2F69569100BB84C6 /* Meta.swift in Sources */, + A9A7A45B2F69569100BB84C6 /* GifObject.swift in Sources */, + A9A7A45C2F69569100BB84C6 /* GiphyImages.swift in Sources */, + A9A7A45D2F69569100BB84C6 /* GiphyUser.swift in Sources */, A986A6CE2EB659E000B6E0FA /* StickerBrowserDataSource.swift in Sources */, A957C17E2ECFAA1100EA3EE9 /* GifView.swift in Sources */, + A9A7A45F2F69570200BB84C6 /* Gif.swift in Sources */, + A9A7A45E2F6956B700BB84C6 /* StickerType.swift in Sources */, A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */, A986A6C42EB6598500B6E0FA /* SlackResponse.swift in Sources */, A986A6C22EB6597600B6E0FA /* Emoji.swift in Sources */, @@ -866,6 +889,8 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13; MARKETING_VERSION = "$(VERSION)"; + ON_DEMAND_RESOURCES_INITIAL_INSTALL_TAGS = ""; + ON_DEMAND_RESOURCES_PREFETCH_ORDER = ""; PRODUCT_BUNDLE_IDENTIFIER = com.neon443.StickerSlack; PRODUCT_NAME = "$(TARGET_NAME)"; REGISTER_APP_GROUPS = YES; @@ -915,6 +940,8 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13; MARKETING_VERSION = "$(VERSION)"; + ON_DEMAND_RESOURCES_INITIAL_INSTALL_TAGS = ""; + ON_DEMAND_RESOURCES_PREFETCH_ORDER = ""; PRODUCT_BUNDLE_IDENTIFIER = com.neon443.StickerSlack; PRODUCT_NAME = "$(TARGET_NAME)"; REGISTER_APP_GROUPS = YES; diff --git a/StickerSlack/Emoji/Emoji.swift b/StickerSlack/Emoji/Emoji.swift index acedd4c..92ad022 100644 --- a/StickerSlack/Emoji/Emoji.swift +++ b/StickerSlack/Emoji/Emoji.swift @@ -12,13 +12,13 @@ import Messages import UniformTypeIdentifiers struct Emoji: StickerProtocol { - var id: UUID + var id: String var name: String var localImageURLString: String { let urlString = remoteImageURL.absoluteString let split = urlString.split(separator: ".") let fileExtension = ".\(split.last ?? "png")" - return EmojiHoarder.container.absoluteString+id.uuidString+fileExtension + return EmojiHoarder.container.absoluteString+id+fileExtension } var remoteImageURL: URL @@ -30,7 +30,7 @@ struct Emoji: StickerProtocol { init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self.id = try container.decode(UUID.self, forKey: .id) + self.id = try container.decode(String.self, forKey: .id) self.name = try container.decode(String.self, forKey: .name) self.remoteImageURL = try container.decode(URL.self, forKey: .remoteImageURL) } @@ -38,7 +38,7 @@ struct Emoji: StickerProtocol { init( name: String, url: URL, - id: UUID = UUID() + id: String = UUID().uuidString ) { self.id = id self.name = name diff --git a/StickerSlack/Emoji/EmojiHoarder.swift b/StickerSlack/Emoji/EmojiHoarder.swift index ed04bdf..0b00969 100644 --- a/StickerSlack/Emoji/EmojiHoarder.swift +++ b/StickerSlack/Emoji/EmojiHoarder.swift @@ -22,7 +22,7 @@ class EmojiHoarder: Hoarder, ObservableObject { @Published var emojiPacks: [EmojiPack] = [] @Published var trie: Trie = Trie() - @Published var downloadedEmojis: Set = [] + @Published var downloadedStickers: Set = [] @Published var downloadedEmojisArr: [String] = [] @Published var letterStats: [EmojiHoarder.LetterStat] = [] @@ -72,9 +72,9 @@ class EmojiHoarder: Hoarder, ObservableObject { group.addTask { for i in range { await MainActor.run { self.downloadedEmojisArr.append(self.emojis[i].name) } - guard !self.downloadedEmojis.contains(await self.emojis[i].name) else { continue } + guard !self.downloadedStickers.contains(await self.emojis[i].name) else { continue } Task { await self.download(emoji: self.emojis[i], skipStoreIndex: true) } - await MainActor.run { self.downloadedEmojis.insert(self.emojis[i].name) } + await MainActor.run { self.downloadedStickers.insert(self.emojis[i].name) } if i == self.emojis.count { Task { @MainActor in self.storeDownloadedIndexes() @@ -91,10 +91,10 @@ class EmojiHoarder: Hoarder, ObservableObject { @MainActor func deleteAllStickers() { for i in emojis.indices { - guard downloadedEmojis.contains(emojis[i].name) else { continue } + guard downloadedStickers.contains(emojis[i].name) else { continue } delete(emoji: emojis[i], skipStoreIndex: true) } - downloadedEmojis = [] + downloadedStickers = [] downloadedEmojisArr = [] storeDownloadedIndexes() } @@ -111,7 +111,7 @@ class EmojiHoarder: Hoarder, ObservableObject { try? FileManager.default.removeItem(at: EmojiHoarder.localTrie) try? FileManager.default.removeItem(at: EmojiHoarder.localTrieDict) - downloadedEmojis = [] + downloadedStickers = [] downloadedEmojisArr = [] UserDefaults.standard.removeObject(forKey: "downloadedEmojis") UserDefaults.standard.removeObject(forKey: "downloadedEmojisArr") @@ -168,22 +168,22 @@ class EmojiHoarder: Hoarder, ObservableObject { } private func buildDownloadedEmojis() { - downloadedEmojis = [] + downloadedStickers = [] downloadedEmojisArr = [] downloadedEmojisArr = (try? decoder.decode([String].self, from: UserDefaults.standard.data(forKey: "downloadedEmojisArr") ?? Data())) ?? [] - downloadedEmojis = (try? decoder.decode(Set.self, from: UserDefaults.standard.data(forKey: "downloadedEmojis") ?? Data())) ?? [] + downloadedStickers = (try? decoder.decode(Set.self, from: UserDefaults.standard.data(forKey: "downloadedEmojis") ?? Data())) ?? [] - if downloadedEmojis.isEmpty || downloadedEmojisArr.isEmpty { + if downloadedStickers.isEmpty || downloadedEmojisArr.isEmpty { for emoji in emojis { guard emoji.isLocal else { continue } - downloadedEmojis.insert(emoji.name) + downloadedStickers.insert(emoji.name) downloadedEmojisArr.append(emoji.name) } } } func storeDownloadedIndexes() { - UserDefaults.standard.set(try! encoder.encode(downloadedEmojis), forKey: "downloadedEmojis") + UserDefaults.standard.set(try! encoder.encode(downloadedStickers), forKey: "downloadedEmojis") UserDefaults.standard.set(try! encoder.encode(downloadedEmojisArr), forKey: "downloadedEmojisArr") } @@ -232,12 +232,12 @@ class EmojiHoarder: Hoarder, ObservableObject { } } - nonisolated func download(emoji: Emoji, skipStoreIndex: Bool = false) async { + nonisolated func download(emoji: StickerProtocol, skipStoreIndex: Bool = false) async { try? await emoji.downloadImage() await MainActor.run { if !skipStoreIndex { withAnimation(.snappy) { - self.downloadedEmojis.insert(emoji.name) + self.downloadedStickers.insert(emoji.name) self.downloadedEmojisArr.append(emoji.name) } self.storeDownloadedIndexes() @@ -247,11 +247,11 @@ class EmojiHoarder: Hoarder, ObservableObject { } @MainActor - func delete(emoji: Emoji, skipStoreIndex: Bool = false) { + func delete(emoji: StickerProtocol, skipStoreIndex: Bool = false) { emoji.deleteImage() if !skipStoreIndex { withAnimation(.snappy) { - downloadedEmojis.remove(emoji.name) + downloadedStickers.remove(emoji.name) downloadedEmojisArr.removeAll(where: { $0 == emoji.name }) } storeDownloadedIndexes() diff --git a/StickerSlack/Gifs/Gif.swift b/StickerSlack/Gifs/Gif.swift index dedd85e..3437f72 100644 --- a/StickerSlack/Gifs/Gif.swift +++ b/StickerSlack/Gifs/Gif.swift @@ -10,14 +10,14 @@ import SwiftUI import UniformTypeIdentifiers struct Gif: StickerProtocol { - var id: UUID + var id: String var name: String var localImageURLString: String { let urlString = remoteImageURL.absoluteString let split = urlString.split(separator: ".") let fileExtension = ".\(split.last ?? "png")" - return EmojiHoarder.container.appendingPathComponent("gifs", conformingTo: .directory).absoluteString+id.uuidString+fileExtension + return EmojiHoarder.container.appendingPathComponent("gifs", conformingTo: .directory).absoluteString+id+fileExtension } var remoteImageURL: URL @@ -28,7 +28,7 @@ struct Gif: StickerProtocol { init( name: String, url: URL, - id: UUID = UUID() + id: String = UUID().uuidString ) { self.id = id self.name = name diff --git a/StickerSlack/Gifs/GifHoarder.swift b/StickerSlack/Gifs/GifHoarder.swift index 7a080c9..b9e8520 100644 --- a/StickerSlack/Gifs/GifHoarder.swift +++ b/StickerSlack/Gifs/GifHoarder.swift @@ -19,13 +19,14 @@ class GifHoarder: Hoarder, ObservableObject { @Published var searchTerm: String = "" @Published var trendingGifs: [Gif] = [] + @Published var downloadedStickers: Set = [] - func download(emoji: Emoji, skipStoreIndex: Bool) { + func download(emoji: any StickerProtocol, skipStoreIndex: Bool = false) { // <#code#> } - func delete(emoji: Emoji, skipStoreIndex: Bool) { + func delete(emoji: any StickerProtocol, skipStoreIndex: Bool = false) { // <#code#> } @@ -39,7 +40,10 @@ class GifHoarder: Hoarder, ObservableObject { do { async let (data, _) = try URLSession.shared.data(from: components!.url!) let object: Trending = try JSONDecoder().decode(Trending.self, from: await data) - print(object.data.count) + guard object.meta.status == 200 else { + fatalError("non ok status code") + } + trendingGifs = object.data.map { $0.toGif } } catch { print(error) } diff --git a/StickerSlack/Hoarder.swift b/StickerSlack/Hoarder.swift index af2fdac..df92c7e 100644 --- a/StickerSlack/Hoarder.swift +++ b/StickerSlack/Hoarder.swift @@ -10,14 +10,15 @@ import SwiftUI import Combine import UniformTypeIdentifiers -protocol Hoarder { +protocol Hoarder: ObservableObject { static var container: URL { get } var endpoint: URL { get } + var downloadedStickers: Set { get set } var encoder: JSONEncoder { get } var decoder: JSONDecoder { get } - func download(emoji: Emoji, skipStoreIndex: Bool) async - func delete(emoji: Emoji, skipStoreIndex: Bool) + func download(emoji: any StickerProtocol, skipStoreIndex: Bool) async + func delete(emoji: any StickerProtocol, skipStoreIndex: Bool) } extension Hoarder { diff --git a/StickerSlack/Models/Cachet/SlackResponse.swift b/StickerSlack/Models/Cachet/SlackResponse.swift index f3e4d00..c9e0ef6 100644 --- a/StickerSlack/Models/Cachet/SlackResponse.swift +++ b/StickerSlack/Models/Cachet/SlackResponse.swift @@ -9,7 +9,7 @@ import Foundation struct SlackResponse: Identifiable, Codable { var type: String - var id: UUID + var id: String var name: String var imageUrl: String var alias: String? diff --git a/StickerSlack/Models/Giphy/GifObject.swift b/StickerSlack/Models/Giphy/GifObject.swift index b283135..8fe218c 100644 --- a/StickerSlack/Models/Giphy/GifObject.swift +++ b/StickerSlack/Models/Giphy/GifObject.swift @@ -29,4 +29,8 @@ struct GifObject: Codable, Identifiable { var title: String var alt_text: String var is_low_contrast: Bool + + var toGif: Gif { + return Gif(name: self.title, url: URL(string: self.images.fixed_width.url)!, id: self.id) + } } diff --git a/StickerSlack/Stickers/StickerProtocol.swift b/StickerSlack/Stickers/StickerProtocol.swift index 9c54041..d9fbce3 100644 --- a/StickerSlack/Stickers/StickerProtocol.swift +++ b/StickerSlack/Stickers/StickerProtocol.swift @@ -9,7 +9,7 @@ import Foundation import Messages protocol StickerProtocol: Codable, Identifiable, Hashable { - var id: UUID { get set } + var id: String { get set } var name: String { get set } var localImageURL: URL { get } diff --git a/StickerSlack/SwiftUI/BrowseView.swift b/StickerSlack/SwiftUI/BrowseView.swift index 9dee48d..dcad11d 100644 --- a/StickerSlack/SwiftUI/BrowseView.swift +++ b/StickerSlack/SwiftUI/BrowseView.swift @@ -10,6 +10,7 @@ import SwiftUI struct BrowseView: View { @State private var browseWhat: StickerType = .slackEmoji @ObservedObject var hoarder: EmojiHoarder + @ObservedObject var gifHoarder: GifHoarder var body: some View { List { @@ -26,12 +27,17 @@ struct BrowseView: View { .listRowSeparator(.hidden) } case .giphyGifs: - Text("hi") + ForEach(gifHoarder.trendingGifs) { gif in + EmojiRow(hoarder: hoarder, emoji: gif) + } } } } } #Preview { - BrowseView(hoarder: EmojiHoarder(localOnly: true)) + BrowseView( + hoarder: EmojiHoarder(localOnly: true), + gifHoarder: GifHoarder(localOnly: true) + ) } diff --git a/StickerSlack/SwiftUI/ContentView.swift b/StickerSlack/SwiftUI/ContentView.swift index c614888..2f78259 100644 --- a/StickerSlack/SwiftUI/ContentView.swift +++ b/StickerSlack/SwiftUI/ContentView.swift @@ -17,7 +17,7 @@ struct ContentView: View { if #available(iOS 18, *) { TabView { Tab("Browse", systemImage: "square.grid.2x2.fill") { - BrowseView(hoarder: hoarder) + BrowseView(hoarder: hoarder, gifHoarder: gifhoarder) } Tab("Downloaded", systemImage: "arrow.down.circle.fill") { @@ -34,7 +34,7 @@ struct ContentView: View { } } else { TabView { - BrowseView(hoarder: hoarder) + BrowseView(hoarder: hoarder, gifHoarder: gifhoarder) .tabItem { Label("Browse", systemImage: "square.grid.2x2.fill") } diff --git a/StickerSlack/SwiftUI/Emoji/EmojiPackView.swift b/StickerSlack/SwiftUI/Emoji/EmojiPackView.swift index 17b705c..1d0ce58 100644 --- a/StickerSlack/SwiftUI/Emoji/EmojiPackView.swift +++ b/StickerSlack/SwiftUI/Emoji/EmojiPackView.swift @@ -17,7 +17,7 @@ struct EmojiPackView: View { Text(pack.description) .foregroundStyle(.gray) ForEach(pack.emojiNames, id: \.self) { name in - EmojiPreview(hoarder: hoarder, emoji: hoarder.trie.dict[name] ?? .test) + EmojiPreview(emoji: hoarder.trie.dict[name] ?? .test) } } } diff --git a/StickerSlack/SwiftUI/Emoji/EmojiPreview.swift b/StickerSlack/SwiftUI/Emoji/EmojiPreview.swift index eefce3e..5ea4d6c 100644 --- a/StickerSlack/SwiftUI/Emoji/EmojiPreview.swift +++ b/StickerSlack/SwiftUI/Emoji/EmojiPreview.swift @@ -9,8 +9,7 @@ import SwiftUI import Haptics struct EmojiPreview: View { - @ObservedObject var hoarder: EmojiHoarder - @State var emoji: Emoji + @State var emoji: any StickerProtocol @State var gifImage: Image? @@ -35,7 +34,6 @@ struct ImageErrorView: View { #Preview { EmojiPreview( - hoarder: EmojiHoarder(localOnly: true), emoji: Emoji.test ) } diff --git a/StickerSlack/SwiftUI/Emoji/EmojiRow.swift b/StickerSlack/SwiftUI/Emoji/EmojiRow.swift index 33d9fe9..0ca7a40 100644 --- a/StickerSlack/SwiftUI/Emoji/EmojiRow.swift +++ b/StickerSlack/SwiftUI/Emoji/EmojiRow.swift @@ -8,18 +8,18 @@ import SwiftUI import Haptics -struct EmojiRow: View { - @ObservedObject var hoarder: EmojiHoarder - @State var emoji: Emoji +struct EmojiRow: View { + @ObservedObject var hoarder: T + @State var emoji: any StickerProtocol @State var showTooltip: Bool = false var isLocal: Bool { - return hoarder.downloadedEmojis.contains(emoji.name) + return hoarder.downloadedStickers.contains(emoji.name) } var body: some View { HStack { - EmojiPreview(hoarder: hoarder, emoji: emoji) + EmojiPreview(emoji: emoji) .frame(width: 100, height: 100) .transition(.scale) @@ -64,14 +64,14 @@ struct EmojiRow: View { if isLocal { Button("", systemImage: "trash") { - hoarder.delete(emoji: emoji) + hoarder.delete(emoji: emoji, skipStoreIndex: false) } .buttonStyle(.plain) .transition(.scale) } else { Button("", systemImage: "arrow.down.circle") { Task { - await hoarder.download(emoji: emoji) + await hoarder.download(emoji: emoji, skipStoreIndex: false) } } .buttonStyle(.plain) @@ -87,8 +87,9 @@ struct EmojiRow: View { #Preview { @Previewable var hoarder = EmojiHoarder(localOnly: true) List { - EmojiRow(hoarder: hoarder, emoji: .test) - EmojiRow(hoarder: hoarder, emoji: .testLongName) + EmojiRow(hoarder: hoarder, emoji: Emoji.test) + EmojiRow(hoarder: hoarder, emoji: Emoji.testLongName) + EmojiRow(hoarder: hoarder, emoji: Gif.test) EmojiRow(hoarder: hoarder, emoji: Emoji(name: "a", url: Emoji.test.remoteImageURL)) EmojiRow(hoarder: hoarder, emoji: Emoji(name: "ab", url: Emoji.test.remoteImageURL)) EmojiRow(hoarder: hoarder, emoji: Emoji(name: "abc", url: Emoji.test.remoteImageURL)) diff --git a/StickerSlack/SwiftUI/SettingsView.swift b/StickerSlack/SwiftUI/SettingsView.swift index c5ef5c8..6c33130 100644 --- a/StickerSlack/SwiftUI/SettingsView.swift +++ b/StickerSlack/SwiftUI/SettingsView.swift @@ -46,8 +46,8 @@ struct SettingsView: View { Section("Stats") { Text("\(hoarder.emojis.count) total Emoji") - Text("\(hoarder.downloadedEmojis.count) downloaded Emoji") - if hoarder.downloadedEmojis.count == hoarder.emojis.count { + Text("\(hoarder.downloadedStickers.count) downloaded Emoji") + if hoarder.downloadedStickers.count == hoarder.emojis.count { Text("🎉") .font(.largeTitle) } diff --git a/StickerSlackTests/StickerSlackTests.swift b/StickerSlackTests/StickerSlackTests.swift index 64fe81e..dec9317 100644 --- a/StickerSlackTests/StickerSlackTests.swift +++ b/StickerSlackTests/StickerSlackTests.swift @@ -149,7 +149,7 @@ struct PerformanceTests { @Test func testDownloadedEmojis() async throws { for emoji in hoarder.emojis { - let x = hoarder.downloadedEmojis.contains(emoji.name) + let x = hoarder.downloadedStickers.contains(emoji.name) } } }