still need to fix state issues

This commit is contained in:
Nihaal Sharma committed 2026-07-01 13:25:22 +01:00
1 parent 22f282c5d1
commit 9b1773ce60
2 files changed
+32 -31

No files matched your search

+31 -31
View File
@@ -7,38 +7,38 @@
import SwiftUI 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(emojiHoarder: emojiHoarder, gifhoarder: gifhoarder)
.onOpenURL { url in
if let imported = EmojiPack(fromShareLink: url) {
importingEmojiPack = true
pack = imported
}
}
.sheet(isPresented: $importingEmojiPack) {
EmojiPackImporterView(emojiHoarder: emojiHoarder, pack: $pack)
}
}
}
}
//@main //@main
//class StickerSlackApp: UIResponder, UIApplicationDelegate { //struct StickerSlackApp: App {
// var window: UIWindow? // @ObservedObject var emojiHoarder: EmojiHoarder = EmojiHoarder()
// @ObservedObject var gifhoarder: GifHoarder = GifHoarder()
// //
// func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool { // @State var importingEmojiPack: Bool = false
// window = UIWindow(frame: UIScreen.main.bounds) // @State var pack: EmojiPack = .new()
// window?.rootViewController = TabbedContentView() //
// window?.makeKeyAndVisible() // var body: some Scene {
// return true // WindowGroup {
// ContentView(emojiHoarder: emojiHoarder, gifhoarder: gifhoarder)
// .onOpenURL { url in
// if let imported = EmojiPack(fromShareLink: url) {
// importingEmojiPack = true
// pack = imported
// } // }
// } // }
// .sheet(isPresented: $importingEmojiPack) {
// EmojiPackImporterView(emojiHoarder: emojiHoarder, pack: $pack)
// }
// }
// }
//}
@main
class StickerSlackApp: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = TabbedContentView()
window?.makeKeyAndVisible()
return true
}
}
@@ -76,6 +76,7 @@ struct EmojiPackManager: View {
Button("", systemImage: "trash") { Button("", systemImage: "trash") {
showDeleteAlert.toggle() showDeleteAlert.toggle()
} }
.disabled(selection.isEmpty)
.confirmationDialog("These items will be deleted immediately", isPresented: $showDeleteAlert) { .confirmationDialog("These items will be deleted immediately", isPresented: $showDeleteAlert) {
Button("Delete \(selection.count) pack\(selection.count.plural)", role: .destructive) { Button("Delete \(selection.count) pack\(selection.count.plural)", role: .destructive) {
for pack in selection { for pack in selection {
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.