mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 22:56:24 +02:00
Store additional File Metadata in Gallery Entries
This commit is contained in:
@@ -2251,21 +2251,25 @@ class Account(
|
|||||||
idHex: String,
|
idHex: String,
|
||||||
url: String,
|
url: String,
|
||||||
relay: String?,
|
relay: String?,
|
||||||
|
blurhash: String?,
|
||||||
|
dim: String?,
|
||||||
|
hash: String?,
|
||||||
|
mimeType: String?,
|
||||||
) {
|
) {
|
||||||
if (!isWriteable()) return
|
if (!isWriteable()) return
|
||||||
ProfileGalleryEntryEvent.create(
|
ProfileGalleryEntryEvent.create(
|
||||||
url = url,
|
url = url,
|
||||||
eventid = idHex,
|
eventid = idHex,
|
||||||
relayhint = relay,
|
relayhint = relay,
|
||||||
|
blurhash = blurhash,
|
||||||
|
hash = hash,
|
||||||
|
dimensions = dim,
|
||||||
|
mimeType = mimeType,
|
||||||
/*magnetUri = magnetUri,
|
/*magnetUri = magnetUri,
|
||||||
mimeType = headerInfo.mimeType,
|
|
||||||
hash = headerInfo.hash,
|
|
||||||
size = headerInfo.size.toString(),
|
size = headerInfo.size.toString(),
|
||||||
dimensions = headerInfo.dim,
|
dimensions = headerInfo.dim,
|
||||||
blurhash = headerInfo.blurHash,
|
|
||||||
alt = alt,
|
alt = alt,
|
||||||
originalHash = originalHash,
|
originalHash = originalHash, */
|
||||||
sensitiveContent = sensitiveContent, */
|
|
||||||
signer = signer,
|
signer = signer,
|
||||||
) { event ->
|
) { event ->
|
||||||
Client.send(event)
|
Client.send(event)
|
||||||
|
@@ -824,7 +824,7 @@ private fun RenderVideoPlayer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnimatedShareButton(controllerVisible, Modifier.align(Alignment.TopEnd).padding(end = Size165dp)) { popupExpanded, toggle ->
|
AnimatedShareButton(controllerVisible, Modifier.align(Alignment.TopEnd).padding(end = Size165dp)) { popupExpanded, toggle ->
|
||||||
ShareImageAction(accountViewModel = accountViewModel, popupExpanded, videoUri, nostrUriCallback, toggle)
|
ShareImageAction(accountViewModel = accountViewModel, popupExpanded, videoUri, null, null, null, null, nostrUriCallback, toggle)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
controller.volume = 0f
|
controller.volume = 0f
|
||||||
|
@@ -605,6 +605,10 @@ fun ShareImageAction(
|
|||||||
popupExpanded = popupExpanded,
|
popupExpanded = popupExpanded,
|
||||||
videoUri = content.url,
|
videoUri = content.url,
|
||||||
postNostrUri = content.uri,
|
postNostrUri = content.uri,
|
||||||
|
blurhash = content.blurhash,
|
||||||
|
dim = content.dim,
|
||||||
|
hash = content.hash,
|
||||||
|
mimeType = content.mimeType,
|
||||||
onDismiss = onDismiss,
|
onDismiss = onDismiss,
|
||||||
)
|
)
|
||||||
} else if (content is MediaPreloadedContent) {
|
} else if (content is MediaPreloadedContent) {
|
||||||
@@ -613,6 +617,10 @@ fun ShareImageAction(
|
|||||||
popupExpanded = popupExpanded,
|
popupExpanded = popupExpanded,
|
||||||
videoUri = content.localFile?.toUri().toString(),
|
videoUri = content.localFile?.toUri().toString(),
|
||||||
postNostrUri = content.uri,
|
postNostrUri = content.uri,
|
||||||
|
blurhash = content.blurhash,
|
||||||
|
dim = content.dim,
|
||||||
|
hash = null,
|
||||||
|
mimeType = content.mimeType,
|
||||||
onDismiss = onDismiss,
|
onDismiss = onDismiss,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -625,6 +633,10 @@ fun ShareImageAction(
|
|||||||
popupExpanded: MutableState<Boolean>,
|
popupExpanded: MutableState<Boolean>,
|
||||||
videoUri: String?,
|
videoUri: String?,
|
||||||
postNostrUri: String?,
|
postNostrUri: String?,
|
||||||
|
blurhash: String?,
|
||||||
|
dim: String?,
|
||||||
|
hash: String?,
|
||||||
|
mimeType: String?,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
) {
|
) {
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
@@ -660,7 +672,7 @@ fun ShareImageAction(
|
|||||||
if (videoUri != null) {
|
if (videoUri != null) {
|
||||||
var n19 = Nip19Bech32.uriToRoute(postNostrUri)?.entity as? Nip19Bech32.NEvent
|
var n19 = Nip19Bech32.uriToRoute(postNostrUri)?.entity as? Nip19Bech32.NEvent
|
||||||
if (n19 != null) {
|
if (n19 != null) {
|
||||||
accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay[0]) // TODO Whole list or first?
|
accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay[0], blurhash, dim, hash, mimeType) // TODO Whole list or first?
|
||||||
accountViewModel.toast(R.string.image_saved_to_the_gallery, R.string.image_saved_to_the_gallery)
|
accountViewModel.toast(R.string.image_saved_to_the_gallery, R.string.image_saved_to_the_gallery)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -673,8 +673,12 @@ class AccountViewModel(
|
|||||||
hex: String,
|
hex: String,
|
||||||
url: String,
|
url: String,
|
||||||
relay: String?,
|
relay: String?,
|
||||||
|
blurhash: String?,
|
||||||
|
dim: String?,
|
||||||
|
hash: String?,
|
||||||
|
mimeType: String?,
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch(Dispatchers.IO) { account.addToGallery(hex, url, relay) }
|
viewModelScope.launch(Dispatchers.IO) { account.addToGallery(hex, url, relay, blurhash, dim, hash, mimeType) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun removefromMediaGallery(note: Note) {
|
fun removefromMediaGallery(note: Note) {
|
||||||
|
Reference in New Issue
Block a user