mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
importing packs
added emojipack importer view added stuff to contentview to handle incoming urls
This commit is contained in:
5 files changed
+89
-6
No files matched your search
@@ -127,6 +127,8 @@
|
||||
A9EB72502EB94FAD00658CEB /* StickerPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */; };
|
||||
A9EC46AD2F6D9E4600E066E6 /* Hoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BE30FD2F5FA47100A57668 /* Hoarder.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 */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -220,6 +222,7 @@
|
||||
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>"; };
|
||||
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 */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -296,6 +299,7 @@
|
||||
children = (
|
||||
A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */,
|
||||
A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */,
|
||||
A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */,
|
||||
);
|
||||
path = EmojiPacks;
|
||||
sourceTree = "<group>";
|
||||
@@ -647,6 +651,7 @@
|
||||
A955B3F52EC22EE900E1732D /* SearchView.swift in Sources */,
|
||||
A935437B2EB2A3C800BB80A4 /* FilterCategory.swift in Sources */,
|
||||
A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */,
|
||||
A9F7B3812F8951210071F198 /* EmojiPackImporterView.swift in Sources */,
|
||||
A9A7A44E2F68383900BB84C6 /* GiphyImages.swift in Sources */,
|
||||
A9C172DD2EB8C9AC008A7885 /* Trie.swift in Sources */,
|
||||
A955B3F22EC22E9700E1732D /* BrowseView.swift in Sources */,
|
||||
@@ -713,6 +718,7 @@
|
||||
A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */,
|
||||
A955B3F12EC22E9700E1732D /* BrowseView.swift in Sources */,
|
||||
A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */,
|
||||
A9F7B3802F8951210071F198 /* EmojiPackImporterView.swift in Sources */,
|
||||
A9BE30F72F5B011A00A57668 /* StickerProtocol.swift in Sources */,
|
||||
A9BE30FC2F5B03F400A57668 /* Sticker.swift in Sources */,
|
||||
A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */,
|
||||
|
||||
@@ -9,12 +9,27 @@ import SwiftUI
|
||||
|
||||
@main
|
||||
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 {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
ContentView(emojiHoarder: emojiHoarder, gifhoarder: gifhoarder)
|
||||
.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")
|
||||
}
|
||||
@@ -9,8 +9,8 @@ import SwiftUI
|
||||
import Haptics
|
||||
|
||||
struct ContentView: View {
|
||||
@ObservedObject var emojiHoarder: EmojiHoarder = EmojiHoarder()
|
||||
@ObservedObject var gifhoarder: GifHoarder = GifHoarder()
|
||||
@ObservedObject var emojiHoarder: EmojiHoarder
|
||||
@ObservedObject var gifhoarder: GifHoarder
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
@@ -75,5 +75,5 @@ struct ContentView: View {
|
||||
}
|
||||
|
||||
#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 {
|
||||
ToolbarItem {
|
||||
Button {
|
||||
hoarder.emojiPacks.append(.new())
|
||||
withAnimation {
|
||||
hoarder.emojiPacks.append(.new())
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
|
||||