Merge pull request #1409 from davotoula/1406-display-app-picture-when-clicked-on-app-picture
Display app picture when clicked on app picture
This commit is contained in:
@@ -91,16 +91,16 @@ fun RenderAppDefinition(
|
|||||||
withContext(Dispatchers.Default) { metadata = noteEvent.appMetaData() }
|
withContext(Dispatchers.Default) { metadata = noteEvent.appMetaData() }
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata?.let {
|
metadata?.let { theAppMetadata ->
|
||||||
Box {
|
Box {
|
||||||
val clipboardManager = LocalClipboardManager.current
|
val clipboardManager = LocalClipboardManager.current
|
||||||
val uri = LocalUriHandler.current
|
val uri = LocalUriHandler.current
|
||||||
|
|
||||||
if (!it.banner.isNullOrBlank()) {
|
if (!theAppMetadata.banner.isNullOrBlank()) {
|
||||||
var zoomImageDialogOpen by remember { mutableStateOf(false) }
|
var zoomImageDialogOpen by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = it.banner,
|
model = theAppMetadata.banner,
|
||||||
contentDescription = stringRes(id = R.string.profile_image),
|
contentDescription = stringRes(id = R.string.profile_image),
|
||||||
contentScale = ContentScale.FillWidth,
|
contentScale = ContentScale.FillWidth,
|
||||||
modifier =
|
modifier =
|
||||||
@@ -109,13 +109,13 @@ fun RenderAppDefinition(
|
|||||||
.height(125.dp)
|
.height(125.dp)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = {},
|
onClick = {},
|
||||||
onLongClick = { clipboardManager.setText(AnnotatedString(it.banner!!)) },
|
onLongClick = { clipboardManager.setText(AnnotatedString(theAppMetadata.banner!!)) },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (zoomImageDialogOpen) {
|
if (zoomImageDialogOpen) {
|
||||||
ZoomableImageDialog(
|
ZoomableImageDialog(
|
||||||
imageUrl = RichTextParser.parseImageOrVideo(it.banner!!),
|
imageUrl = RichTextParser.parseImageOrVideo(theAppMetadata.banner!!),
|
||||||
onDismiss = { zoomImageDialogOpen = false },
|
onDismiss = { zoomImageDialogOpen = false },
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
)
|
)
|
||||||
@@ -144,12 +144,11 @@ fun RenderAppDefinition(
|
|||||||
verticalAlignment = Alignment.Bottom,
|
verticalAlignment = Alignment.Bottom,
|
||||||
) {
|
) {
|
||||||
var zoomImageDialogOpen by remember { mutableStateOf(false) }
|
var zoomImageDialogOpen by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Box(Modifier.size(100.dp)) {
|
Box(Modifier.size(100.dp)) {
|
||||||
it.picture?.let { picture ->
|
theAppMetadata.picture?.let { picture ->
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = picture,
|
model = picture,
|
||||||
contentDescription = it.name,
|
contentDescription = theAppMetadata.name,
|
||||||
contentScale = ContentScale.FillWidth,
|
contentScale = ContentScale.FillWidth,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
@@ -165,15 +164,15 @@ fun RenderAppDefinition(
|
|||||||
onLongClick = { clipboardManager.setText(AnnotatedString(picture)) },
|
onLongClick = { clipboardManager.setText(AnnotatedString(picture)) },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zoomImageDialogOpen) {
|
if (zoomImageDialogOpen) {
|
||||||
ZoomableImageDialog(
|
ZoomableImageDialog(
|
||||||
imageUrl = RichTextParser.parseImageOrVideo(it.banner!!),
|
imageUrl = RichTextParser.parseImageOrVideo(theAppMetadata.picture!!),
|
||||||
onDismiss = { zoomImageDialogOpen = false },
|
onDismiss = { zoomImageDialogOpen = false },
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.weight(1f))
|
Spacer(Modifier.weight(1f))
|
||||||
@@ -186,7 +185,7 @@ fun RenderAppDefinition(
|
|||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
val name = remember(it) { it.anyName() }
|
val name = remember(theAppMetadata) { theAppMetadata.anyName() }
|
||||||
name?.let {
|
name?.let {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.Bottom,
|
verticalAlignment = Alignment.Bottom,
|
||||||
@@ -204,7 +203,7 @@ fun RenderAppDefinition(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val website = remember(it) { it.website }
|
val website = remember(theAppMetadata) { theAppMetadata.website }
|
||||||
if (!website.isNullOrEmpty()) {
|
if (!website.isNullOrEmpty()) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
LinkIcon(Size16Modifier, MaterialTheme.colorScheme.placeholderText)
|
LinkIcon(Size16Modifier, MaterialTheme.colorScheme.placeholderText)
|
||||||
@@ -217,7 +216,7 @@ fun RenderAppDefinition(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
it.about?.let {
|
theAppMetadata.about?.let {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(top = 5.dp, bottom = 5.dp),
|
modifier = Modifier.padding(top = 5.dp, bottom = 5.dp),
|
||||||
) {
|
) {
|
||||||
|
|||||||
+2
-2
@@ -113,8 +113,8 @@ class AppMetadata {
|
|||||||
fun toJson() = assemble(this)
|
fun toJson() = assemble(this)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun assemble(data: AppMetadata) = JsonMapper.mapper.writeValueAsString(data)
|
fun assemble(data: AppMetadata): String = JsonMapper.mapper.writeValueAsString(data)
|
||||||
|
|
||||||
fun parse(content: String) = JsonMapper.mapper.readValue(content, AppMetadata::class.java)
|
fun parse(content: String): AppMetadata = JsonMapper.mapper.readValue(content, AppMetadata::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user