mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 16:30:49 +00:00
Correct imePadding of the NewPostView
This commit is contained in:
parent
e9b235f748
commit
4d85a2f6fb
@ -120,7 +120,7 @@ fun JoinUserOrChannelView(searchBarViewModel: SearchBarViewModel, onClose: () ->
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
searchBarViewModel.clear()
|
searchBarViewModel.clear()
|
||||||
NostrSearchEventOrUserDataSource.clear()
|
NostrSearchEventOrUserDataSource.clear()
|
||||||
onClose()
|
onClose()
|
||||||
|
@ -51,7 +51,7 @@ fun NewChannelView(onClose: () -> Unit, accountViewModel: AccountViewModel, chan
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
postViewModel.clear()
|
postViewModel.clear()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
@ -123,7 +123,7 @@ fun NewMediaView(uri: Uri, onClose: () -> Unit, postViewModel: NewMediaModel, ac
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
postViewModel.cancel()
|
postViewModel.cancel()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
@ -98,6 +98,7 @@ import com.vitorpamplona.amethyst.ui.theme.QuoteBorder
|
|||||||
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size5dp
|
import com.vitorpamplona.amethyst.ui.theme.Size5dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
|
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.mediumImportanceLink
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import com.vitorpamplona.amethyst.ui.theme.replyModifier
|
import com.vitorpamplona.amethyst.ui.theme.replyModifier
|
||||||
@ -166,314 +167,340 @@ fun NewPostView(
|
|||||||
decorFitsSystemWindows = false
|
decorFitsSystemWindows = false
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Surface(
|
if (showRelaysDialog) {
|
||||||
modifier = Modifier
|
RelaySelectionDialog(
|
||||||
.fillMaxWidth()
|
list = relayList,
|
||||||
.fillMaxHeight()
|
onClose = {
|
||||||
) {
|
showRelaysDialog = false
|
||||||
if (showRelaysDialog) {
|
},
|
||||||
RelaySelectionDialog(
|
onPost = {
|
||||||
list = relayList,
|
relayList = it
|
||||||
onClose = {
|
},
|
||||||
showRelaysDialog = false
|
accountViewModel = accountViewModel,
|
||||||
},
|
nav = nav
|
||||||
onPost = {
|
)
|
||||||
relayList = it
|
}
|
||||||
},
|
|
||||||
accountViewModel = accountViewModel,
|
|
||||||
nav = nav
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Column(
|
Scaffold(
|
||||||
modifier = Modifier
|
topBar = {
|
||||||
.fillMaxWidth()
|
TopAppBar(
|
||||||
.fillMaxHeight()
|
title = {
|
||||||
) {
|
Row(
|
||||||
Column(
|
modifier = Modifier
|
||||||
modifier = Modifier
|
.fillMaxWidth()
|
||||||
.padding(start = 10.dp, end = 10.dp, top = 10.dp)
|
.padding(end = 10.dp),
|
||||||
.imePadding()
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
.weight(1f)
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Row(
|
Spacer(modifier = StdHorzSpacer)
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
Box {
|
||||||
verticalAlignment = Alignment.CenterVertically
|
IconButton(
|
||||||
) {
|
modifier = Modifier.align(Alignment.Center),
|
||||||
CloseButton(onCancel = {
|
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()
|
postViewModel.cancel()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
},
|
||||||
Box {
|
backgroundColor = MaterialTheme.colors.surface,
|
||||||
IconButton(
|
elevation = 0.dp
|
||||||
modifier = Modifier.align(Alignment.Center),
|
)
|
||||||
onClick = {
|
}
|
||||||
showRelaysDialog = true
|
) { pad ->
|
||||||
}
|
Surface(
|
||||||
) {
|
modifier = Modifier
|
||||||
Icon(
|
.padding(
|
||||||
painter = painterResource(R.drawable.relays),
|
start = Size10dp,
|
||||||
contentDescription = null,
|
top = pad.calculateTopPadding(),
|
||||||
modifier = Modifier.height(25.dp),
|
end = Size10dp,
|
||||||
tint = MaterialTheme.colors.onBackground
|
bottom = pad.calculateBottomPadding()
|
||||||
)
|
)
|
||||||
}
|
.fillMaxSize()
|
||||||
}
|
) {
|
||||||
PostButton(
|
Column(
|
||||||
onPost = {
|
modifier = Modifier
|
||||||
scope.launch(Dispatchers.IO) {
|
.fillMaxWidth()
|
||||||
postViewModel.sendPost(relayList = relayList)
|
.fillMaxHeight()
|
||||||
onClose()
|
) {
|
||||||
}
|
Column(
|
||||||
},
|
|
||||||
isActive = postViewModel.canPost()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.padding(top = 10.dp)
|
||||||
|
.imePadding()
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
) {
|
) {
|
||||||
Column(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.verticalScroll(scrollState)
|
.weight(1f)
|
||||||
) {
|
) {
|
||||||
postViewModel.originalNote?.let {
|
Column(
|
||||||
NoteCompose(
|
modifier = Modifier
|
||||||
baseNote = it,
|
.fillMaxWidth()
|
||||||
makeItShort = true,
|
.verticalScroll(scrollState)
|
||||||
unPackReply = false,
|
) {
|
||||||
isQuotedNote = true,
|
postViewModel.originalNote?.let {
|
||||||
modifier = MaterialTheme.colors.replyModifier,
|
Row(Modifier.heightIn(max = 200.dp)) {
|
||||||
accountViewModel = accountViewModel,
|
NoteCompose(
|
||||||
nav = nav
|
baseNote = it,
|
||||||
)
|
makeItShort = true,
|
||||||
}
|
unPackReply = false,
|
||||||
|
isQuotedNote = true,
|
||||||
Notifying(postViewModel.mentions?.toImmutableList()) {
|
modifier = MaterialTheme.colors.replyModifier,
|
||||||
postViewModel.removeFromReplyList(it)
|
accountViewModel = accountViewModel,
|
||||||
}
|
nav = nav
|
||||||
|
)
|
||||||
if (enableMessageInterface) {
|
Spacer(modifier = StdVertSpacer)
|
||||||
Row(
|
}
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)
|
|
||||||
) {
|
|
||||||
SendDirectMessageTo(postViewModel = postViewModel)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MessageField(postViewModel)
|
Row() {
|
||||||
|
Notifying(postViewModel.mentions?.toImmutableList()) {
|
||||||
if (postViewModel.wantsPoll) {
|
postViewModel.removeFromReplyList(it)
|
||||||
Row(
|
}
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)
|
|
||||||
) {
|
|
||||||
PollField(postViewModel)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (postViewModel.wantsToMarkAsSensitive) {
|
if (enableMessageInterface) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier
|
modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)
|
||||||
.padding(vertical = Size5dp, horizontal = Size10dp)
|
) {
|
||||||
) {
|
SendDirectMessageTo(postViewModel = postViewModel)
|
||||||
ContentSensitivityExplainer(postViewModel)
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (postViewModel.wantsToAddGeoHash) {
|
MessageField(postViewModel)
|
||||||
Row(
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
if (postViewModel.wantsPoll) {
|
||||||
modifier = Modifier
|
Row(
|
||||||
.padding(vertical = Size5dp, horizontal = Size10dp)
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)
|
||||||
LocationAsHash(postViewModel)
|
) {
|
||||||
|
PollField(postViewModel)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (postViewModel.wantsForwardZapTo) {
|
if (postViewModel.wantsToMarkAsSensitive) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)
|
modifier = Modifier
|
||||||
) {
|
.padding(vertical = Size5dp, horizontal = Size10dp)
|
||||||
FowardZapTo(postViewModel)
|
) {
|
||||||
|
ContentSensitivityExplainer(postViewModel)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
val url = postViewModel.contentToAddUrl
|
if (postViewModel.wantsToAddGeoHash) {
|
||||||
if (url != null) {
|
Row(
|
||||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) {
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
ImageVideoDescription(
|
modifier = Modifier
|
||||||
url,
|
.padding(vertical = Size5dp, horizontal = Size10dp)
|
||||||
account.defaultFileServer,
|
) {
|
||||||
onAdd = { description, server, sensitiveContent ->
|
LocationAsHash(postViewModel)
|
||||||
postViewModel.upload(url, description, sensitiveContent, server, context, relayList)
|
}
|
||||||
account.changeDefaultFileServer(server)
|
|
||||||
},
|
|
||||||
onCancel = {
|
|
||||||
postViewModel.contentToAddUrl = null
|
|
||||||
},
|
|
||||||
onError = {
|
|
||||||
scope.launch {
|
|
||||||
postViewModel.imageUploadingError.emit(it)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
accountViewModel = accountViewModel
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
val user = postViewModel.account?.userProfile()
|
if (postViewModel.wantsForwardZapTo) {
|
||||||
val lud16 = user?.info?.lnAddress()
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)
|
||||||
|
) {
|
||||||
|
FowardZapTo(postViewModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (lud16 != null && postViewModel.wantsInvoice) {
|
val url = postViewModel.contentToAddUrl
|
||||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) {
|
if (url != null) {
|
||||||
Column(Modifier.fillMaxWidth()) {
|
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) {
|
||||||
InvoiceRequest(
|
ImageVideoDescription(
|
||||||
lud16,
|
url,
|
||||||
user.pubkeyHex,
|
account.defaultFileServer,
|
||||||
account,
|
onAdd = { description, server, sensitiveContent ->
|
||||||
stringResource(id = R.string.lightning_invoice),
|
postViewModel.upload(url, description, sensitiveContent, server, context, relayList)
|
||||||
stringResource(id = R.string.lightning_create_and_add_invoice),
|
account.changeDefaultFileServer(server)
|
||||||
onSuccess = {
|
|
||||||
postViewModel.message = TextFieldValue(postViewModel.message.text + "\n\n" + it)
|
|
||||||
postViewModel.wantsInvoice = false
|
|
||||||
},
|
},
|
||||||
onClose = {
|
onCancel = {
|
||||||
postViewModel.wantsInvoice = false
|
postViewModel.contentToAddUrl = null
|
||||||
}
|
},
|
||||||
|
onError = {
|
||||||
|
scope.launch {
|
||||||
|
postViewModel.imageUploadingError.emit(it)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
accountViewModel = accountViewModel
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (lud16 != null && postViewModel.wantsZapraiser) {
|
val user = postViewModel.account?.userProfile()
|
||||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) {
|
val lud16 = user?.info?.lnAddress()
|
||||||
ZapRaiserRequest(
|
|
||||||
stringResource(id = R.string.zapraiser),
|
|
||||||
postViewModel
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val myUrlPreview = postViewModel.urlPreview
|
if (lud16 != null && postViewModel.wantsInvoice) {
|
||||||
if (myUrlPreview != null) {
|
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) {
|
||||||
Row(modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) {
|
Column(Modifier.fillMaxWidth()) {
|
||||||
if (isValidURL(myUrlPreview)) {
|
InvoiceRequest(
|
||||||
val removedParamsFromUrl =
|
lud16,
|
||||||
myUrlPreview.split("?")[0].lowercase()
|
user.pubkeyHex,
|
||||||
if (imageExtensions.any { removedParamsFromUrl.endsWith(it) }) {
|
account,
|
||||||
AsyncImage(
|
stringResource(id = R.string.lightning_invoice),
|
||||||
model = myUrlPreview,
|
stringResource(id = R.string.lightning_create_and_add_invoice),
|
||||||
contentDescription = myUrlPreview,
|
onSuccess = {
|
||||||
contentScale = ContentScale.FillWidth,
|
postViewModel.message = TextFieldValue(postViewModel.message.text + "\n\n" + it)
|
||||||
modifier = Modifier
|
postViewModel.wantsInvoice = false
|
||||||
.padding(top = 4.dp)
|
},
|
||||||
.fillMaxWidth()
|
onClose = {
|
||||||
.clip(shape = QuoteBorder)
|
postViewModel.wantsInvoice = false
|
||||||
.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(
|
if (lud16 != null && postViewModel.wantsZapraiser) {
|
||||||
myUrlPreview,
|
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = Size5dp, horizontal = Size10dp)) {
|
||||||
true,
|
ZapRaiserRequest(
|
||||||
backgroundColor,
|
stringResource(id = R.string.zapraiser),
|
||||||
accountViewModel,
|
postViewModel
|
||||||
nav
|
|
||||||
)
|
)
|
||||||
} 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
|
val userSuggestions = postViewModel.userSuggestions
|
||||||
if (userSuggestions.isNotEmpty()) {
|
if (userSuggestions.isNotEmpty()) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(
|
contentPadding = PaddingValues(
|
||||||
top = 10.dp
|
top = 10.dp
|
||||||
),
|
),
|
||||||
modifier = Modifier.heightIn(0.dp, 300.dp)
|
modifier = Modifier.heightIn(0.dp, 300.dp)
|
||||||
) {
|
) {
|
||||||
itemsIndexed(
|
itemsIndexed(
|
||||||
userSuggestions,
|
userSuggestions,
|
||||||
key = { _, item -> item.pubkeyHex }
|
key = { _, item -> item.pubkeyHex }
|
||||||
) { _, item ->
|
) { _, item ->
|
||||||
UserLine(item, accountViewModel) {
|
UserLine(item, accountViewModel) {
|
||||||
postViewModel.autocompleteWithUser(item)
|
postViewModel.autocompleteWithUser(item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(50.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
UploadFromGallery(
|
|
||||||
isUploading = postViewModel.isUploadingImage,
|
|
||||||
tint = MaterialTheme.colors.onBackground,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(50.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
postViewModel.selectImage(it)
|
UploadFromGallery(
|
||||||
}
|
isUploading = postViewModel.isUploadingImage,
|
||||||
|
tint = MaterialTheme.colors.onBackground,
|
||||||
if (postViewModel.canUsePoll) {
|
modifier = Modifier
|
||||||
// These should be hashtag recommendations the user selects in the future.
|
) {
|
||||||
// val hashtag = stringResource(R.string.poll_hashtag)
|
postViewModel.selectImage(it)
|
||||||
// postViewModel.includePollHashtagInMessage(postViewModel.wantsPoll, hashtag)
|
|
||||||
AddPollButton(postViewModel.wantsPoll) {
|
|
||||||
postViewModel.wantsPoll = !postViewModel.wantsPoll
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (postViewModel.canAddInvoice) {
|
if (postViewModel.canUsePoll) {
|
||||||
AddLnInvoiceButton(postViewModel.wantsInvoice) {
|
// These should be hashtag recommendations the user selects in the future.
|
||||||
postViewModel.wantsInvoice = !postViewModel.wantsInvoice
|
// val hashtag = stringResource(R.string.poll_hashtag)
|
||||||
|
// postViewModel.includePollHashtagInMessage(postViewModel.wantsPoll, hashtag)
|
||||||
|
AddPollButton(postViewModel.wantsPoll) {
|
||||||
|
postViewModel.wantsPoll = !postViewModel.wantsPoll
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (postViewModel.canAddZapRaiser) {
|
if (postViewModel.canAddInvoice) {
|
||||||
AddZapraiserButton(postViewModel.wantsZapraiser) {
|
AddLnInvoiceButton(postViewModel.wantsInvoice) {
|
||||||
postViewModel.wantsZapraiser = !postViewModel.wantsZapraiser
|
postViewModel.wantsInvoice = !postViewModel.wantsInvoice
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MarkAsSensitive(postViewModel) {
|
if (postViewModel.canAddZapRaiser) {
|
||||||
postViewModel.wantsToMarkAsSensitive = !postViewModel.wantsToMarkAsSensitive
|
AddZapraiserButton(postViewModel.wantsZapraiser) {
|
||||||
}
|
postViewModel.wantsZapraiser = !postViewModel.wantsZapraiser
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AddGeoHash(postViewModel) {
|
MarkAsSensitive(postViewModel) {
|
||||||
postViewModel.wantsToAddGeoHash = !postViewModel.wantsToAddGeoHash
|
postViewModel.wantsToMarkAsSensitive = !postViewModel.wantsToMarkAsSensitive
|
||||||
}
|
}
|
||||||
|
|
||||||
ForwardZapTo(postViewModel) {
|
AddGeoHash(postViewModel) {
|
||||||
postViewModel.wantsForwardZapTo = !postViewModel.wantsForwardZapTo
|
postViewModel.wantsToAddGeoHash = !postViewModel.wantsToAddGeoHash
|
||||||
|
}
|
||||||
|
|
||||||
|
ForwardZapTo(postViewModel) {
|
||||||
|
postViewModel.wantsForwardZapTo = !postViewModel.wantsForwardZapTo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1159,10 +1186,10 @@ private fun MarkAsSensitive(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CloseButton(onCancel: () -> Unit) {
|
fun CloseButton(onPress: () -> Unit) {
|
||||||
Button(
|
Button(
|
||||||
onClick = {
|
onClick = {
|
||||||
onCancel()
|
onPress()
|
||||||
},
|
},
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
colors = ButtonDefaults
|
colors = ButtonDefaults
|
||||||
|
@ -129,7 +129,7 @@ fun NewRelayListView(onClose: () -> Unit, accountViewModel: AccountViewModel, re
|
|||||||
},
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
Spacer(modifier = StdHorzSpacer)
|
Spacer(modifier = StdHorzSpacer)
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
postViewModel.clear()
|
postViewModel.clear()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
@ -67,7 +67,7 @@ fun NewUserMetadataView(onClose: () -> Unit, account: Account) {
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
postViewModel.clear()
|
postViewModel.clear()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
@ -74,7 +74,7 @@ fun RelayInformationDialog(
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ fun RelaySelectionDialog(
|
|||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(
|
CloseButton(
|
||||||
onCancel = {
|
onPress = {
|
||||||
onClose()
|
onClose()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -663,7 +663,7 @@ fun ZoomableImageDialog(
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = onDismiss)
|
CloseButton(onPress = onDismiss)
|
||||||
|
|
||||||
val myContent = allImages[pagerState.currentPage]
|
val myContent = allImages[pagerState.currentPage]
|
||||||
if (myContent is ZoomableUrlContent) {
|
if (myContent is ZoomableUrlContent) {
|
||||||
|
@ -95,7 +95,7 @@ fun AddBountyAmountDialog(bounty: Note, accountViewModel: AccountViewModel, onCl
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
postViewModel.cancel()
|
postViewModel.cancel()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
@ -484,8 +484,8 @@ fun NormalNote(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
is BadgeDefinitionEvent -> BadgeDisplay(baseNote = baseNote)
|
is BadgeDefinitionEvent -> BadgeDisplay(baseNote = baseNote)
|
||||||
is FileHeaderEvent -> FileHeaderDisplay(baseNote, isQuotedNote, accountViewModel)
|
is FileHeaderEvent -> FileHeaderDisplay(baseNote, isQuotedNote || isBoostedNote, accountViewModel)
|
||||||
is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, isQuotedNote, accountViewModel)
|
is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, isQuotedNote || isBoostedNote, accountViewModel)
|
||||||
else ->
|
else ->
|
||||||
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
|
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
|
||||||
CheckNewAndRenderNote(
|
CheckNewAndRenderNote(
|
||||||
@ -3199,7 +3199,7 @@ private fun RenderBadge(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@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 event = (note.event as? FileHeaderEvent) ?: return
|
||||||
val fullUrl = event.url() ?: return
|
val fullUrl = event.url() ?: return
|
||||||
|
|
||||||
@ -3235,18 +3235,18 @@ fun FileHeaderDisplay(note: Note, isQuotedNote: Boolean, accountViewModel: Accou
|
|||||||
}
|
}
|
||||||
|
|
||||||
SensitivityWarning(note = note, accountViewModel = accountViewModel) {
|
SensitivityWarning(note = note, accountViewModel = accountViewModel) {
|
||||||
ZoomableContentView(content = content, roundedCorner = isQuotedNote, accountViewModel = accountViewModel)
|
ZoomableContentView(content = content, roundedCorner = roundedCorner, accountViewModel = accountViewModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@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 eventHeader = (baseNote.event as? FileStorageHeaderEvent) ?: return
|
||||||
val dataEventId = eventHeader.dataEventId() ?: return
|
val dataEventId = eventHeader.dataEventId() ?: return
|
||||||
|
|
||||||
LoadNote(baseNoteHex = dataEventId) { contentNote ->
|
LoadNote(baseNoteHex = dataEventId) { contentNote ->
|
||||||
if (contentNote != null) {
|
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(
|
private fun ObserverAndRenderNIP95(
|
||||||
header: Note,
|
header: Note,
|
||||||
content: Note,
|
content: Note,
|
||||||
isQuotedNote: Boolean,
|
roundedCorner: Boolean,
|
||||||
accountViewModel: AccountViewModel
|
accountViewModel: AccountViewModel
|
||||||
) {
|
) {
|
||||||
val eventHeader = (header.event as? FileStorageHeaderEvent) ?: return
|
val eventHeader = (header.event as? FileStorageHeaderEvent) ?: return
|
||||||
@ -3302,7 +3302,7 @@ private fun ObserverAndRenderNIP95(
|
|||||||
Crossfade(targetState = content) {
|
Crossfade(targetState = content) {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
SensitivityWarning(note = header, accountViewModel = accountViewModel) {
|
SensitivityWarning(note = header, accountViewModel = accountViewModel) {
|
||||||
ZoomableContentView(content = it, roundedCorner = isQuotedNote, accountViewModel = accountViewModel)
|
ZoomableContentView(content = it, roundedCorner = roundedCorner, accountViewModel = accountViewModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ fun UpdateReactionTypeDialog(
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
postViewModel.cancel()
|
postViewModel.cancel()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
@ -250,7 +250,7 @@ fun UpdateZapAmountDialog(onClose: () -> Unit, nip47uri: String? = null, account
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
postViewModel.cancel()
|
postViewModel.cancel()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
@ -94,7 +94,7 @@ fun ZapCustomDialog(onClose: () -> Unit, accountViewModel: AccountViewModel, bas
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
postViewModel.cancel()
|
postViewModel.cancel()
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
@ -61,7 +61,7 @@ fun ShowQRDialog(user: User, onScan: (String) -> Unit, onClose: () -> Unit) {
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = onClose)
|
CloseButton(onPress = onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
|
@ -70,7 +70,7 @@ fun AccountBackupDialog(account: Account, onClose: () -> Unit) {
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = onClose)
|
CloseButton(onPress = onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
|
@ -616,7 +616,7 @@ fun NewSubjectView(onClose: () -> Unit, accountViewModel: AccountViewModel, room
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ fun ConnectOrbotDialog(onClose: () -> Unit, onPost: () -> Unit, portNumber: Muta
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
CloseButton(onCancel = {
|
CloseButton(onPress = {
|
||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ import com.vitorpamplona.amethyst.ui.note.ReplyReaction
|
|||||||
import com.vitorpamplona.amethyst.ui.note.ViewCountReaction
|
import com.vitorpamplona.amethyst.ui.note.ViewCountReaction
|
||||||
import com.vitorpamplona.amethyst.ui.note.WatchForReports
|
import com.vitorpamplona.amethyst.ui.note.WatchForReports
|
||||||
import com.vitorpamplona.amethyst.ui.note.ZapReaction
|
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.FeedEmpty
|
||||||
import com.vitorpamplona.amethyst.ui.screen.FeedError
|
import com.vitorpamplona.amethyst.ui.screen.FeedError
|
||||||
import com.vitorpamplona.amethyst.ui.screen.FeedState
|
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))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.padding(bottom = 75.dp, end = 20.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) {
|
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) {
|
BoostReaction(baseNote, grayTint = MaterialTheme.colors.onBackground, accountViewModel, iconSize = 40.dp) {
|
||||||
wantsToQuote = baseNote
|
wantsToQuote = baseNote
|
||||||
|
Loading…
Reference in New Issue
Block a user