Forgot credit EmojiText

This commit is contained in:
Lumaa 2024-01-28 17:49:08 +01:00
parent ce78d8f7e2
commit 49063f7d9a
5 changed files with 99 additions and 25 deletions

View File

@ -13,6 +13,7 @@ Threaded is a 100% free, made in SwiftUI, [#OpenSource](https://github.com/luma
- [IceCubesApp](https://github.com/dimillian/IceCubesApp) by [@dimillian](https://github.com/dimillian)
- [SwiftSoup](https://github.com/scinfu/SwiftSoup)
- [Nuke](https://github.com/kean/Nuke)
- [EmojiText](https://github.com/divadretlaw/EmojiText)
## To-do list

View File

@ -0,0 +1,3 @@
//Made by Lumaa
import Foundation

View File

@ -0,0 +1,94 @@
//Made by Lumaa
import Foundation
import SwiftUI
import UIKit
import UniformTypeIdentifiers
// Dimillian fixed it - https://mastodon.social/@dimillian/111708477095374920
struct ShareableOnlineImage: Codable, Transferable {
let url: URL
func fetchAsImage() -> Image {
let data = try? Data(contentsOf: url)
guard let data, let uiimage = UIImage(data: data) else {
return Image(systemName: "photo")
}
return Image(uiImage: uiimage)
}
static var transferRepresentation: some TransferRepresentation {
ProxyRepresentation { media in
media.fetchAsImage()
}
}
}
extension PostingView {
final class MovieFileTransferable: Transferable, Sendable {
let url: URL
init(url: URL) {
self.url = url
_ = url.startAccessingSecurityScopedResource()
}
deinit {
url.stopAccessingSecurityScopedResource()
}
static var transferRepresentation: some TransferRepresentation {
FileRepresentation(importedContentType: .movie) { receivedTransferrable in
return MovieFileTransferable(url: receivedTransferrable.file)
}
FileRepresentation(importedContentType: .video) { receivedTransferrable in
return MovieFileTransferable(url: receivedTransferrable.file)
}
}
}
final class GifFileTranseferable: Transferable, Sendable {
let url: URL
init(url: URL) {
self.url = url
_ = url.startAccessingSecurityScopedResource()
}
deinit {
url.stopAccessingSecurityScopedResource()
}
var data: Data? {
try? Data(contentsOf: url)
}
static var transferRepresentation: some TransferRepresentation {
FileRepresentation(importedContentType: .gif) { receivedTransferrable in
return GifFileTranseferable(url: receivedTransferrable.file)
}
}
}
}
extension PostingView {
final class ImageFileTranseferable: Transferable, Sendable {
public let url: URL
init(url: URL) {
self.url = url
_ = url.startAccessingSecurityScopedResource()
}
deinit {
url.stopAccessingSecurityScopedResource()
}
public static var transferRepresentation: some TransferRepresentation {
FileRepresentation(importedContentType: .image) { receivedTransferrable in
return ImageFileTranseferable(url: receivedTransferrable.file)
}
}
}
}

View File

@ -1,24 +0,0 @@
//Made by Lumaa
import Foundation
import SwiftUI
// Dimillian fixed it - https://mastodon.social/@dimillian/111708477095374920
struct ShareableOnlineImage: Codable, Transferable {
let url: URL
func fetchAsImage() -> Image {
let data = try? Data(contentsOf: url)
guard let data, let uiimage = UIImage(data: data) else {
return Image(systemName: "photo")
}
return Image(uiImage: uiimage)
}
static var transferRepresentation: some TransferRepresentation {
ProxyRepresentation { media in
media.fetchAsImage()
}
}
}

View File

@ -48,7 +48,7 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Threaded uses third-party open-source libraries and code:\n- [IceCubesApp](https://github.com/dimillian/IceCubesApp)\n- [SwiftSoup](https://github.com/scinfu/SwiftSoup)\n- [Nuke](https://github.com/kean/Nuke)"
"value" : "Threaded uses third-party open-source libraries and code:\n- [IceCubesApp](https://github.com/dimillian/IceCubesApp)\n- [SwiftSoup](https://github.com/scinfu/SwiftSoup)\n- [Nuke](https://github.com/kean/Nuke)\n- [EmojiText](https://github.com/divadretlaw/EmojiText)"
}
}
}