importing packs

added emojipack importer view
added stuff to contentview to handle incoming urls
This commit is contained in:
neon443 committed 2026-04-10 16:58:04 +01:00
1 parent c8648acbfd
commit 99500e7b08
5 files changed
+88 -5

No files matched your search

+6
View File
@@ -127,6 +127,8 @@
A9EB72502EB94FAD00658CEB /* StickerPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */; }; A9EB72502EB94FAD00658CEB /* StickerPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */; };
A9EC46AD2F6D9E4600E066E6 /* Hoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30FD2F5FA47100A57668 /* Hoarder.swift */; }; A9EC46AD2F6D9E4600E066E6 /* Hoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30FD2F5FA47100A57668 /* Hoarder.swift */; };
A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EB2F5AFE1E00A57668 /* StickerType.swift */; }; A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30EB2F5AFE1E00A57668 /* StickerType.swift */; };
A9F7B3802F8951210071F198 /* EmojiPackImporterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */; };
A9F7B3812F8951210071F198 /* EmojiPackImporterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@@ -220,6 +222,7 @@
A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiTableView.swift; sourceTree = "<group>"; }; A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiTableView.swift; sourceTree = "<group>"; };
A9EB72462EB948C400658CEB /* StickerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerRow.swift; sourceTree = "<group>"; }; A9EB72462EB948C400658CEB /* StickerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerRow.swift; sourceTree = "<group>"; };
A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrieTestingView.swift; sourceTree = "<group>"; }; A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrieTestingView.swift; sourceTree = "<group>"; };
A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackImporterView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@@ -296,6 +299,7 @@
children = ( children = (
A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */, A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */,
A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */, A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */,
A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */,
); );
path = EmojiPacks; path = EmojiPacks;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -647,6 +651,7 @@
A955B3F52EC22EE900E1732D /* SearchView.swift in Sources */, A955B3F52EC22EE900E1732D /* SearchView.swift in Sources */,
A935437B2EB2A3C800BB80A4 /* FilterCategory.swift in Sources */, A935437B2EB2A3C800BB80A4 /* FilterCategory.swift in Sources */,
A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */, A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */,
A9F7B3812F8951210071F198 /* EmojiPackImporterView.swift in Sources */,
A9A7A44E2F68383900BB84C6 /* GiphyImages.swift in Sources */, A9A7A44E2F68383900BB84C6 /* GiphyImages.swift in Sources */,
A9C172DD2EB8C9AC008A7885 /* Trie.swift in Sources */, A9C172DD2EB8C9AC008A7885 /* Trie.swift in Sources */,
A955B3F22EC22E9700E1732D /* BrowseView.swift in Sources */, A955B3F22EC22E9700E1732D /* BrowseView.swift in Sources */,
@@ -713,6 +718,7 @@
A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */, A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */,
A955B3F12EC22E9700E1732D /* BrowseView.swift in Sources */, A955B3F12EC22E9700E1732D /* BrowseView.swift in Sources */,
A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */, A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */,
A9F7B3802F8951210071F198 /* EmojiPackImporterView.swift in Sources */,
A9BE30F72F5B011A00A57668 /* StickerProtocol.swift in Sources */, A9BE30F72F5B011A00A57668 /* StickerProtocol.swift in Sources */,
A9BE30FC2F5B03F400A57668 /* Sticker.swift in Sources */, A9BE30FC2F5B03F400A57668 /* Sticker.swift in Sources */,
A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */, A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */,
+17 -2
View File
@@ -9,12 +9,27 @@ import SwiftUI
@main @main
struct StickerSlackApp: App { struct StickerSlackApp: App {
@ObservedObject var emojiHoarder: EmojiHoarder = EmojiHoarder()
@ObservedObject var gifhoarder: GifHoarder = GifHoarder()
@State var importingEmojiPack: Bool = false
@State var pack: EmojiPack = .new()
var body: some Scene { var body: some Scene {
WindowGroup { WindowGroup {
ContentView() ContentView(emojiHoarder: emojiHoarder, gifhoarder: gifhoarder)
.onOpenURL { url in .onOpenURL { url in
print(EmojiPack(fromShareLink: url)) importingEmojiPack = true
pack = EmojiPack(fromShareLink: url)
NotificationCenter.default.post(name: .didImportPack, object: pack)
}
.sheet(isPresented: $importingEmojiPack) {
EmojiPackImporterView(emojiHoarder: emojiHoarder, pack: $pack)
} }
} }
} }
} }
extension Notification.Name {
static let didImportPack = Self("didImportNote")
}
+3 -3
View File
@@ -9,8 +9,8 @@ import SwiftUI
import Haptics import Haptics
struct ContentView: View { struct ContentView: View {
@ObservedObject var emojiHoarder: EmojiHoarder = EmojiHoarder() @ObservedObject var emojiHoarder: EmojiHoarder
@ObservedObject var gifhoarder: GifHoarder = GifHoarder() @ObservedObject var gifhoarder: GifHoarder
var body: some View { var body: some View {
Group { Group {
@@ -75,5 +75,5 @@ struct ContentView: View {
} }
#Preview { #Preview {
ContentView(emojiHoarder: EmojiHoarder(localOnly: false)) ContentView(emojiHoarder: EmojiHoarder(localOnly: false), gifhoarder: GifHoarder(localOnly: false))
} }
@@ -0,0 +1,60 @@
//
// EmojiPackImporterView.swift
// StickerSlack
//
// Created by neon443 on 10/04/2026.
//
import SwiftUI
struct EmojiPackImporterView: View {
@ObservedObject var emojiHoarder: EmojiHoarder
@Binding var pack: EmojiPack
@Environment(\.dismiss) var dismiss
var body: some View {
EmojiPackDetailView(hoarder: emojiHoarder, pack: $pack)
.overlay(alignment: .bottomLeading) {
Button {
withAnimation {
emojiHoarder.emojiPacks.append(pack)
dismiss()
}
} label: {
Text("Cancel")
.font(.title3)
.padding(5)
}
.modifier(glassButtonIfAv())
.padding(.leading)
.tint(.gray)
}
.overlay(alignment: .bottomTrailing) {
Button {
withAnimation {
emojiHoarder.emojiPacks.append(pack)
dismiss()
}
} label: {
Text("Add")
.font(.title3)
.bold()
.padding(5)
}
.modifier(glassButtonIfAv())
.padding(.trailing)
.tint(.purple)
}
}
}
#Preview {
Color.orange
.ignoresSafeArea(.all)
.sheet(isPresented: .constant(true)) {
EmojiPackImporterView(
emojiHoarder: EmojiHoarder(localOnly: true, skipIndex: true),
pack: .constant(.test)
)
}
}
@@ -42,7 +42,9 @@ struct EmojiPackManager: View {
.toolbar { .toolbar {
ToolbarItem { ToolbarItem {
Button { Button {
withAnimation {
hoarder.emojiPacks.append(.new()) hoarder.emojiPacks.append(.new())
}
} label: { } label: {
Image(systemName: "plus") Image(systemName: "plus")
} }
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.