Correcly copy pasting NIP94 and NIP95 addresses.
This commit is contained in:
@@ -80,25 +80,29 @@ abstract class ZoomableContent(
|
|||||||
abstract class ZoomableUrlContent(
|
abstract class ZoomableUrlContent(
|
||||||
val url: String,
|
val url: String,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
val hash: String? = null
|
val hash: String? = null,
|
||||||
|
val uri: String? = null
|
||||||
) : ZoomableContent(description)
|
) : ZoomableContent(description)
|
||||||
|
|
||||||
class ZoomableUrlImage(
|
class ZoomableUrlImage(
|
||||||
url: String,
|
url: String,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
hash: String? = null,
|
hash: String? = null,
|
||||||
val bluehash: String? = null
|
val bluehash: String? = null,
|
||||||
) : ZoomableUrlContent(url, description, hash)
|
uri: String? = null
|
||||||
|
) : ZoomableUrlContent(url, description, hash, uri)
|
||||||
|
|
||||||
class ZoomableUrlVideo(
|
class ZoomableUrlVideo(
|
||||||
url: String,
|
url: String,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
hash: String? = null
|
hash: String? = null,
|
||||||
) : ZoomableUrlContent(url, description, hash)
|
uri: String? = null
|
||||||
|
) : ZoomableUrlContent(url, description, hash, uri)
|
||||||
|
|
||||||
abstract class ZoomablePreloadedContent(
|
abstract class ZoomablePreloadedContent(
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
val isVerified: Boolean? = null
|
val isVerified: Boolean? = null,
|
||||||
|
val uri: String
|
||||||
) : ZoomableContent(description)
|
) : ZoomableContent(description)
|
||||||
|
|
||||||
class ZoomableBitmapImage(
|
class ZoomableBitmapImage(
|
||||||
@@ -106,15 +110,17 @@ class ZoomableBitmapImage(
|
|||||||
val mimeType: String? = null,
|
val mimeType: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
val bluehash: String? = null,
|
val bluehash: String? = null,
|
||||||
isVerified: Boolean? = null
|
isVerified: Boolean? = null,
|
||||||
) : ZoomablePreloadedContent(description, isVerified)
|
uri: String
|
||||||
|
) : ZoomablePreloadedContent(description, isVerified, uri)
|
||||||
|
|
||||||
class ZoomableBytesVideo(
|
class ZoomableBytesVideo(
|
||||||
val byteArray: ByteArray,
|
val byteArray: ByteArray,
|
||||||
val mimeType: String? = null,
|
val mimeType: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
isVerified: Boolean? = null
|
isVerified: Boolean? = null,
|
||||||
) : ZoomablePreloadedContent(description, isVerified)
|
uri: String
|
||||||
|
) : ZoomablePreloadedContent(description, isVerified, uri)
|
||||||
|
|
||||||
fun figureOutMimeType(fullUrl: String): ZoomableContent {
|
fun figureOutMimeType(fullUrl: String): ZoomableContent {
|
||||||
val removedParamsFromUrl = fullUrl.split("?")[0].lowercase()
|
val removedParamsFromUrl = fullUrl.split("?")[0].lowercase()
|
||||||
@@ -189,7 +195,17 @@ fun ZoomableContentView(content: ZoomableContent, images: List<ZoomableContent>
|
|||||||
if (content is ZoomableUrlContent) {
|
if (content is ZoomableUrlContent) {
|
||||||
mainImageModifier = mainImageModifier.combinedClickable(
|
mainImageModifier = mainImageModifier.combinedClickable(
|
||||||
onClick = { dialogOpen = true },
|
onClick = { dialogOpen = true },
|
||||||
onLongClick = { clipboardManager.setText(AnnotatedString(content.url)) }
|
onLongClick = { clipboardManager.setText(AnnotatedString(content.uri ?: content.url)) }
|
||||||
|
)
|
||||||
|
} else if (content is ZoomableBitmapImage) {
|
||||||
|
mainImageModifier = mainImageModifier.combinedClickable(
|
||||||
|
onClick = { dialogOpen = true },
|
||||||
|
onLongClick = { clipboardManager.setText(AnnotatedString(content.uri)) }
|
||||||
|
)
|
||||||
|
} else if (content is ZoomableBytesVideo) {
|
||||||
|
mainImageModifier = mainImageModifier.combinedClickable(
|
||||||
|
onClick = { dialogOpen = true },
|
||||||
|
onLongClick = { clipboardManager.setText(AnnotatedString(content.uri)) }
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
mainImageModifier = mainImageModifier.clickable {
|
mainImageModifier = mainImageModifier.clickable {
|
||||||
|
|||||||
@@ -795,10 +795,11 @@ fun FileHeaderDisplay(note: Note) {
|
|||||||
val removedParamsFromUrl = fullUrl.split("?")[0].lowercase()
|
val removedParamsFromUrl = fullUrl.split("?")[0].lowercase()
|
||||||
val isImage = imageExtensions.any { removedParamsFromUrl.endsWith(it) }
|
val isImage = imageExtensions.any { removedParamsFromUrl.endsWith(it) }
|
||||||
val isVideo = videoExtensions.any { removedParamsFromUrl.endsWith(it) }
|
val isVideo = videoExtensions.any { removedParamsFromUrl.endsWith(it) }
|
||||||
|
val uri = "nostr:" + note.toNEvent()
|
||||||
content = if (isImage) {
|
content = if (isImage) {
|
||||||
ZoomableUrlImage(fullUrl, description, hash, blurHash)
|
ZoomableUrlImage(fullUrl, description, hash, blurHash, uri)
|
||||||
} else {
|
} else {
|
||||||
ZoomableUrlVideo(fullUrl, description, hash)
|
ZoomableUrlVideo(fullUrl, description, hash, uri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -823,16 +824,17 @@ fun FileStorageHeaderDisplay(baseNote: Note) {
|
|||||||
|
|
||||||
LaunchedEffect(key1 = eventHeader.id, key2 = noteState) {
|
LaunchedEffect(key1 = eventHeader.id, key2 = noteState) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
|
val uri = "nostr:" + baseNote.toNEvent()
|
||||||
val bytes = eventBytes?.decode()
|
val bytes = eventBytes?.decode()
|
||||||
val blurHash = eventHeader.blurhash()
|
val blurHash = eventHeader.blurhash()
|
||||||
val description = eventHeader.content
|
val description = eventHeader.content
|
||||||
val mimeType = eventHeader.mimeType()
|
val mimeType = eventHeader.mimeType()
|
||||||
|
|
||||||
content = if (mimeType?.startsWith("image") == true) {
|
content = if (mimeType?.startsWith("image") == true) {
|
||||||
ZoomableBitmapImage(bytes, mimeType, description, blurHash, true)
|
ZoomableBitmapImage(bytes, mimeType, description, blurHash, true, uri)
|
||||||
} else {
|
} else {
|
||||||
if (bytes != null) {
|
if (bytes != null) {
|
||||||
ZoomableBytesVideo(bytes, mimeType, description, true)
|
ZoomableBytesVideo(bytes, mimeType, description, true, uri)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user