Includes the product in the first message of the marketplace.
This commit is contained in:
@@ -74,6 +74,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.VideoScreen
|
|||||||
import com.vitorpamplona.amethyst.ui.uriToRoute
|
import com.vitorpamplona.amethyst.ui.uriToRoute
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import java.net.URLDecoder
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppNavigation(
|
fun AppNavigation(
|
||||||
@@ -288,9 +289,13 @@ fun AppNavigation(
|
|||||||
route.route,
|
route.route,
|
||||||
route.arguments,
|
route.arguments,
|
||||||
content = {
|
content = {
|
||||||
|
val decodedMessage =
|
||||||
|
it.arguments?.getString("message")?.let {
|
||||||
|
URLDecoder.decode(it, "utf-8")
|
||||||
|
}
|
||||||
ChatroomScreen(
|
ChatroomScreen(
|
||||||
roomId = it.arguments?.getString("id"),
|
roomId = it.arguments?.getString("id"),
|
||||||
draftMessage = it.arguments?.getString("message"),
|
draftMessage = decodedMessage,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ fun routeToMessage(
|
|||||||
val withKey = ChatroomKey(persistentSetOf(user))
|
val withKey = ChatroomKey(persistentSetOf(user))
|
||||||
accountViewModel.account.userProfile().createChatroom(withKey)
|
accountViewModel.account.userProfile().createChatroom(withKey)
|
||||||
return if (draftMessage != null) {
|
return if (draftMessage != null) {
|
||||||
"Room/${withKey.hashCode()}?message=$draftMessage"
|
val encodedMessage = URLEncoder.encode(draftMessage, "utf-8")
|
||||||
|
"Room/${withKey.hashCode()}?message=$encodedMessage"
|
||||||
} else {
|
} else {
|
||||||
"Room/${withKey.hashCode()}"
|
"Room/${withKey.hashCode()}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.runtime.livedata.observeAsState
|
import androidx.compose.runtime.livedata.observeAsState
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -284,26 +285,27 @@ fun Modifier.drawReplyLevel(
|
|||||||
color: Color,
|
color: Color,
|
||||||
selected: Color,
|
selected: Color,
|
||||||
): Modifier =
|
): Modifier =
|
||||||
this.drawBehind {
|
this
|
||||||
val paddingDp = 2
|
.drawBehind {
|
||||||
val strokeWidthDp = 2
|
val paddingDp = 2
|
||||||
val levelWidthDp = strokeWidthDp + 1
|
val strokeWidthDp = 2
|
||||||
|
val levelWidthDp = strokeWidthDp + 1
|
||||||
|
|
||||||
val padding = paddingDp.dp.toPx()
|
val padding = paddingDp.dp.toPx()
|
||||||
val strokeWidth = strokeWidthDp.dp.toPx()
|
val strokeWidth = strokeWidthDp.dp.toPx()
|
||||||
val levelWidth = levelWidthDp.dp.toPx()
|
val levelWidth = levelWidthDp.dp.toPx()
|
||||||
|
|
||||||
repeat(level) {
|
repeat(level) {
|
||||||
this.drawLine(
|
this.drawLine(
|
||||||
if (it == level - 1) selected else color,
|
if (it == level - 1) selected else color,
|
||||||
Offset(padding + it * levelWidth, 0f),
|
Offset(padding + it * levelWidth, 0f),
|
||||||
Offset(padding + it * levelWidth, size.height),
|
Offset(padding + it * levelWidth, size.height),
|
||||||
strokeWidth = strokeWidth,
|
strokeWidth = strokeWidth,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return@drawBehind
|
||||||
}
|
}
|
||||||
|
|
||||||
return@drawBehind
|
|
||||||
}
|
|
||||||
.padding(start = (2 + (level * 3)).dp)
|
.padding(start = (2 + (level * 3)).dp)
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@@ -353,11 +355,14 @@ fun NoteMaster(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Column(
|
Column(
|
||||||
modifier.fillMaxWidth().padding(top = 10.dp),
|
modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(top = 10.dp),
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.padding(start = 12.dp, end = 12.dp)
|
Modifier
|
||||||
|
.padding(start = 12.dp, end = 12.dp)
|
||||||
.clickable(onClick = { note.author?.let { nav("User/${it.pubkeyHex}") } }),
|
.clickable(onClick = { note.author?.let { nav("User/${it.pubkeyHex}") } }),
|
||||||
) {
|
) {
|
||||||
NoteAuthorPicture(
|
NoteAuthorPicture(
|
||||||
@@ -443,7 +448,8 @@ fun NoteMaster(
|
|||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.padding(horizontal = 12.dp)
|
Modifier
|
||||||
|
.padding(horizontal = 12.dp)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = {},
|
onClick = {},
|
||||||
onLongClick = { popupExpanded = true },
|
onLongClick = { popupExpanded = true },
|
||||||
@@ -669,7 +675,9 @@ private fun RenderClassifiedsReaderForThread(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
Modifier.padding(start = 20.dp, end = 20.dp, bottom = 5.dp, top = 15.dp).fillMaxWidth(),
|
Modifier
|
||||||
|
.padding(start = 20.dp, end = 20.dp, bottom = 5.dp, top = 15.dp)
|
||||||
|
.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -686,7 +694,9 @@ private fun RenderClassifiedsReaderForThread(
|
|||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.padding(start = 10.dp, end = 10.dp, bottom = 5.dp, top = 5.dp).fillMaxWidth(),
|
Modifier
|
||||||
|
.padding(start = 10.dp, end = 10.dp, bottom = 5.dp, top = 5.dp)
|
||||||
|
.fillMaxWidth(),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -703,6 +713,7 @@ private fun RenderClassifiedsReaderForThread(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var message by remember { mutableStateOf(TextFieldValue(msg)) }
|
var message by remember { mutableStateOf(TextFieldValue(msg)) }
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
TextField(
|
TextField(
|
||||||
value = message,
|
value = message,
|
||||||
@@ -725,7 +736,11 @@ private fun RenderClassifiedsReaderForThread(
|
|||||||
isActive = message.text.isNotBlank(),
|
isActive = message.text.isNotBlank(),
|
||||||
modifier = EditFieldTrailingIconModifier,
|
modifier = EditFieldTrailingIconModifier,
|
||||||
) {
|
) {
|
||||||
note.author?.let { nav(routeToMessage(it, msg, accountViewModel)) }
|
scope.launch(Dispatchers.IO) {
|
||||||
|
note.author?.let {
|
||||||
|
nav(routeToMessage(it, note.toNostrUri() + "\n\n" + msg, accountViewModel))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
colors =
|
colors =
|
||||||
|
|||||||
Reference in New Issue
Block a user