Minor refactoring.
This commit is contained in:
@@ -90,12 +90,12 @@ fun RobohashFallbackAsyncImage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isBase64) {
|
if (isBase64) {
|
||||||
val painter = rememberAsyncImagePainter(
|
val base64Painter = rememberAsyncImagePainter(
|
||||||
model = Base64Requester.imageRequest(context, model)
|
model = Base64Requester.imageRequest(context, model)
|
||||||
)
|
)
|
||||||
|
|
||||||
Image(
|
Image(
|
||||||
painter = painter,
|
painter = base64Painter,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
alignment = alignment,
|
alignment = alignment,
|
||||||
@@ -129,33 +129,6 @@ fun RobohashFallbackAsyncImage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun RobohashAsyncImageProxy(
|
|
||||||
robot: String,
|
|
||||||
model: String?,
|
|
||||||
contentDescription: String?,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
alignment: Alignment = Alignment.Center,
|
|
||||||
contentScale: ContentScale = ContentScale.Fit,
|
|
||||||
alpha: Float = DefaultAlpha,
|
|
||||||
colorFilter: ColorFilter? = null,
|
|
||||||
filterQuality: FilterQuality = DrawScope.DefaultFilterQuality,
|
|
||||||
loadProfilePicture: Boolean
|
|
||||||
) {
|
|
||||||
RobohashFallbackAsyncImage(
|
|
||||||
robot = robot,
|
|
||||||
model = model,
|
|
||||||
contentDescription = contentDescription,
|
|
||||||
modifier = modifier,
|
|
||||||
alignment = alignment,
|
|
||||||
contentScale = contentScale,
|
|
||||||
alpha = alpha,
|
|
||||||
colorFilter = colorFilter,
|
|
||||||
filterQuality = filterQuality,
|
|
||||||
loadProfilePicture = loadProfilePicture
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
object Base64Requester {
|
object Base64Requester {
|
||||||
fun imageRequest(context: Context, message: String): ImageRequest {
|
fun imageRequest(context: Context, message: String): ImageRequest {
|
||||||
return ImageRequest
|
return ImageRequest
|
||||||
|
|||||||
+2
-2
@@ -48,7 +48,7 @@ import com.vitorpamplona.amethyst.R
|
|||||||
import com.vitorpamplona.amethyst.model.LocalCache
|
import com.vitorpamplona.amethyst.model.LocalCache
|
||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
|
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
|
||||||
import com.vitorpamplona.amethyst.ui.note.toShortenHex
|
import com.vitorpamplona.amethyst.ui.note.toShortenHex
|
||||||
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
|
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
|
||||||
@@ -220,7 +220,7 @@ private fun ActiveMarker(acc: AccountInfo, accountViewModel: AccountViewModel) {
|
|||||||
private fun AccountPicture(user: User, loadProfilePicture: Boolean) {
|
private fun AccountPicture(user: User, loadProfilePicture: Boolean) {
|
||||||
val profilePicture by user.live().profilePictureChanges.observeAsState()
|
val profilePicture by user.live().profilePictureChanges.observeAsState()
|
||||||
|
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = remember(user) { user.pubkeyHex },
|
robot = remember(user) { user.pubkeyHex },
|
||||||
model = profilePicture,
|
model = profilePicture,
|
||||||
contentDescription = stringResource(R.string.profile_image),
|
contentDescription = stringResource(R.string.profile_image),
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ import com.vitorpamplona.amethyst.service.NostrVideoDataSource
|
|||||||
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
||||||
import com.vitorpamplona.amethyst.service.relays.Client
|
import com.vitorpamplona.amethyst.service.relays.Client
|
||||||
import com.vitorpamplona.amethyst.service.relays.RelayPool
|
import com.vitorpamplona.amethyst.service.relays.RelayPool
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.note.AmethystIcon
|
import com.vitorpamplona.amethyst.ui.note.AmethystIcon
|
||||||
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
|
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
|
||||||
import com.vitorpamplona.amethyst.ui.note.ClickableUserPicture
|
import com.vitorpamplona.amethyst.ui.note.ClickableUserPicture
|
||||||
@@ -526,7 +526,7 @@ private fun LoggedInUserPictureDrawer(
|
|||||||
IconButton(
|
IconButton(
|
||||||
onClick = onClick
|
onClick = onClick
|
||||||
) {
|
) {
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = pubkeyHex,
|
robot = pubkeyHex,
|
||||||
model = profilePicture,
|
model = profilePicture,
|
||||||
contentDescription = stringResource(id = R.string.profile_image),
|
contentDescription = stringResource(id = R.string.profile_image),
|
||||||
|
|||||||
@@ -67,8 +67,9 @@ import com.vitorpamplona.amethyst.service.relays.RelayPool
|
|||||||
import com.vitorpamplona.amethyst.service.relays.RelayPoolStatus
|
import com.vitorpamplona.amethyst.service.relays.RelayPoolStatus
|
||||||
import com.vitorpamplona.amethyst.ui.actions.NewRelayListView
|
import com.vitorpamplona.amethyst.ui.actions.NewRelayListView
|
||||||
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.note.LoadStatuses
|
import com.vitorpamplona.amethyst.ui.note.LoadStatuses
|
||||||
|
import com.vitorpamplona.amethyst.ui.qrcode.ShowQRDialog
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountBackupDialog
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountBackupDialog
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ConnectOrbotDialog
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ConnectOrbotDialog
|
||||||
@@ -204,7 +205,7 @@ fun ProfileContentTemplate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier) {
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = profilePubHex,
|
robot = profilePubHex,
|
||||||
model = profilePicture,
|
model = profilePicture,
|
||||||
contentDescription = stringResource(id = R.string.profile_image),
|
contentDescription = stringResource(id = R.string.profile_image),
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import com.vitorpamplona.amethyst.model.Channel
|
|||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ChatHeadlineBorders
|
import com.vitorpamplona.amethyst.ui.theme.ChatHeadlineBorders
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
@@ -450,7 +450,7 @@ fun ChannelName(
|
|||||||
) {
|
) {
|
||||||
ChannelName(
|
ChannelName(
|
||||||
channelPicture = {
|
channelPicture = {
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = channelIdHex,
|
robot = channelIdHex,
|
||||||
model = channelPicture,
|
model = channelPicture,
|
||||||
contentDescription = stringResource(R.string.channel_image),
|
contentDescription = stringResource(R.string.channel_image),
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import com.vitorpamplona.amethyst.model.Note
|
|||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.components.CreateClickableTextWithEmoji
|
import com.vitorpamplona.amethyst.ui.components.CreateClickableTextWithEmoji
|
||||||
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
||||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
@@ -784,7 +784,7 @@ private fun UserIcon(
|
|||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
route: String
|
route: String
|
||||||
) {
|
) {
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = pubkeyHex,
|
robot = pubkeyHex,
|
||||||
model = userProfilePicture,
|
model = userProfilePicture,
|
||||||
contentDescription = stringResource(id = R.string.profile_image),
|
contentDescription = stringResource(id = R.string.profile_image),
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import com.vitorpamplona.amethyst.model.Note
|
|||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.components.ImageUrlType
|
import com.vitorpamplona.amethyst.ui.components.ImageUrlType
|
||||||
import com.vitorpamplona.amethyst.ui.components.InLineIconRenderer
|
import com.vitorpamplona.amethyst.ui.components.InLineIconRenderer
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||||
import com.vitorpamplona.amethyst.ui.screen.CombinedZap
|
import com.vitorpamplona.amethyst.ui.screen.CombinedZap
|
||||||
import com.vitorpamplona.amethyst.ui.screen.MultiSetCard
|
import com.vitorpamplona.amethyst.ui.screen.MultiSetCard
|
||||||
@@ -529,7 +529,7 @@ fun WatchUserMetadataAndFollowsAndRenderUserProfilePicture(
|
|||||||
|
|
||||||
WatchUserMetadata(author) { baseUserPicture ->
|
WatchUserMetadata(author) { baseUserPicture ->
|
||||||
// Crossfade(targetState = baseUserPicture) { userPicture ->
|
// Crossfade(targetState = baseUserPicture) { userPicture ->
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = author.pubkeyHex,
|
robot = author.pubkeyHex,
|
||||||
model = baseUserPicture,
|
model = baseUserPicture,
|
||||||
contentDescription = stringResource(id = R.string.profile_image),
|
contentDescription = stringResource(id = R.string.profile_image),
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ import com.vitorpamplona.amethyst.ui.components.LoadNote
|
|||||||
import com.vitorpamplona.amethyst.ui.components.LoadThumbAndThenVideoView
|
import com.vitorpamplona.amethyst.ui.components.LoadThumbAndThenVideoView
|
||||||
import com.vitorpamplona.amethyst.ui.components.MeasureSpaceWidth
|
import com.vitorpamplona.amethyst.ui.components.MeasureSpaceWidth
|
||||||
import com.vitorpamplona.amethyst.ui.components.ObserveDisplayNip05Status
|
import com.vitorpamplona.amethyst.ui.components.ObserveDisplayNip05Status
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
||||||
import com.vitorpamplona.amethyst.ui.components.ShowMoreButton
|
import com.vitorpamplona.amethyst.ui.components.ShowMoreButton
|
||||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||||
@@ -739,7 +739,7 @@ fun ShortCommunityHeader(baseNote: AddressableNote, accountViewModel: AccountVie
|
|||||||
|
|
||||||
Row(verticalAlignment = CenterVertically) {
|
Row(verticalAlignment = CenterVertically) {
|
||||||
noteEvent.image()?.let {
|
noteEvent.image()?.let {
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = baseNote.idHex,
|
robot = baseNote.idHex,
|
||||||
model = it,
|
model = it,
|
||||||
contentDescription = stringResource(R.string.profile_image),
|
contentDescription = stringResource(R.string.profile_image),
|
||||||
@@ -2896,7 +2896,7 @@ private fun ChannelNotePicture(baseChannel: Channel, loadProfilePicture: Boolean
|
|||||||
}
|
}
|
||||||
|
|
||||||
Box(Size30Modifier) {
|
Box(Size30Modifier) {
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = baseChannel.idHex,
|
robot = baseChannel.idHex,
|
||||||
model = model,
|
model = model,
|
||||||
contentDescription = stringResource(R.string.group_picture),
|
contentDescription = stringResource(R.string.group_picture),
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import com.vitorpamplona.amethyst.R
|
|||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImage
|
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ReportNoteDialog
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.ReportNoteDialog
|
||||||
import com.vitorpamplona.quartz.encoders.HexKey
|
import com.vitorpamplona.quartz.encoders.HexKey
|
||||||
@@ -336,7 +336,7 @@ fun InnerUserPicture(
|
|||||||
accountViewModel.settings.showProfilePictures.value
|
accountViewModel.settings.showProfilePictures.value
|
||||||
}
|
}
|
||||||
|
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = userHex,
|
robot = userHex,
|
||||||
model = userPicture,
|
model = userPicture,
|
||||||
contentDescription = stringResource(id = R.string.profile_image),
|
contentDescription = stringResource(id = R.string.profile_image),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.navigation
|
package com.vitorpamplona.amethyst.ui.qrcode
|
||||||
|
|
||||||
import androidx.compose.foundation.Canvas
|
import androidx.compose.foundation.Canvas
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
@@ -19,6 +19,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.graphics.Path
|
import androidx.compose.ui.graphics.Path
|
||||||
import androidx.compose.ui.graphics.PathFillType
|
import androidx.compose.ui.graphics.PathFillType
|
||||||
import androidx.compose.ui.graphics.drawscope.DrawScope
|
import androidx.compose.ui.graphics.drawscope.DrawScope
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.google.zxing.EncodeHintType
|
import com.google.zxing.EncodeHintType
|
||||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||||
@@ -28,6 +29,12 @@ import com.google.zxing.qrcode.encoder.QRCode
|
|||||||
|
|
||||||
const val QR_MARGIN_PX = 100f
|
const val QR_MARGIN_PX = 100f
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun QrCodeDrawerPreview() {
|
||||||
|
QrCodeDrawer("Test QR data")
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun QrCodeDrawer(contents: String, modifier: Modifier = Modifier) {
|
fun QrCodeDrawer(contents: String, modifier: Modifier = Modifier) {
|
||||||
val qrCode = remember(contents) {
|
val qrCode = remember(contents) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.navigation
|
package com.vitorpamplona.amethyst.ui.qrcode
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.border
|
||||||
@@ -27,6 +27,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
@@ -35,11 +36,32 @@ import com.vitorpamplona.amethyst.R
|
|||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.actions.CloseButton
|
import com.vitorpamplona.amethyst.ui.actions.CloseButton
|
||||||
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
import com.vitorpamplona.amethyst.ui.components.CreateTextWithEmoji
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.qrcode.NIP19QrCodeScanner
|
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size35dp
|
import com.vitorpamplona.amethyst.ui.theme.Size35dp
|
||||||
|
import com.vitorpamplona.quartz.events.UserMetadata
|
||||||
import com.vitorpamplona.quartz.events.toImmutableListOfLists
|
import com.vitorpamplona.quartz.events.toImmutableListOfLists
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun ShowQRDialogPreview() {
|
||||||
|
val user = User("460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c")
|
||||||
|
|
||||||
|
user.info = UserMetadata().apply {
|
||||||
|
name = "My Name"
|
||||||
|
picture = "Picture"
|
||||||
|
banner = "http://banner.com/test"
|
||||||
|
website = "http://mywebsite.com/test"
|
||||||
|
about = "This is the about me"
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowQRDialog(
|
||||||
|
user = user,
|
||||||
|
loadProfilePicture = false,
|
||||||
|
onScan = {},
|
||||||
|
onClose = {}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ShowQRDialog(user: User, loadProfilePicture: Boolean, onScan: (String) -> Unit, onClose: () -> Unit) {
|
fun ShowQRDialog(user: User, loadProfilePicture: Boolean, onScan: (String) -> Unit, onClose: () -> Unit) {
|
||||||
var presenting by remember { mutableStateOf(true) }
|
var presenting by remember { mutableStateOf(true) }
|
||||||
@@ -48,16 +70,10 @@ fun ShowQRDialog(user: User, loadProfilePicture: Boolean, onScan: (String) -> Un
|
|||||||
onDismissRequest = onClose,
|
onDismissRequest = onClose,
|
||||||
properties = DialogProperties(usePlatformDefaultWidth = false)
|
properties = DialogProperties(usePlatformDefaultWidth = false)
|
||||||
) {
|
) {
|
||||||
Surface(modifier = Modifier.fillMaxSize()) {
|
Surface {
|
||||||
Column(
|
Column {
|
||||||
modifier = Modifier
|
|
||||||
.background(MaterialTheme.colorScheme.background)
|
|
||||||
.fillMaxSize()
|
|
||||||
) {
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier.padding(10.dp),
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(10.dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
@@ -65,15 +81,16 @@ fun ShowQRDialog(user: User, loadProfilePicture: Boolean, onScan: (String) -> Un
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize().padding(horizontal = 10.dp),
|
||||||
.fillMaxSize()
|
|
||||||
.padding(horizontal = 10.dp),
|
|
||||||
verticalArrangement = Arrangement.SpaceAround
|
verticalArrangement = Arrangement.SpaceAround
|
||||||
) {
|
) {
|
||||||
if (presenting) {
|
if (presenting) {
|
||||||
Column(modifier = Modifier.fillMaxWidth()) {
|
Column() {
|
||||||
Row(horizontalArrangement = Arrangement.Center, modifier = Modifier.fillMaxWidth()) {
|
Row(
|
||||||
RobohashAsyncImageProxy(
|
horizontalArrangement = Arrangement.Center,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
RobohashFallbackAsyncImage(
|
||||||
robot = user.pubkeyHex,
|
robot = user.pubkeyHex,
|
||||||
model = user.profilePicture(),
|
model = user.profilePicture(),
|
||||||
contentDescription = stringResource(R.string.profile_image),
|
contentDescription = stringResource(R.string.profile_image),
|
||||||
@@ -86,7 +103,10 @@ fun ShowQRDialog(user: User, loadProfilePicture: Boolean, onScan: (String) -> Un
|
|||||||
loadProfilePicture = loadProfilePicture
|
loadProfilePicture = loadProfilePicture
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Row(horizontalArrangement = Arrangement.Center, modifier = Modifier.fillMaxWidth().padding(top = 5.dp)) {
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.Center,
|
||||||
|
modifier = Modifier.fillMaxWidth().padding(top = 5.dp)
|
||||||
|
) {
|
||||||
CreateTextWithEmoji(
|
CreateTextWithEmoji(
|
||||||
text = user.bestDisplayName() ?: user.bestUsername() ?: "",
|
text = user.bestDisplayName() ?: user.bestUsername() ?: "",
|
||||||
tags = user.info?.latestMetadata?.tags?.toImmutableListOfLists(),
|
tags = user.info?.latestMetadata?.tags?.toImmutableListOfLists(),
|
||||||
@@ -98,25 +118,16 @@ fun ShowQRDialog(user: User, loadProfilePicture: Boolean, onScan: (String) -> Un
|
|||||||
|
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth().padding(horizontal = Size35dp)
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = Size35dp)
|
|
||||||
) {
|
) {
|
||||||
QrCodeDrawer("nostr:${user.pubkeyNpub()}")
|
QrCodeDrawer("nostr:${user.pubkeyNpub()}")
|
||||||
}
|
}
|
||||||
|
|
||||||
Row(
|
Row(modifier = Modifier.padding(horizontal = 30.dp)) {
|
||||||
horizontalArrangement = Arrangement.Center,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 30.dp)
|
|
||||||
) {
|
|
||||||
Button(
|
Button(
|
||||||
onClick = { presenting = false },
|
onClick = { presenting = false },
|
||||||
shape = RoundedCornerShape(Size35dp),
|
shape = RoundedCornerShape(Size35dp),
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth().height(50.dp),
|
||||||
.fillMaxWidth()
|
|
||||||
.height(50.dp),
|
|
||||||
colors = ButtonDefaults
|
colors = ButtonDefaults
|
||||||
.buttonColors(
|
.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ import com.vitorpamplona.amethyst.ui.actions.NewPostViewModel
|
|||||||
import com.vitorpamplona.amethyst.ui.actions.ServerOption
|
import com.vitorpamplona.amethyst.ui.actions.ServerOption
|
||||||
import com.vitorpamplona.amethyst.ui.actions.UploadFromGallery
|
import com.vitorpamplona.amethyst.ui.actions.UploadFromGallery
|
||||||
import com.vitorpamplona.amethyst.ui.components.LoadNote
|
import com.vitorpamplona.amethyst.ui.components.LoadNote
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
import com.vitorpamplona.amethyst.ui.components.SensitivityWarning
|
||||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||||
import com.vitorpamplona.amethyst.ui.components.ZoomableContentView
|
import com.vitorpamplona.amethyst.ui.components.ZoomableContentView
|
||||||
@@ -699,7 +699,7 @@ fun ShortChannelHeader(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
channel.profilePicture()?.let {
|
channel.profilePicture()?.let {
|
||||||
RobohashAsyncImageProxy(
|
RobohashFallbackAsyncImage(
|
||||||
robot = channel.idHex,
|
robot = channel.idHex,
|
||||||
model = it,
|
model = it,
|
||||||
contentDescription = stringResource(R.string.profile_image),
|
contentDescription = stringResource(R.string.profile_image),
|
||||||
|
|||||||
@@ -109,13 +109,13 @@ import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
|||||||
import com.vitorpamplona.amethyst.ui.components.ZoomableImageDialog
|
import com.vitorpamplona.amethyst.ui.components.ZoomableImageDialog
|
||||||
import com.vitorpamplona.amethyst.ui.components.figureOutMimeType
|
import com.vitorpamplona.amethyst.ui.components.figureOutMimeType
|
||||||
import com.vitorpamplona.amethyst.ui.dal.UserProfileReportsFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.UserProfileReportsFeedFilter
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.ShowQRDialog
|
|
||||||
import com.vitorpamplona.amethyst.ui.note.ClickableUserPicture
|
import com.vitorpamplona.amethyst.ui.note.ClickableUserPicture
|
||||||
import com.vitorpamplona.amethyst.ui.note.ErrorMessageDialog
|
import com.vitorpamplona.amethyst.ui.note.ErrorMessageDialog
|
||||||
import com.vitorpamplona.amethyst.ui.note.LightningAddressIcon
|
import com.vitorpamplona.amethyst.ui.note.LightningAddressIcon
|
||||||
import com.vitorpamplona.amethyst.ui.note.LoadAddressableNote
|
import com.vitorpamplona.amethyst.ui.note.LoadAddressableNote
|
||||||
import com.vitorpamplona.amethyst.ui.note.payViaIntent
|
import com.vitorpamplona.amethyst.ui.note.payViaIntent
|
||||||
import com.vitorpamplona.amethyst.ui.note.routeToMessage
|
import com.vitorpamplona.amethyst.ui.note.routeToMessage
|
||||||
|
import com.vitorpamplona.amethyst.ui.qrcode.ShowQRDialog
|
||||||
import com.vitorpamplona.amethyst.ui.screen.FeedState
|
import com.vitorpamplona.amethyst.ui.screen.FeedState
|
||||||
import com.vitorpamplona.amethyst.ui.screen.LnZapFeedView
|
import com.vitorpamplona.amethyst.ui.screen.LnZapFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.NostrUserAppRecommendationsFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrUserAppRecommendationsFeedViewModel
|
||||||
|
|||||||
Reference in New Issue
Block a user