indents and cleanup

This commit is contained in:
neon443 committed 2026-04-29 00:06:38 +01:00
1 parent be185eb3b3
commit e539c154f3
2 files changed
+52 -68

No files matched your search

@@ -43,7 +43,6 @@ struct EmojiPackDetailView: View {
var body: some View {
NavigationView2 {
// GeometryReader { geo in
VStack {
Button() {
editName.toggle()
@@ -181,57 +180,56 @@ struct EmojiPackDetailView: View {
}
}
Text("\(pack.items.count) Emoji\(pack.items.count.plural)")
.bold()
.multilineTextAlignment(.center)
.shadow(radius: 5)
.padding(.bottom)
}
.transition(.scale)
.navigationTitle(edit ? "Editing" : "Pack Details")
.navigationBarTitleDisplayMode(.inline)
.onDisappear {
hoarder.saveEmojiPacks()
}
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button(
"",
systemImage: edit ? "checkmark" : "pencil"
) {
withAnimation(.spring) { edit.toggle() }
}
.modifier(glassButtonIfAv(edit))
.tint(edit ? Color.accentColor : .primary)
Text("\(pack.items.count) Emoji\(pack.items.count.plural)")
.bold()
.multilineTextAlignment(.center)
.shadow(radius: 5)
.padding(.bottom)
}
.transition(.scale)
.navigationTitle(edit ? "Editing" : "Pack Details")
.navigationBarTitleDisplayMode(.inline)
.onDisappear {
hoarder.saveEmojiPacks()
}
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button(
"",
systemImage: edit ? "checkmark" : "pencil"
) {
withAnimation(.spring) { edit.toggle() }
}
ToolbarItem(placement: .topBarTrailing) {
Button("", systemImage: allDownloaded ? "checkmark" : "arrow.down") {
Task {
if allDownloaded {
await pack.deleteAll(hoarder: hoarder)
} else {
await pack.downloadAll(hoarder: hoarder)
}
}
}
.tint(allDownloaded ? .red : .accentColor)
}
ToolbarItem(placement: .topBarTrailing) {
if #available(iOS 16, *) {
ShareLink(item: pack.shareLink()) {
Image(systemName: "square.and.arrow.up")
}
} else {
Button("", systemImage: "square.and.arrow.up") {
showShare.toggle()
}
.sheet(isPresented: $showShare) {
ShareSheet(activityItems: [pack.shareLink()])
.modifier(glassButtonIfAv(edit))
.tint(edit ? Color.accentColor : .primary)
}
ToolbarItem(placement: .topBarTrailing) {
Button("", systemImage: allDownloaded ? "checkmark" : "arrow.down") {
Task {
if allDownloaded {
await pack.deleteAll(hoarder: hoarder)
} else {
await pack.downloadAll(hoarder: hoarder)
}
}
}
.tint(allDownloaded ? .red : .accentColor)
}
// }
ToolbarItem(placement: .topBarTrailing) {
if #available(iOS 16, *) {
ShareLink(item: pack.shareLink()) {
Image(systemName: "square.and.arrow.up")
}
} else {
Button("", systemImage: "square.and.arrow.up") {
showShare.toggle()
}
.sheet(isPresented: $showShare) {
ShareSheet(activityItems: [pack.shareLink()])
}
}
}
}
}
}
}
@@ -11,7 +11,6 @@ import SwiftUI
class PlainEmojiCollectionViewCell: UICollectionViewCell {
let stackView = UIStackView()
// let spinner = UIActivityIndicatorView()
var hostingController: UIHostingController<StickerPreview>?
override init(frame: CGRect) {
@@ -37,38 +36,25 @@ class PlainEmojiCollectionViewCell: UICollectionViewCell {
}
func configureSkeleton() {
// spinner.startAnimating()
// if spinner.superview == nil {
// stackView.addArrangedSubview(spinner)
// }
}
func configure(with: EmojiHoarder, emoji: Emoji) {
hostingController?.view.removeFromSuperview()
let swiftUIView = StickerPreview(sticker: emoji)
// if let hostingController {
// hostingController.rootView = swiftUIView
// } else {
let hostingController = UIHostingController(rootView: swiftUIView)
self.hostingController = hostingController
self.stackView.insertArrangedSubview(hostingController.view, at: 0)
let hostingController = UIHostingController(rootView: swiftUIView)
self.hostingController = hostingController
self.stackView.insertArrangedSubview(hostingController.view, at: 0)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
hostingController.view.heightAnchor.constraint(equalTo: hostingController.view.widthAnchor)
])
// }
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
hostingController.view.heightAnchor.constraint(equalTo: hostingController.view.widthAnchor)
])
}
override func prepareForReuse() {
super.prepareForReuse()
// stackView.arrangedSubviews.forEach {
// stackView.removeArrangedSubview($0)
// $0.removeFromSuperview()
// }
hostingController?.view.removeFromSuperview()
hostingController = nil
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.