working on sharelink making (wip)

This commit is contained in:
neon443 committed 2026-04-09 11:31:36 +01:00
1 parent 68b63083a5
commit 14841dded0
2 files changed
+18 -1

No files matched your search

@@ -7,6 +7,7 @@
import Foundation
import SwiftUI
import UniformTypeIdentifiers
struct EmojiPack: Identifiable, Codable {
var id: UUID
@@ -35,6 +36,22 @@ struct EmojiPack: Identifiable, Codable {
self.items.remove(at: index)
}
}
func shareLink() -> URL {
let scheme = URL(string: "stickerslack://")!
var url: URL = scheme.appendingPathComponent("pack", conformingTo: .directory)
let data = try! JSONEncoder().encode(items)
let queries: [URLQueryItem] = [
.init(name: "id", value: id.uuidString),
.init(name: "name", value: name),
.init(name: "description", value: description),
.init(name: "items", value: data.base64EncodedString())
]
url = url.appending(queryItems: queries)
print(url.path(percentEncoded: true))
return url
}
}
extension EmojiPack {
@@ -165,7 +165,7 @@ struct EmojiPackDetailView: View {
ToolbarSpacer()
}
ToolbarItem() {
ShareLink(item: URL(string: "stickerslack://")!) {
ShareLink(item: pack.shareLink()) {
Image(systemName: "square.and.arrow.up")
}
}
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.