mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
quicker opening of the imessage app, support ios 17 and below again
This commit is contained in:
8 files changed
+219
-88
No files matched your search
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// DownloadedView.swift
|
||||
// StickerSlack
|
||||
//
|
||||
// Created by neon443 on 10/11/2025.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct DownloadedView: View {
|
||||
@ObservedObject var hoarder: EmojiHoarder = .shared
|
||||
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
var isDark: Bool { colorScheme == .dark }
|
||||
|
||||
var minColWidth: CGFloat { 75 }
|
||||
var spacing: CGFloat { 10 }
|
||||
var col: GridItem {
|
||||
GridItem(
|
||||
.flexible(minimum: minColWidth, maximum: 125),
|
||||
spacing: spacing,
|
||||
alignment: .center
|
||||
)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
let columns: Int = max(1, Int((UIScreen.main.bounds.width - 2*spacing) / (minColWidth + spacing)))
|
||||
let layout = Array(repeating: col, count: columns)
|
||||
LazyVGrid(columns: layout, spacing: 10) {
|
||||
ForEach(hoarder.emojis, id: \.self) { emoji in
|
||||
if hoarder.downloadedEmojis.contains(emoji.name) {
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.foregroundStyle(isDark ? .black : .white)
|
||||
EmojiPreview(emoji: emoji)
|
||||
RoundedRectangle(cornerRadius: 15)
|
||||
.stroke(.gray, lineWidth: 1)
|
||||
}
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 15))
|
||||
.contextMenu {
|
||||
Text(emoji.name)
|
||||
Button("Share", systemImage: "square.and.arrow.up") {
|
||||
|
||||
}
|
||||
ShareLink("Share", item: emoji.localImageURL, subject: nil, message: nil)
|
||||
ShareLink("Share", item: emoji.remoteImageURL, subject: nil, message: nil)
|
||||
Divider()
|
||||
Button("Delete", systemImage: "trash.fill", role: .destructive) {
|
||||
hoarder.delete(emoji: emoji)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, spacing)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
DownloadedView()
|
||||
}
|
||||