mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 20:54:51 +00:00
use uikit in browseview
fix downloading gifs remove some random test
This commit is contained in:
4 files changed
+10
-20
No files matched your search
@@ -19,7 +19,7 @@ struct Gif: StickerProtocol {
|
|||||||
let split = urlString.split(separator: ".")
|
let split = urlString.split(separator: ".")
|
||||||
let fileExtension = ".\(split.last ?? "png")"
|
let fileExtension = ".\(split.last ?? "png")"
|
||||||
|
|
||||||
return GifHoarder.container.absoluteString+name+"."+id+fileExtension
|
return GifHoarder.container.path()+name+"."+id+fileExtension
|
||||||
}
|
}
|
||||||
var remoteImageURL: URL
|
var remoteImageURL: URL
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ struct BrowseView: View {
|
|||||||
@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) { type in
|
ForEach(StickerType.allCases) { type in
|
||||||
Text(type.description).tag(type)
|
Text(type.description).tag(type)
|
||||||
@@ -22,11 +22,14 @@ struct BrowseView: View {
|
|||||||
.pickerStyle(.segmented)
|
.pickerStyle(.segmented)
|
||||||
switch browseWhat {
|
switch browseWhat {
|
||||||
case .slackEmoji:
|
case .slackEmoji:
|
||||||
ForEach(emojiHoarder.emojis, id: \.self) { emoji in
|
EmojiCollectionView(
|
||||||
StickerRow(hoarder: emojiHoarder, sticker: emoji)
|
hoarder: emojiHoarder,
|
||||||
.listRowSeparator(.hidden)
|
items: emojiHoarder.emojis.map { $0.name }
|
||||||
}
|
)
|
||||||
|
.ignoresSafeArea(.container, edges: .bottom)
|
||||||
|
.id(emojiHoarder.emojis)
|
||||||
case .giphyGifs:
|
case .giphyGifs:
|
||||||
|
ScrollView {
|
||||||
ForEach(gifHoarder.trendingGifs) { gif in
|
ForEach(gifHoarder.trendingGifs) { gif in
|
||||||
StickerRow(hoarder: emojiHoarder, sticker: gif)
|
StickerRow(hoarder: emojiHoarder, sticker: gif)
|
||||||
.listRowSeparator(.hidden)
|
.listRowSeparator(.hidden)
|
||||||
@@ -34,6 +37,7 @@ struct BrowseView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
|
|||||||
@@ -27,14 +27,6 @@ struct SearchView: View {
|
|||||||
.pickerStyle(.segmented)
|
.pickerStyle(.segmented)
|
||||||
switch stickerType {
|
switch stickerType {
|
||||||
case .slackEmoji:
|
case .slackEmoji:
|
||||||
List {
|
|
||||||
Text("\(searchResult.count) Result\(searchResult.count.plural)")
|
|
||||||
.contentTransition(.numericText())
|
|
||||||
ForEach(searchResult, id: \.self) { name in
|
|
||||||
StickerRow(hoarder: hoarder, sticker: hoarder.trie.dict[name]!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.fixedSize()
|
|
||||||
EmojiCollectionView(hoarder: hoarder, items: searchResult)
|
EmojiCollectionView(hoarder: hoarder, items: searchResult)
|
||||||
.id(searchResult)
|
.id(searchResult)
|
||||||
case .giphyGifs:
|
case .giphyGifs:
|
||||||
|
|||||||
@@ -119,12 +119,6 @@ struct PerformanceTests {
|
|||||||
hoarder.buildTrie()
|
hoarder.buildTrie()
|
||||||
}
|
}
|
||||||
|
|
||||||
@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)
|
||||||
|
|||||||