From 39c8457c3e30a8695dcc828c9d9c4b1938d7922c Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:36:21 +0100 Subject: [PATCH] ios 15 support gotta fix how swiftui is displayed inside my tableviewcells --- StickerSlack.xcodeproj/project.pbxproj | 24 ++++++- .../Emoji/Categorisation/EmojiPack.swift | 7 +- StickerSlack/Emoji/EmojiHoarder.swift | 4 +- StickerSlack/Extensions/URL.swift | 26 +++++++ StickerSlack/Gifs/GifHoarder.swift | 2 +- StickerSlack/Hoarder.swift | 3 +- StickerSlack/Stickers/Sticker.swift | 10 ++- StickerSlack/SwiftUI/ContentView.swift | 2 +- StickerSlack/SwiftUI/DownloadedView.swift | 2 +- .../EmojiPacks/EmojiPackDetailView.swift | 38 ++++++---- .../SwiftUI/EmojiPacks/EmojiPackManager.swift | 2 +- StickerSlack/SwiftUI/EmojiPacks/Wiggle.metal | 15 ++++ StickerSlack/SwiftUI/Misc/ViewModifiers.swift | 72 +++++++++++++++++++ StickerSlack/SwiftUI/SettingsView.swift | 6 +- StickerSlack/SwiftUI/Shared/StickerRow.swift | 3 +- StickerSlack/SwiftUI/WelcomeView.swift | 5 +- StickerSlack/UIKit/EmojiTableView.swift | 12 ++-- StickerSlack/UIKit/ShareSheet.swift | 27 +++++++ .../StickerBrowserDataSource.swift | 2 +- 19 files changed, 219 insertions(+), 43 deletions(-) create mode 100644 StickerSlack/Extensions/URL.swift create mode 100644 StickerSlack/SwiftUI/EmojiPacks/Wiggle.metal create mode 100644 StickerSlack/UIKit/ShareSheet.swift diff --git a/StickerSlack.xcodeproj/project.pbxproj b/StickerSlack.xcodeproj/project.pbxproj index 7da175d..50545c6 100644 --- a/StickerSlack.xcodeproj/project.pbxproj +++ b/StickerSlack.xcodeproj/project.pbxproj @@ -112,6 +112,13 @@ A9C52F6B2F8988CE00078588 /* EmptyCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */; }; A9C52F6C2F8988CE00078588 /* EmptyCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */; }; A9C52F6D2F8988CE00078588 /* EmptyCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */; }; + A9C52F6F2F89A22000078588 /* Wiggle.metal in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6E2F89A22000078588 /* Wiggle.metal */; }; + A9C52F702F89A22000078588 /* Wiggle.metal in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F6E2F89A22000078588 /* Wiggle.metal */; }; + A9C52F722F89A85F00078588 /* ShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F712F89A85F00078588 /* ShareSheet.swift */; }; + A9C52F732F89A85F00078588 /* ShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F712F89A85F00078588 /* ShareSheet.swift */; }; + A9C52F752F89A93D00078588 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F742F89A93D00078588 /* URL.swift */; }; + A9C52F762F89A93D00078588 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F742F89A93D00078588 /* URL.swift */; }; + A9C52F772F89A9BF00078588 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C52F742F89A93D00078588 /* URL.swift */; }; A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */; }; A9CD6C362EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */; }; A9CD6C382EDDE37500B7F421 /* EmojiPackManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */; }; @@ -219,6 +226,9 @@ A9BE30FD2F5FA47100A57668 /* Hoarder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hoarder.swift; sourceTree = ""; }; A9C172DB2EB8C9AC008A7885 /* Trie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trie.swift; sourceTree = ""; }; A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyCollectionView.swift; sourceTree = ""; }; + A9C52F6E2F89A22000078588 /* Wiggle.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Wiggle.metal; sourceTree = ""; }; + A9C52F712F89A85F00078588 /* ShareSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareSheet.swift; sourceTree = ""; }; + A9C52F742F89A93D00078588 /* URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = ""; }; A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackDetailView.swift; sourceTree = ""; }; A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackManager.swift; sourceTree = ""; }; A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = ""; }; @@ -276,6 +286,7 @@ A957C1762ECD008E00EA3EE9 /* Bundle.swift */, A9A7A4672F6AA17C00BB84C6 /* Int.swift */, A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */, + A9C52F742F89A93D00078588 /* URL.swift */, ); path = Extensions; sourceTree = ""; @@ -304,6 +315,7 @@ A9CD6C342EDDE22800B7F421 /* EmojiPackDetailView.swift */, A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */, A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */, + A9C52F6E2F89A22000078588 /* Wiggle.metal */, ); path = EmojiPacks; sourceTree = ""; @@ -328,6 +340,7 @@ isa = PBXGroup; children = ( A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */, + A9C52F712F89A85F00078588 /* ShareSheet.swift */, ); path = UIKit; sourceTree = ""; @@ -652,10 +665,12 @@ A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */, A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */, A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */, + A9C52F6F2F89A22000078588 /* Wiggle.metal in Sources */, A9BDEADE2F82BC93002798DF /* NoStickersView.swift in Sources */, A955B3F52EC22EE900E1732D /* SearchView.swift in Sources */, A935437B2EB2A3C800BB80A4 /* FilterCategory.swift in Sources */, A9C52F6D2F8988CE00078588 /* EmptyCollectionView.swift in Sources */, + A9C52F752F89A93D00078588 /* URL.swift in Sources */, A9CD6C352EDDE22800B7F421 /* EmojiPackDetailView.swift in Sources */, A9F7B3812F8951210071F198 /* EmojiPackImporterView.swift in Sources */, A9A7A44E2F68383900BB84C6 /* GiphyImages.swift in Sources */, @@ -679,6 +694,7 @@ A9A7A4482F68361200BB84C6 /* Meta.swift in Sources */, A995D95C2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */, A9BE30FE2F5FA47100A57668 /* Hoarder.swift in Sources */, + A9C52F722F89A85F00078588 /* ShareSheet.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -697,6 +713,7 @@ A9A7A4572F69568700BB84C6 /* GifHoarder.swift in Sources */, A9BE30FF2F5FA78E00A57668 /* Hoarder.swift in Sources */, A9C52F6C2F8988CE00078588 /* EmptyCollectionView.swift in Sources */, + A9C52F772F89A9BF00078588 /* URL.swift in Sources */, A9A7A4582F69569100BB84C6 /* Trending.swift in Sources */, A9A7A4592F69569100BB84C6 /* Pagination.swift in Sources */, A9A7A45A2F69569100BB84C6 /* Meta.swift in Sources */, @@ -722,13 +739,16 @@ A9A7A4462F68360900BB84C6 /* Pagination.swift in Sources */, A957C17C2ECE542D00EA3EE9 /* GifManager.swift in Sources */, A9104C7F2EB4022500D160EA /* MSSticker.swift in Sources */, + A9C52F762F89A93D00078588 /* URL.swift in Sources */, A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */, + A9C52F702F89A22000078588 /* Wiggle.metal in Sources */, A955B3F12EC22E9700E1732D /* BrowseView.swift in Sources */, A9A7A4402F6835F800BB84C6 /* Trending.swift in Sources */, A9F7B3802F8951210071F198 /* EmojiPackImporterView.swift in Sources */, A9BE30F72F5B011A00A57668 /* StickerProtocol.swift in Sources */, A9C52F6B2F8988CE00078588 /* EmptyCollectionView.swift in Sources */, A9BE30FC2F5B03F400A57668 /* Sticker.swift in Sources */, + A9C52F732F89A85F00078588 /* ShareSheet.swift in Sources */, A9EC46AE2F6D9E5800E066E6 /* StickerType.swift in Sources */, A9B9A82F2EB2CCED004C9245 /* EmojiHoarder.swift in Sources */, A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */, @@ -935,7 +955,7 @@ "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 16; + IPHONEOS_DEPLOYMENT_TARGET = 15; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13; @@ -987,7 +1007,7 @@ "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 16; + IPHONEOS_DEPLOYMENT_TARGET = 15; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13; diff --git a/StickerSlack/Emoji/Categorisation/EmojiPack.swift b/StickerSlack/Emoji/Categorisation/EmojiPack.swift index 7193279..26c975a 100644 --- a/StickerSlack/Emoji/Categorisation/EmojiPack.swift +++ b/StickerSlack/Emoji/Categorisation/EmojiPack.swift @@ -23,7 +23,7 @@ struct EmojiPack: Identifiable, Codable { } init(fromShareLink url: URL) { - guard url.scheme == "stickerslack" && url.host() == "shared.pack" else { fatalError("invalid share url") } + guard url.scheme == "stickerslack" && url.safeHost == "shared.pack" else { fatalError("invalid share url") } guard let components = URLComponents(string: url.absoluteString), let queryItems = components.queryItems else { fatalError("no query items or components") } @@ -81,7 +81,10 @@ struct EmojiPack: Identifiable, Codable { .init(name: "description", value: description), .init(name: "items", value: data.base64EncodedString()) ] - url = url.appending(queryItems: queries) + + var components = URLComponents(url: url, resolvingAgainstBaseURL: false) + components!.queryItems = queries + url = components!.url! return url } } diff --git a/StickerSlack/Emoji/EmojiHoarder.swift b/StickerSlack/Emoji/EmojiHoarder.swift index ee2bc71..513d08a 100644 --- a/StickerSlack/Emoji/EmojiHoarder.swift +++ b/StickerSlack/Emoji/EmojiHoarder.swift @@ -34,7 +34,7 @@ class EmojiHoarder: BaseHoarder { super.init() self.showWelcome = !UserDefaults.standard.bool(forKey: "showWelcome") - if !FileManager.default.fileExists(atPath: EmojiHoarder.container.path()) { + if !FileManager.default.fileExists(atPath: EmojiHoarder.container.safePath) { try! FileManager.default.createDirectory(at: EmojiHoarder.container, withIntermediateDirectories: true) } @@ -131,7 +131,7 @@ class EmojiHoarder: BaseHoarder { } private func loadTrie() { - guard FileManager.default.fileExists(atPath: EmojiHoarder.localTrieDict.path()) else { return } + guard FileManager.default.fileExists(atPath: EmojiHoarder.localTrieDict.safePath) else { return } guard let dataDict = try? Data(contentsOf: EmojiHoarder.localTrieDict) else { return } guard let decodedDict = try? decoder.decode([String:Emoji].self, from: dataDict) else { fatalError("failed to decode dict") diff --git a/StickerSlack/Extensions/URL.swift b/StickerSlack/Extensions/URL.swift new file mode 100644 index 0000000..8cf53ce --- /dev/null +++ b/StickerSlack/Extensions/URL.swift @@ -0,0 +1,26 @@ +// +// URL.swift +// StickerSlack +// +// Created by neon443 on 10/04/2026. +// + +import Foundation + +extension URL { + nonisolated var safePath: String { + if #available(iOS 16, *) { + return self.path() + } else { + return self.path + } + } + + nonisolated var safeHost: String? { + if #available(iOS 16, *) { + return self.host() + } else { + return self.host + } + } +} diff --git a/StickerSlack/Gifs/GifHoarder.swift b/StickerSlack/Gifs/GifHoarder.swift index ab1fc4c..752873a 100644 --- a/StickerSlack/Gifs/GifHoarder.swift +++ b/StickerSlack/Gifs/GifHoarder.swift @@ -23,7 +23,7 @@ class GifHoarder: BaseHoarder { init(localOnly: Bool = false) { super.init() - if !FileManager.default.fileExists(atPath: GifHoarder.container.path()) { + if !FileManager.default.fileExists(atPath: GifHoarder.container.safePath) { try! FileManager.default.createDirectory(at: GifHoarder.container, withIntermediateDirectories: true) } startLoadingTrending() diff --git a/StickerSlack/Hoarder.swift b/StickerSlack/Hoarder.swift index 0a3e1b2..080fa27 100644 --- a/StickerSlack/Hoarder.swift +++ b/StickerSlack/Hoarder.swift @@ -50,7 +50,8 @@ class BaseHoarder: Hoarder { } else { var newSet: Set = [] let url = await BaseHoarder.library.appendingPathComponent(stickerType, conformingTo: .directory) - if let files = try? FileManager.default.contentsOfDirectory(atPath: url.path()) { + + if let files = try? FileManager.default.contentsOfDirectory(atPath: url.safePath) { for file in files { let name = String(file.split(separator: ".")[0]) newSet.insert(name) diff --git a/StickerSlack/Stickers/Sticker.swift b/StickerSlack/Stickers/Sticker.swift index 14b2e62..809244e 100644 --- a/StickerSlack/Stickers/Sticker.swift +++ b/StickerSlack/Stickers/Sticker.swift @@ -12,9 +12,9 @@ extension StickerProtocol { var localImageURLString: String { let containerPath: String if type(of: self) == Emoji.self { - containerPath = EmojiHoarder.container.path() + containerPath = EmojiHoarder.container.safePath } else if type(of: self) == Gif.self { - containerPath = GifHoarder.container.path() + containerPath = GifHoarder.container.safePath } else { fatalError("sticker type unrecogniesd") } @@ -25,7 +25,11 @@ extension StickerProtocol { } var localImageURL: URL { - return URL(filePath: localImageURLString) + if #available(iOS 16, *) { + return URL(filePath: localImageURLString) + } else { + return URL(fileURLWithPath: localImageURLString) + } } var msSticker: MSSticker? { diff --git a/StickerSlack/SwiftUI/ContentView.swift b/StickerSlack/SwiftUI/ContentView.swift index 2cddaba..1aa1be1 100644 --- a/StickerSlack/SwiftUI/ContentView.swift +++ b/StickerSlack/SwiftUI/ContentView.swift @@ -56,7 +56,7 @@ struct ContentView: View { .tabItem { Label("Setings", systemImage: "gear") } - NavigationStack { + NavigationView2 { SearchView(hoarder: emojiHoarder) } .tabItem { diff --git a/StickerSlack/SwiftUI/DownloadedView.swift b/StickerSlack/SwiftUI/DownloadedView.swift index 7684119..50fcaf3 100644 --- a/StickerSlack/SwiftUI/DownloadedView.swift +++ b/StickerSlack/SwiftUI/DownloadedView.swift @@ -62,7 +62,7 @@ struct DownloadedView: View { UIPasteboard.general.image = emoji.image } Divider() - ShareLink("Share", item: emoji.remoteImageURL, subject: nil, message: nil) +// ShareLink("Share", item: emoji.remoteImageURL, subject: nil, message: nil) Divider() Button("Delete", systemImage: "trash.fill", role: .destructive) { emojiHoarder.delete(emoji: emoji) diff --git a/StickerSlack/SwiftUI/EmojiPacks/EmojiPackDetailView.swift b/StickerSlack/SwiftUI/EmojiPacks/EmojiPackDetailView.swift index 33d43dd..d6fd9ec 100644 --- a/StickerSlack/SwiftUI/EmojiPacks/EmojiPackDetailView.swift +++ b/StickerSlack/SwiftUI/EmojiPacks/EmojiPackDetailView.swift @@ -29,7 +29,7 @@ struct EmojiPackDetailView: View { @Environment(\.dismiss) var dismiss var body: some View { - NavigationStack { + NavigationView2 { GeometryReader { geo in ScrollView { Button() { @@ -110,11 +110,16 @@ struct EmojiPackDetailView: View { .padding(-10) } } - .rotationEffect( - .degrees( - edit ? sin(initDate.timeIntervalSinceNow*20)*4 : 0 - ) - ) +// .distortionEffect( +// ShaderLibrary.wiggle(.float(initDate.timeIntervalSinceNow)), +// maxSampleOffset: .zero, +// isEnabled: edit +// ) +// .rotationEffect( +// .degrees( +// edit ? sin(initDate.timeIntervalSinceNow*20)*4 : 0 +// ) +// ) } } if edit { @@ -133,14 +138,13 @@ struct EmojiPackDetailView: View { } } .sheet(isPresented: $showAdder) { - NavigationStack { + NavigationView2 { SearchView(hoarder: hoarder, fromPackEditor: true) { selection in pack.add(selection.name) } .navigationTitle("Search Emojis") .navigationBarTitleDisplayMode(.inline) - .presentationDragIndicator(.visible) - .presentationDetents([.large, .medium]) + .modifier(presentationHalfAndFullIfAv()) .toolbar { Button("", systemImage: "xmark") { showAdder.toggle() @@ -171,13 +175,19 @@ struct EmojiPackDetailView: View { .modifier(glassButtonIfAv(edit)) .tint(edit ? Color.accentColor : .primary) } - if #available(iOS 19, *) { - ToolbarSpacer() - } +// if #available(iOS 19, *) { +// ToolbarSpacer() +// } ToolbarItem { - ShareLink(item: pack.shareLink()) { - Image(systemName: "square.and.arrow.up") + Button("", systemImage: "square.and.arrow.up") { + } + .sheet(isPresented: .constant(true)) { + ShareSheet(activityItems: [pack.shareLink()]) + } +// ShareLink(item: pack.shareLink()) { +// Image(systemName: "square.and.arrow.up") +// } } } .onDisappear { diff --git a/StickerSlack/SwiftUI/EmojiPacks/EmojiPackManager.swift b/StickerSlack/SwiftUI/EmojiPacks/EmojiPackManager.swift index 76b91ab..ac8828f 100644 --- a/StickerSlack/SwiftUI/EmojiPacks/EmojiPackManager.swift +++ b/StickerSlack/SwiftUI/EmojiPacks/EmojiPackManager.swift @@ -11,7 +11,7 @@ struct EmojiPackManager: View { @ObservedObject var hoarder: EmojiHoarder var body: some View { - NavigationStack { + NavigationView2 { List { if hoarder.emojiPacks.isEmpty { EmptyCollectionView( diff --git a/StickerSlack/SwiftUI/EmojiPacks/Wiggle.metal b/StickerSlack/SwiftUI/EmojiPacks/Wiggle.metal new file mode 100644 index 0000000..9214231 --- /dev/null +++ b/StickerSlack/SwiftUI/EmojiPacks/Wiggle.metal @@ -0,0 +1,15 @@ +// +// Wiggle.metal +// StickerSlack +// +// Created by neon443 on 10/04/2026. +// + +#include +#include +using namespace metal; + +[[stitchable]] float2 wiggle(float2 pos, half4 color, float time) { +// pos.x + return pos; +} diff --git a/StickerSlack/SwiftUI/Misc/ViewModifiers.swift b/StickerSlack/SwiftUI/Misc/ViewModifiers.swift index 9e13edb..e173759 100644 --- a/StickerSlack/SwiftUI/Misc/ViewModifiers.swift +++ b/StickerSlack/SwiftUI/Misc/ViewModifiers.swift @@ -47,3 +47,75 @@ struct glassButtonIfAv: ViewModifier { } } } + +struct NavigationView2: View { + @ViewBuilder var contents: T + + var body: some View { + if #available(iOS 16, *) { + NavigationStack { + contents + } + } else { + NavigationView { + contents + } + } + } +} + +struct presentationHalfAndFullIfAv: ViewModifier { + func body(content: Content) -> some View { + if #available(iOS 16, *) { + content + .presentationDetents([.medium, .large]) + .presentationDragIndicator(.visible) + } else { + content + } + } +} + +struct BoldSafe: ViewModifier { + var isEnabled: Bool = true + var style: Font.TextStyle = .body + + func body(content: Content) -> some View { + if #available(iOS 16, *) { + content.bold(isEnabled) + } else { + if isEnabled { + content.font(.system(style).bold()) + } else { + content.font(.system(style)) + } + } + } +} + +struct MonospacedSafe: ViewModifier { + var isEnabled: Bool = true + var style: Font.TextStyle = .body + + func body(content: Content) -> some View { + if #available(iOS 16, *) { + content.monospaced(isEnabled) + } else { + if isEnabled { + content.font(.system(style).monospaced()) + } else { + content.font(.system(style)) + } + } + } +} + +struct ScrollContentBackgroundHidden: ViewModifier { + func body(content: Content) -> some View { + if #available(iOS 16, *) { + content.scrollContentBackground(.hidden) + } else { + content + } + } +} diff --git a/StickerSlack/SwiftUI/SettingsView.swift b/StickerSlack/SwiftUI/SettingsView.swift index e63af83..b6819a6 100644 --- a/StickerSlack/SwiftUI/SettingsView.swift +++ b/StickerSlack/SwiftUI/SettingsView.swift @@ -16,7 +16,7 @@ struct SettingsView: View { return colorScheme == .dark } var body: some View { - NavigationStack { + NavigationView2 { List { Section { HStack { @@ -30,9 +30,7 @@ struct SettingsView: View { .padding(.trailing, 10) VStack(alignment: .leading) { Text("StickerSlack") - .font(.title2) - .monospaced() - .bold() + .font(.title2.monospaced().bold()) HStack(alignment: .center, spacing: 5) { Text(Bundle.main.appVersion) .bold() diff --git a/StickerSlack/SwiftUI/Shared/StickerRow.swift b/StickerSlack/SwiftUI/Shared/StickerRow.swift index f989f93..2fda01c 100644 --- a/StickerSlack/SwiftUI/Shared/StickerRow.swift +++ b/StickerSlack/SwiftUI/Shared/StickerRow.swift @@ -26,8 +26,7 @@ struct StickerRow: View { VStack(alignment: .leading, spacing: 5) { Text(sticker.UIName) - .font(.caption) - .bold(isDownloaded) + .font(.caption.bold()) .foregroundColor(isDownloaded ? .green : .primary) .lineLimit(nil) .multilineTextAlignment(.leading) diff --git a/StickerSlack/SwiftUI/WelcomeView.swift b/StickerSlack/SwiftUI/WelcomeView.swift index b6fbd59..00c7508 100644 --- a/StickerSlack/SwiftUI/WelcomeView.swift +++ b/StickerSlack/SwiftUI/WelcomeView.swift @@ -23,8 +23,7 @@ struct WelcomeView: View { Spacer() Text("StickerSlack") .bold() - .font(.largeTitle) - .monospaced() + .font(.largeTitle.monospaced()) Spacer() } .padding(.vertical, 20) @@ -39,7 +38,7 @@ struct WelcomeView: View { ListRow(number: 6, text: "Tap an emoji to use it!") } } - .scrollContentBackground(.hidden) + .modifier(ScrollContentBackgroundHidden()) Spacer() Group { if #available(iOS 19, *) { diff --git a/StickerSlack/UIKit/EmojiTableView.swift b/StickerSlack/UIKit/EmojiTableView.swift index 52cfff7..fae9540 100644 --- a/StickerSlack/UIKit/EmojiTableView.swift +++ b/StickerSlack/UIKit/EmojiTableView.swift @@ -60,7 +60,6 @@ struct EmojiTableView: UIViewRepresentable { spinner.frame = cell.frame spinner.autoresizingMask = .flexibleWidth cell.addSubview(spinner) - tableView.reloadData() return cell } let emojiName = items[indexPath.row] @@ -69,10 +68,13 @@ struct EmojiTableView: UIViewRepresentable { cell.selectedBackgroundView = nil cell.selectionStyle = .none - cell.contentConfiguration = UIHostingConfiguration { - StickerRow(hoarder: hoarder, sticker: emoji) - .id(emoji) - } + + let swiftUIView = StickerRow(hoarder: hoarder, sticker: emoji).id(emoji) + let hostingController = UIHostingController(rootView: swiftUIView) + hostingController.view.frame = cell.frame + hostingController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight] + cell.addSubview(hostingController.view) + return cell } diff --git a/StickerSlack/UIKit/ShareSheet.swift b/StickerSlack/UIKit/ShareSheet.swift new file mode 100644 index 0000000..53c21bf --- /dev/null +++ b/StickerSlack/UIKit/ShareSheet.swift @@ -0,0 +1,27 @@ +// +// ShareSheet.swift +// StickerSlack +// +// Created by neon443 on 10/04/2026. +// + +import Foundation +import UIKit +import SwiftUI + +struct ShareSheet: UIViewControllerRepresentable { + let activityItems: [Any] + let applicationActivities: [UIActivity]? = nil + + func makeUIViewController(context: Context) -> UIActivityViewController { + let controller = UIActivityViewController( + activityItems: activityItems, + applicationActivities: applicationActivities + ) + return controller + } + + func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) { +// <#code#> + } +} diff --git a/StickerSlackiMessageApp/StickerBrowserDataSource.swift b/StickerSlackiMessageApp/StickerBrowserDataSource.swift index 69b1576..26e0a2e 100644 --- a/StickerSlackiMessageApp/StickerBrowserDataSource.swift +++ b/StickerSlackiMessageApp/StickerBrowserDataSource.swift @@ -17,7 +17,7 @@ class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource { override init() { super.init() msStickers = [] - guard let files = try? FileManager.default.contentsOfDirectory(atPath: EmojiHoarder.container.path()) else { return } + guard let files = try? FileManager.default.contentsOfDirectory(atPath: EmojiHoarder.container.safePath) else { return } for file in files { guard file.contains(".png") ||