diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/JoinUserOrChannelView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/JoinUserOrChannelView.kt index 9acfc0485..7ff65c5e1 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/JoinUserOrChannelView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/JoinUserOrChannelView.kt @@ -120,7 +120,7 @@ fun JoinUserOrChannelView(searchBarViewModel: SearchBarViewModel, onClose: () -> horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { searchBarViewModel.clear() NostrSearchEventOrUserDataSource.clear() onClose() diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewChannelView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewChannelView.kt index a5769d463..db732c870 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewChannelView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewChannelView.kt @@ -51,7 +51,7 @@ fun NewChannelView(onClose: () -> Unit, accountViewModel: AccountViewModel, chan horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { postViewModel.clear() onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt index fca593fd7..b4344132c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt @@ -123,7 +123,7 @@ fun NewMediaView(uri: Uri, onClose: () -> Unit, postViewModel: NewMediaModel, ac horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { postViewModel.cancel() onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt index ed4535fc2..e0b21fa77 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt @@ -98,6 +98,7 @@ import com.vitorpamplona.amethyst.ui.theme.QuoteBorder import com.vitorpamplona.amethyst.ui.theme.Size10dp import com.vitorpamplona.amethyst.ui.theme.Size5dp import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer +import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.replyModifier @@ -166,314 +167,340 @@ fun NewPostView( decorFitsSystemWindows = false ) ) { - Surface( - modifier = Modifier - .fillMaxWidth() - .fillMaxHeight() - ) { - if (showRelaysDialog) { - RelaySelectionDialog( - list = relayList, - onClose = { - showRelaysDialog = false - }, - onPost = { - relayList = it - }, - accountViewModel = accountViewModel, - nav = nav - ) - } + if (showRelaysDialog) { + RelaySelectionDialog( + list = relayList, + onClose = { + showRelaysDialog = false + }, + onPost = { + relayList = it + }, + accountViewModel = accountViewModel, + nav = nav + ) + } - Column( - modifier = Modifier - .fillMaxWidth() - .fillMaxHeight() - ) { - Column( - modifier = Modifier - .padding(start = 10.dp, end = 10.dp, top = 10.dp) - .imePadding() - .weight(1f) - ) { - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically - ) { - CloseButton(onCancel = { + Scaffold( + topBar = { + TopAppBar( + title = { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(end = 10.dp), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically + ) { + Spacer(modifier = StdHorzSpacer) + + Box { + IconButton( + modifier = Modifier.align(Alignment.Center), + onClick = { + showRelaysDialog = true + } + ) { + Icon( + painter = painterResource(R.drawable.relays), + contentDescription = null, + modifier = Modifier.height(25.dp), + tint = MaterialTheme.colors.onBackground + ) + } + } + PostButton( + onPost = { + scope.launch(Dispatchers.IO) { + postViewModel.sendPost(relayList = relayList) + onClose() + } + }, + isActive = postViewModel.canPost() + ) + } + }, + navigationIcon = { + Spacer(modifier = StdHorzSpacer) + CloseButton(onPress = { postViewModel.cancel() onClose() }) - - Box { - IconButton( - modifier = Modifier.align(Alignment.Center), - onClick = { - showRelaysDialog = true - } - ) { - Icon( - painter = painterResource(R.drawable.relays), - contentDescription = null, - modifier = Modifier.height(25.dp), - tint = MaterialTheme.colors.onBackground - ) - } - } - PostButton( - onPost = { - scope.launch(Dispatchers.IO) { - postViewModel.sendPost(relayList = relayList) - onClose() - } - }, - isActive = postViewModel.canPost() - ) - } - - Row( + }, + backgroundColor = MaterialTheme.colors.surface, + elevation = 0.dp + ) + } + ) { pad -> + Surface( + modifier = Modifier + .padding( + start = Size10dp, + top = pad.calculateTopPadding(), + end = Size10dp, + bottom = pad.calculateBottomPadding() + ) + .fillMaxSize() + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .fillMaxHeight() + ) { + Column( modifier = Modifier - .fillMaxWidth() + .padding(top = 10.dp) + .imePadding() .weight(1f) ) { - Column( + Row( modifier = Modifier .fillMaxWidth() - .verticalScroll(scrollState) + .weight(1f) ) { - postViewModel.originalNote?.let { - NoteCompose( - baseNote = it, - makeItShort = true, - unPackReply = false, - isQuotedNote = true, - modifier = MaterialTheme.colors.replyModifier, - accountViewModel = accountViewModel, - nav = nav - ) - } - - Notifying(postViewModel.mentions?.toImmutableList()) { - postViewModel.removeFromReplyList(it) - } - - if (enableMessageInterface) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp) - ) { - SendDirectMessageTo(postViewModel = postViewModel) + Column( + modifier = Modifier + .fillMaxWidth() + .verticalScroll(scrollState) + ) { + postViewModel.originalNote?.let { + Row(Modifier.heightIn(max = 200.dp)) { + NoteCompose( + baseNote = it, + makeItShort = true, + unPackReply = false, + isQuotedNote = true, + modifier = MaterialTheme.colors.replyModifier, + accountViewModel = accountViewModel, + nav = nav + ) + Spacer(modifier = StdVertSpacer) + } } - } - MessageField(postViewModel) - - if (postViewModel.wantsPoll) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp) - ) { - PollField(postViewModel) + Row() { + Notifying(postViewModel.mentions?.toImmutableList()) { + postViewModel.removeFromReplyList(it) + } } - } - if (postViewModel.wantsToMarkAsSensitive) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier - .padding(vertical = Size5dp, horizontal = Size10dp) - ) { - ContentSensitivityExplainer(postViewModel) + if (enableMessageInterface) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp) + ) { + SendDirectMessageTo(postViewModel = postViewModel) + } } - } - if (postViewModel.wantsToAddGeoHash) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier - .padding(vertical = Size5dp, horizontal = Size10dp) - ) { - LocationAsHash(postViewModel) + MessageField(postViewModel) + + if (postViewModel.wantsPoll) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp) + ) { + PollField(postViewModel) + } } - } - if (postViewModel.wantsForwardZapTo) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp) - ) { - FowardZapTo(postViewModel) + if (postViewModel.wantsToMarkAsSensitive) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .padding(vertical = Size5dp, horizontal = Size10dp) + ) { + ContentSensitivityExplainer(postViewModel) + } } - } - val url = postViewModel.contentToAddUrl - if (url != null) { - Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) { - ImageVideoDescription( - url, - account.defaultFileServer, - onAdd = { description, server, sensitiveContent -> - postViewModel.upload(url, description, sensitiveContent, server, context, relayList) - account.changeDefaultFileServer(server) - }, - onCancel = { - postViewModel.contentToAddUrl = null - }, - onError = { - scope.launch { - postViewModel.imageUploadingError.emit(it) - } - }, - accountViewModel = accountViewModel - ) + if (postViewModel.wantsToAddGeoHash) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .padding(vertical = Size5dp, horizontal = Size10dp) + ) { + LocationAsHash(postViewModel) + } } - } - val user = postViewModel.account?.userProfile() - val lud16 = user?.info?.lnAddress() + if (postViewModel.wantsForwardZapTo) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp) + ) { + FowardZapTo(postViewModel) + } + } - if (lud16 != null && postViewModel.wantsInvoice) { - Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) { - Column(Modifier.fillMaxWidth()) { - InvoiceRequest( - lud16, - user.pubkeyHex, - account, - stringResource(id = R.string.lightning_invoice), - stringResource(id = R.string.lightning_create_and_add_invoice), - onSuccess = { - postViewModel.message = TextFieldValue(postViewModel.message.text + "\n\n" + it) - postViewModel.wantsInvoice = false + val url = postViewModel.contentToAddUrl + if (url != null) { + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) { + ImageVideoDescription( + url, + account.defaultFileServer, + onAdd = { description, server, sensitiveContent -> + postViewModel.upload(url, description, sensitiveContent, server, context, relayList) + account.changeDefaultFileServer(server) }, - onClose = { - postViewModel.wantsInvoice = false - } + onCancel = { + postViewModel.contentToAddUrl = null + }, + onError = { + scope.launch { + postViewModel.imageUploadingError.emit(it) + } + }, + accountViewModel = accountViewModel ) } } - } - if (lud16 != null && postViewModel.wantsZapraiser) { - Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) { - ZapRaiserRequest( - stringResource(id = R.string.zapraiser), - postViewModel - ) - } - } + val user = postViewModel.account?.userProfile() + val lud16 = user?.info?.lnAddress() - val myUrlPreview = postViewModel.urlPreview - if (myUrlPreview != null) { - Row(modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) { - if (isValidURL(myUrlPreview)) { - val removedParamsFromUrl = - myUrlPreview.split("?")[0].lowercase() - if (imageExtensions.any { removedParamsFromUrl.endsWith(it) }) { - AsyncImage( - model = myUrlPreview, - contentDescription = myUrlPreview, - contentScale = ContentScale.FillWidth, - modifier = Modifier - .padding(top = 4.dp) - .fillMaxWidth() - .clip(shape = QuoteBorder) - .border( - 1.dp, - MaterialTheme.colors.subtleBorder, - QuoteBorder - ) + if (lud16 != null && postViewModel.wantsInvoice) { + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) { + Column(Modifier.fillMaxWidth()) { + InvoiceRequest( + lud16, + user.pubkeyHex, + account, + stringResource(id = R.string.lightning_invoice), + stringResource(id = R.string.lightning_create_and_add_invoice), + onSuccess = { + postViewModel.message = TextFieldValue(postViewModel.message.text + "\n\n" + it) + postViewModel.wantsInvoice = false + }, + onClose = { + postViewModel.wantsInvoice = false + } ) - } else if (videoExtensions.any { removedParamsFromUrl.endsWith(it) }) { - VideoView(myUrlPreview, roundedCorner = true, accountViewModel = accountViewModel) - } else { - UrlPreview(myUrlPreview, myUrlPreview, accountViewModel) - } - } else if (startsWithNIP19Scheme(myUrlPreview)) { - val bgColor = MaterialTheme.colors.background - val backgroundColor = remember { - mutableStateOf(bgColor) } + } + } - BechLink( - myUrlPreview, - true, - backgroundColor, - accountViewModel, - nav + if (lud16 != null && postViewModel.wantsZapraiser) { + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) { + ZapRaiserRequest( + stringResource(id = R.string.zapraiser), + postViewModel ) - } else if (noProtocolUrlValidator.matcher(myUrlPreview).matches()) { - UrlPreview("https://$myUrlPreview", myUrlPreview, accountViewModel) + } + } + + val myUrlPreview = postViewModel.urlPreview + if (myUrlPreview != null) { + Row(modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) { + if (isValidURL(myUrlPreview)) { + val removedParamsFromUrl = + myUrlPreview.split("?")[0].lowercase() + if (imageExtensions.any { removedParamsFromUrl.endsWith(it) }) { + AsyncImage( + model = myUrlPreview, + contentDescription = myUrlPreview, + contentScale = ContentScale.FillWidth, + modifier = Modifier + .padding(top = 4.dp) + .fillMaxWidth() + .clip(shape = QuoteBorder) + .border( + 1.dp, + MaterialTheme.colors.subtleBorder, + QuoteBorder + ) + ) + } else if (videoExtensions.any { removedParamsFromUrl.endsWith(it) }) { + VideoView(myUrlPreview, roundedCorner = true, accountViewModel = accountViewModel) + } else { + UrlPreview(myUrlPreview, myUrlPreview, accountViewModel) + } + } else if (startsWithNIP19Scheme(myUrlPreview)) { + val bgColor = MaterialTheme.colors.background + val backgroundColor = remember { + mutableStateOf(bgColor) + } + + BechLink( + myUrlPreview, + true, + backgroundColor, + accountViewModel, + nav + ) + } else if (noProtocolUrlValidator.matcher(myUrlPreview).matches()) { + UrlPreview("https://$myUrlPreview", myUrlPreview, accountViewModel) + } } } } } - } - val userSuggestions = postViewModel.userSuggestions - if (userSuggestions.isNotEmpty()) { - LazyColumn( - contentPadding = PaddingValues( - top = 10.dp - ), - modifier = Modifier.heightIn(0.dp, 300.dp) - ) { - itemsIndexed( - userSuggestions, - key = { _, item -> item.pubkeyHex } - ) { _, item -> - UserLine(item, accountViewModel) { - postViewModel.autocompleteWithUser(item) + val userSuggestions = postViewModel.userSuggestions + if (userSuggestions.isNotEmpty()) { + LazyColumn( + contentPadding = PaddingValues( + top = 10.dp + ), + modifier = Modifier.heightIn(0.dp, 300.dp) + ) { + itemsIndexed( + userSuggestions, + key = { _, item -> item.pubkeyHex } + ) { _, item -> + UserLine(item, accountViewModel) { + postViewModel.autocompleteWithUser(item) + } } } } - } - Row( - modifier = Modifier - .fillMaxWidth() - .height(50.dp), - verticalAlignment = Alignment.CenterVertically - ) { - UploadFromGallery( - isUploading = postViewModel.isUploadingImage, - tint = MaterialTheme.colors.onBackground, + Row( modifier = Modifier + .fillMaxWidth() + .height(50.dp), + verticalAlignment = Alignment.CenterVertically ) { - postViewModel.selectImage(it) - } - - if (postViewModel.canUsePoll) { - // These should be hashtag recommendations the user selects in the future. - // val hashtag = stringResource(R.string.poll_hashtag) - // postViewModel.includePollHashtagInMessage(postViewModel.wantsPoll, hashtag) - AddPollButton(postViewModel.wantsPoll) { - postViewModel.wantsPoll = !postViewModel.wantsPoll + UploadFromGallery( + isUploading = postViewModel.isUploadingImage, + tint = MaterialTheme.colors.onBackground, + modifier = Modifier + ) { + postViewModel.selectImage(it) } - } - if (postViewModel.canAddInvoice) { - AddLnInvoiceButton(postViewModel.wantsInvoice) { - postViewModel.wantsInvoice = !postViewModel.wantsInvoice + if (postViewModel.canUsePoll) { + // These should be hashtag recommendations the user selects in the future. + // val hashtag = stringResource(R.string.poll_hashtag) + // postViewModel.includePollHashtagInMessage(postViewModel.wantsPoll, hashtag) + AddPollButton(postViewModel.wantsPoll) { + postViewModel.wantsPoll = !postViewModel.wantsPoll + } } - } - if (postViewModel.canAddZapRaiser) { - AddZapraiserButton(postViewModel.wantsZapraiser) { - postViewModel.wantsZapraiser = !postViewModel.wantsZapraiser + if (postViewModel.canAddInvoice) { + AddLnInvoiceButton(postViewModel.wantsInvoice) { + postViewModel.wantsInvoice = !postViewModel.wantsInvoice + } } - } - MarkAsSensitive(postViewModel) { - postViewModel.wantsToMarkAsSensitive = !postViewModel.wantsToMarkAsSensitive - } + if (postViewModel.canAddZapRaiser) { + AddZapraiserButton(postViewModel.wantsZapraiser) { + postViewModel.wantsZapraiser = !postViewModel.wantsZapraiser + } + } - AddGeoHash(postViewModel) { - postViewModel.wantsToAddGeoHash = !postViewModel.wantsToAddGeoHash - } + MarkAsSensitive(postViewModel) { + postViewModel.wantsToMarkAsSensitive = !postViewModel.wantsToMarkAsSensitive + } - ForwardZapTo(postViewModel) { - postViewModel.wantsForwardZapTo = !postViewModel.wantsForwardZapTo + AddGeoHash(postViewModel) { + postViewModel.wantsToAddGeoHash = !postViewModel.wantsToAddGeoHash + } + + ForwardZapTo(postViewModel) { + postViewModel.wantsForwardZapTo = !postViewModel.wantsForwardZapTo + } } } } @@ -1159,10 +1186,10 @@ private fun MarkAsSensitive( } @Composable -fun CloseButton(onCancel: () -> Unit) { +fun CloseButton(onPress: () -> Unit) { Button( onClick = { - onCancel() + onPress() }, shape = ButtonBorder, colors = ButtonDefaults diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewRelayListView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewRelayListView.kt index 00c7ab118..3abfba9ef 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewRelayListView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewRelayListView.kt @@ -129,7 +129,7 @@ fun NewRelayListView(onClose: () -> Unit, accountViewModel: AccountViewModel, re }, navigationIcon = { Spacer(modifier = StdHorzSpacer) - CloseButton(onCancel = { + CloseButton(onPress = { postViewModel.clear() onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewUserMetadataView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewUserMetadataView.kt index df879dc45..7f743f399 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewUserMetadataView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewUserMetadataView.kt @@ -67,7 +67,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) { horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { postViewModel.clear() onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/RelayInformationDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/RelayInformationDialog.kt index 790a7ea33..952f455e0 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/RelayInformationDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/RelayInformationDialog.kt @@ -74,7 +74,7 @@ fun RelayInformationDialog( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { onClose() }) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/RelaySelectionDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/RelaySelectionDialog.kt index 46fe688d0..e2d4af042 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/RelaySelectionDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/RelaySelectionDialog.kt @@ -110,7 +110,7 @@ fun RelaySelectionDialog( verticalAlignment = Alignment.CenterVertically ) { CloseButton( - onCancel = { + onPress = { onClose() } ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index 373f24214..def9f9f4d 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -663,7 +663,7 @@ fun ZoomableImageDialog( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = onDismiss) + CloseButton(onPress = onDismiss) val myContent = allImages[pagerState.currentPage] if (myContent is ZoomableUrlContent) { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/AddBountyAmountDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/AddBountyAmountDialog.kt index cfece88ef..2f57f3479 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/AddBountyAmountDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/AddBountyAmountDialog.kt @@ -95,7 +95,7 @@ fun AddBountyAmountDialog(bounty: Note, accountViewModel: AccountViewModel, onCl verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth() ) { - CloseButton(onCancel = { + CloseButton(onPress = { postViewModel.cancel() onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index aca280ee8..dc8c0f8e5 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -484,8 +484,8 @@ fun NormalNote( ) } is BadgeDefinitionEvent -> BadgeDisplay(baseNote = baseNote) - is FileHeaderEvent -> FileHeaderDisplay(baseNote, isQuotedNote, accountViewModel) - is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, isQuotedNote, accountViewModel) + is FileHeaderEvent -> FileHeaderDisplay(baseNote, isQuotedNote || isBoostedNote, accountViewModel) + is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, isQuotedNote || isBoostedNote, accountViewModel) else -> LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup -> CheckNewAndRenderNote( @@ -3199,7 +3199,7 @@ private fun RenderBadge( } @Composable -fun FileHeaderDisplay(note: Note, isQuotedNote: Boolean, accountViewModel: AccountViewModel) { +fun FileHeaderDisplay(note: Note, roundedCorner: Boolean, accountViewModel: AccountViewModel) { val event = (note.event as? FileHeaderEvent) ?: return val fullUrl = event.url() ?: return @@ -3235,18 +3235,18 @@ fun FileHeaderDisplay(note: Note, isQuotedNote: Boolean, accountViewModel: Accou } SensitivityWarning(note = note, accountViewModel = accountViewModel) { - ZoomableContentView(content = content, roundedCorner = isQuotedNote, accountViewModel = accountViewModel) + ZoomableContentView(content = content, roundedCorner = roundedCorner, accountViewModel = accountViewModel) } } @Composable -fun FileStorageHeaderDisplay(baseNote: Note, isQuotedNote: Boolean, accountViewModel: AccountViewModel) { +fun FileStorageHeaderDisplay(baseNote: Note, roundedCorner: Boolean, accountViewModel: AccountViewModel) { val eventHeader = (baseNote.event as? FileStorageHeaderEvent) ?: return val dataEventId = eventHeader.dataEventId() ?: return LoadNote(baseNoteHex = dataEventId) { contentNote -> if (contentNote != null) { - ObserverAndRenderNIP95(baseNote, contentNote, isQuotedNote, accountViewModel) + ObserverAndRenderNIP95(baseNote, contentNote, roundedCorner, accountViewModel) } } } @@ -3255,7 +3255,7 @@ fun FileStorageHeaderDisplay(baseNote: Note, isQuotedNote: Boolean, accountViewM private fun ObserverAndRenderNIP95( header: Note, content: Note, - isQuotedNote: Boolean, + roundedCorner: Boolean, accountViewModel: AccountViewModel ) { val eventHeader = (header.event as? FileStorageHeaderEvent) ?: return @@ -3302,7 +3302,7 @@ private fun ObserverAndRenderNIP95( Crossfade(targetState = content) { if (it != null) { SensitivityWarning(note = header, accountViewModel = accountViewModel) { - ZoomableContentView(content = it, roundedCorner = isQuotedNote, accountViewModel = accountViewModel) + ZoomableContentView(content = it, roundedCorner = roundedCorner, accountViewModel = accountViewModel) } } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt index 864313a2f..a1296f4f1 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt @@ -155,7 +155,7 @@ fun UpdateReactionTypeDialog( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { postViewModel.cancel() onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt index 284d69ee1..e988207a4 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt @@ -250,7 +250,7 @@ fun UpdateZapAmountDialog(onClose: () -> Unit, nip47uri: String? = null, account horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { postViewModel.cancel() onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt index 309bc8d15..80cbd63da 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt @@ -94,7 +94,7 @@ fun ZapCustomDialog(onClose: () -> Unit, accountViewModel: AccountViewModel, bas horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { postViewModel.cancel() onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/qrcode/ShowQRDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/qrcode/ShowQRDialog.kt index b284489c8..a898e9633 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/qrcode/ShowQRDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/qrcode/ShowQRDialog.kt @@ -61,7 +61,7 @@ fun ShowQRDialog(user: User, onScan: (String) -> Unit, onClose: () -> Unit) { horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = onClose) + CloseButton(onPress = onClose) } Column( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountBackupDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountBackupDialog.kt index 36d624f79..05bde8aa8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountBackupDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountBackupDialog.kt @@ -70,7 +70,7 @@ fun AccountBackupDialog(account: Account, onClose: () -> Unit) { horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = onClose) + CloseButton(onPress = onClose) } Column( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomScreen.kt index 17c3f4758..059c5b624 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomScreen.kt @@ -616,7 +616,7 @@ fun NewSubjectView(onClose: () -> Unit, accountViewModel: AccountViewModel, room horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - CloseButton(onCancel = { + CloseButton(onPress = { onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ConnectOrbotDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ConnectOrbotDialog.kt index 3a6d4def2..ceee975b6 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ConnectOrbotDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ConnectOrbotDialog.kt @@ -56,7 +56,7 @@ fun ConnectOrbotDialog(onClose: () -> Unit, onPost: () -> Unit, portNumber: Muta verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth() ) { - CloseButton(onCancel = { + CloseButton(onPress = { onClose() }) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/VideoScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/VideoScreen.kt index 9ab694bfe..3970c99d2 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/VideoScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/VideoScreen.kt @@ -60,6 +60,7 @@ import com.vitorpamplona.amethyst.ui.note.ReplyReaction import com.vitorpamplona.amethyst.ui.note.ViewCountReaction import com.vitorpamplona.amethyst.ui.note.WatchForReports import com.vitorpamplona.amethyst.ui.note.ZapReaction +import com.vitorpamplona.amethyst.ui.note.routeFor import com.vitorpamplona.amethyst.ui.screen.FeedEmpty import com.vitorpamplona.amethyst.ui.screen.FeedError import com.vitorpamplona.amethyst.ui.screen.FeedState @@ -451,8 +452,14 @@ fun ReactionsColumn(baseNote: Note, accountViewModel: AccountViewModel, nav: (St Spacer(modifier = Modifier.height(8.dp)) Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.padding(bottom = 75.dp, end = 20.dp)) { + val scope = rememberCoroutineScope() ReplyReaction(baseNote, grayTint = MaterialTheme.colors.onBackground, accountViewModel, iconSize = 40.dp) { - wantsToReplyTo = baseNote + scope.launch { + routeFor( + baseNote, + accountViewModel.userProfile() + )?.let { nav(it) } + } } BoostReaction(baseNote, grayTint = MaterialTheme.colors.onBackground, accountViewModel, iconSize = 40.dp) { wantsToQuote = baseNote