mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 13:26:17 +00:00
added search
added emojipack, currently unused using the cahcet id in emoji
This commit is contained in:
@@ -27,6 +27,8 @@
|
|||||||
A9BE06DB2EA656B80033B213 /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
|
A9BE06DB2EA656B80033B213 /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
|
||||||
A9BE06DC2EA657C70033B213 /* ApiEmoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A940FE3C2EA232590016870B /* ApiEmoji.swift */; };
|
A9BE06DC2EA657C70033B213 /* ApiEmoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A940FE3C2EA232590016870B /* ApiEmoji.swift */; };
|
||||||
A9BE06DD2EA657CF0033B213 /* SlackResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1FA2EA0518800215164 /* SlackResponse.swift */; };
|
A9BE06DD2EA657CF0033B213 /* SlackResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1FA2EA0518800215164 /* SlackResponse.swift */; };
|
||||||
|
A9D15B8A2EB1142C00404792 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
|
||||||
|
A9D15B8B2EB1142C00404792 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@@ -72,6 +74,7 @@
|
|||||||
A969D6A82EA3F1AF00399C05 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
|
A969D6A82EA3F1AF00399C05 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
|
||||||
A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
|
A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
|
||||||
A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPreview.swift; sourceTree = "<group>"; };
|
A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPreview.swift; sourceTree = "<group>"; };
|
||||||
|
A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -151,6 +154,7 @@
|
|||||||
A949B1FA2EA0518800215164 /* SlackResponse.swift */,
|
A949B1FA2EA0518800215164 /* SlackResponse.swift */,
|
||||||
A940FE3C2EA232590016870B /* ApiEmoji.swift */,
|
A940FE3C2EA232590016870B /* ApiEmoji.swift */,
|
||||||
A924C3712EA9127200F20781 /* Emoji.swift */,
|
A924C3712EA9127200F20781 /* Emoji.swift */,
|
||||||
|
A9D15B892EB1142C00404792 /* EmojiPack.swift */,
|
||||||
);
|
);
|
||||||
path = Emoji;
|
path = Emoji;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -292,6 +296,7 @@
|
|||||||
A949B1F52EA04E8200215164 /* StickerSlackApp.swift in Sources */,
|
A949B1F52EA04E8200215164 /* StickerSlackApp.swift in Sources */,
|
||||||
A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */,
|
A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */,
|
||||||
A924C3732EA9127200F20781 /* Emoji.swift in Sources */,
|
A924C3732EA9127200F20781 /* Emoji.swift in Sources */,
|
||||||
|
A9D15B8B2EB1142C00404792 /* EmojiPack.swift in Sources */,
|
||||||
A949B1F82EA04F2300215164 /* EmojiHoarder.swift in Sources */,
|
A949B1F82EA04F2300215164 /* EmojiHoarder.swift in Sources */,
|
||||||
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */,
|
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */,
|
||||||
);
|
);
|
||||||
@@ -306,6 +311,7 @@
|
|||||||
A9BE06DB2EA656B80033B213 /* EmojiHoarder.swift in Sources */,
|
A9BE06DB2EA656B80033B213 /* EmojiHoarder.swift in Sources */,
|
||||||
A969D6AF2EA3F1AF00399C05 /* MessagesViewController.swift in Sources */,
|
A969D6AF2EA3F1AF00399C05 /* MessagesViewController.swift in Sources */,
|
||||||
A9BE06DD2EA657CF0033B213 /* SlackResponse.swift in Sources */,
|
A9BE06DD2EA657CF0033B213 /* SlackResponse.swift in Sources */,
|
||||||
|
A9D15B8A2EB1142C00404792 /* EmojiPack.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ struct ApiEmoji: EmojiProtocol {
|
|||||||
case urlString
|
case urlString
|
||||||
}
|
}
|
||||||
|
|
||||||
func toEmoji() -> Emoji {
|
func toEmoji(withID: UUID = UUID()) -> Emoji {
|
||||||
return Emoji(apiEmoji: self)
|
return Emoji(apiEmoji: self, id: withID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func encode(to encoder: any Encoder) throws {
|
func encode(to encoder: any Encoder) throws {
|
||||||
|
|||||||
13
StickerSlack/Emoji/EmojiPack.swift
Normal file
13
StickerSlack/Emoji/EmojiPack.swift
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// EmojiPack.swift
|
||||||
|
// StickerSlack
|
||||||
|
//
|
||||||
|
// Created by neon443 on 28/10/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct EmojiPack: Identifiable, Codable {
|
||||||
|
var id: UUID
|
||||||
|
var emojiIDs: [UUID]
|
||||||
|
}
|
||||||
@@ -17,6 +17,11 @@ struct SlackResponse: Identifiable, Codable {
|
|||||||
|
|
||||||
static func toEmojis(from response: [SlackResponse]?) -> [Emoji]? {
|
static func toEmojis(from response: [SlackResponse]?) -> [Emoji]? {
|
||||||
guard let response else { return nil }
|
guard let response else { return nil }
|
||||||
return response.map { ApiEmoji(name: $0.name, url: $0.imageUrl).toEmoji() }
|
return response.map { item in
|
||||||
|
ApiEmoji(
|
||||||
|
name: item.name,
|
||||||
|
url: item.imageUrl
|
||||||
|
).toEmoji(withID: item.id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ class EmojiHoarder: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.emojis = fetched
|
self.emojis = fetched
|
||||||
self.filteredEmojis = emojis
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func storeStickers(_ toStore: [UUID]) {
|
func storeStickers(_ toStore: [UUID]) {
|
||||||
@@ -63,7 +62,7 @@ class EmojiHoarder: ObservableObject {
|
|||||||
|
|
||||||
func filterEmojis(by searchTerm: String) {
|
func filterEmojis(by searchTerm: String) {
|
||||||
guard !searchTerm.isEmpty else {
|
guard !searchTerm.isEmpty else {
|
||||||
self.filteredEmojis = emojis
|
self.filteredEmojis = []
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Task {
|
Task {
|
||||||
|
|||||||
@@ -18,7 +18,12 @@ struct ContentView: View {
|
|||||||
TabView {
|
TabView {
|
||||||
List {
|
List {
|
||||||
HStack {
|
HStack {
|
||||||
Stepper("show?", value: $hoarder.prefix, step: 100) { $0 }
|
TextField("", text: $searchTerm) {
|
||||||
|
hoarder.filterEmojis(by: searchTerm)
|
||||||
|
}
|
||||||
|
|
||||||
|
.autocorrectionDisabled()
|
||||||
|
.textFieldStyle(.roundedBorder)
|
||||||
// Button("downloaded", systemImage: "arrow.down.circle.fill") {
|
// Button("downloaded", systemImage: "arrow.down.circle.fill") {
|
||||||
// <#code#>
|
// <#code#>
|
||||||
// }
|
// }
|
||||||
@@ -28,13 +33,20 @@ struct ContentView: View {
|
|||||||
EmojiPreview(emoji: emoji, image: emoji.image)
|
EmojiPreview(emoji: emoji, image: emoji.image)
|
||||||
.frame(maxWidth: 100)
|
.frame(maxWidth: 100)
|
||||||
Spacer()
|
Spacer()
|
||||||
Button("", systemImage: "arrow.down.circle") {
|
if emoji.isLocal {
|
||||||
Task {
|
Button("", systemImage: "trash") {
|
||||||
try? await emoji.downloadImage()
|
emoji.deleteImage()
|
||||||
emoji.refresh()
|
|
||||||
}
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
} else {
|
||||||
|
Button("", systemImage: "arrow.down.circle") {
|
||||||
|
Task {
|
||||||
|
try? await emoji.downloadImage()
|
||||||
|
emoji.refresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
|
||||||
}
|
}
|
||||||
.id(emoji.uiID)
|
.id(emoji.uiID)
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
||||||
@@ -49,6 +61,7 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
// .searchable(text: $searchTerm, prompt: "Search")
|
// .searchable(text: $searchTerm, prompt: "Search")
|
||||||
}
|
}
|
||||||
|
.searchable(text: $searchTerm)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
Label("home", systemImage: "house")
|
Label("home", systemImage: "house")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user