mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-18 05:41:56 +01:00
Merge pull request #985 from believethehype/main
Store additional File Metadata in Gallery Entries
This commit is contained in:
commit
bb127506c7
@ -2251,21 +2251,25 @@ class Account(
|
||||
idHex: String,
|
||||
url: String,
|
||||
relay: String?,
|
||||
blurhash: String?,
|
||||
dim: String?,
|
||||
hash: String?,
|
||||
mimeType: String?,
|
||||
) {
|
||||
if (!isWriteable()) return
|
||||
ProfileGalleryEntryEvent.create(
|
||||
url = url,
|
||||
eventid = idHex,
|
||||
relayhint = relay,
|
||||
blurhash = blurhash,
|
||||
hash = hash,
|
||||
dimensions = dim,
|
||||
mimeType = mimeType,
|
||||
/*magnetUri = magnetUri,
|
||||
mimeType = headerInfo.mimeType,
|
||||
hash = headerInfo.hash,
|
||||
size = headerInfo.size.toString(),
|
||||
dimensions = headerInfo.dim,
|
||||
blurhash = headerInfo.blurHash,
|
||||
alt = alt,
|
||||
originalHash = originalHash,
|
||||
sensitiveContent = sensitiveContent, */
|
||||
originalHash = originalHash, */
|
||||
signer = signer,
|
||||
) { event ->
|
||||
Client.send(event)
|
||||
|
@ -824,7 +824,7 @@ private fun RenderVideoPlayer(
|
||||
}
|
||||
|
||||
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 {
|
||||
controller.volume = 0f
|
||||
|
@ -605,6 +605,10 @@ fun ShareImageAction(
|
||||
popupExpanded = popupExpanded,
|
||||
videoUri = content.url,
|
||||
postNostrUri = content.uri,
|
||||
blurhash = content.blurhash,
|
||||
dim = content.dim,
|
||||
hash = content.hash,
|
||||
mimeType = content.mimeType,
|
||||
onDismiss = onDismiss,
|
||||
)
|
||||
} else if (content is MediaPreloadedContent) {
|
||||
@ -613,6 +617,10 @@ fun ShareImageAction(
|
||||
popupExpanded = popupExpanded,
|
||||
videoUri = content.localFile?.toUri().toString(),
|
||||
postNostrUri = content.uri,
|
||||
blurhash = content.blurhash,
|
||||
dim = content.dim,
|
||||
hash = null,
|
||||
mimeType = content.mimeType,
|
||||
onDismiss = onDismiss,
|
||||
)
|
||||
}
|
||||
@ -625,6 +633,10 @@ fun ShareImageAction(
|
||||
popupExpanded: MutableState<Boolean>,
|
||||
videoUri: String?,
|
||||
postNostrUri: String?,
|
||||
blurhash: String?,
|
||||
dim: String?,
|
||||
hash: String?,
|
||||
mimeType: String?,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
DropdownMenu(
|
||||
@ -660,7 +672,7 @@ fun ShareImageAction(
|
||||
if (videoUri != null) {
|
||||
var n19 = Nip19Bech32.uriToRoute(postNostrUri)?.entity as? Nip19Bech32.NEvent
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
@ -673,8 +673,12 @@ class AccountViewModel(
|
||||
hex: String,
|
||||
url: 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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user