Improves display of the drop down when adding relays.
This commit is contained in:
+3
-1
@@ -46,6 +46,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.R
|
||||
import com.vitorpamplona.amethyst.commons.model.nip28PublicChats.PublicChatChannel
|
||||
import com.vitorpamplona.amethyst.ui.actions.uploads.SelectSingleFromGallery
|
||||
@@ -222,8 +223,9 @@ private fun ChannelMetadataScaffold(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteHomeRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -69,8 +70,9 @@ fun LazyListScope.renderBlockedItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -70,7 +71,8 @@ fun LazyListScope.renderBroadcastItems(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -37,6 +37,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalClipboardManager
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import com.vitorpamplona.amethyst.R
|
||||
import com.vitorpamplona.amethyst.model.nip11RelayInfo.Nip11CachedRetriever
|
||||
import com.vitorpamplona.amethyst.model.nip11RelayInfo.loadRelayInfo
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.note.RenderRelayIcon
|
||||
@@ -61,6 +62,7 @@ fun BasicRelaySetupInfoClickableRow(
|
||||
loadRobohash: Boolean,
|
||||
onDelete: ((BasicRelaySetupInfo) -> Unit)?,
|
||||
onClick: () -> Unit,
|
||||
nip11CachedRetriever: Nip11CachedRetriever,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
@@ -79,7 +81,7 @@ fun BasicRelaySetupInfoClickableRow(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = HalfVertPadding,
|
||||
) {
|
||||
val iconUrlFromRelayInfoDoc by loadRelayInfo(item.relay)
|
||||
val iconUrlFromRelayInfoDoc by loadRelayInfo(item.relay, nip11CachedRetriever)
|
||||
|
||||
RenderRelayIcon(
|
||||
iconUrlFromRelayInfoDoc.id ?: item.relay.displayUrl(),
|
||||
|
||||
+4
-1
@@ -21,6 +21,7 @@
|
||||
package com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.vitorpamplona.amethyst.model.nip11RelayInfo.Nip11CachedRetriever
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.Route
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -28,6 +29,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@Composable
|
||||
fun BasicRelaySetupInfoDialog(
|
||||
item: BasicRelaySetupInfo,
|
||||
nip11CachedRetriever: Nip11CachedRetriever,
|
||||
onDelete: ((BasicRelaySetupInfo) -> Unit)?,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
@@ -37,8 +39,9 @@ fun BasicRelaySetupInfoDialog(
|
||||
loadProfilePicture = accountViewModel.settings.showProfilePictures(),
|
||||
loadRobohash = accountViewModel.settings.isNotPerformanceMode(),
|
||||
onDelete = onDelete,
|
||||
accountViewModel = accountViewModel,
|
||||
onClick = { nav.nav(Route.RelayInfo(item.relay.url)) },
|
||||
nip11CachedRetriever = nip11CachedRetriever,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
+15
-4
@@ -20,10 +20,12 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common
|
||||
|
||||
import android.R.id.input
|
||||
import androidx.compose.runtime.Stable
|
||||
import com.vitorpamplona.amethyst.model.LocalCache
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
@@ -31,11 +33,11 @@ import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
@Stable
|
||||
class RelaySuggestionState {
|
||||
class RelaySuggestionState : IRelaySuggestionState {
|
||||
val currentInput = MutableStateFlow("")
|
||||
|
||||
@OptIn(FlowPreview::class)
|
||||
val results =
|
||||
override val results =
|
||||
currentInput
|
||||
.debounce(300)
|
||||
.distinctUntilChanged()
|
||||
@@ -52,11 +54,20 @@ class RelaySuggestionState {
|
||||
}
|
||||
}.flowOn(Dispatchers.IO)
|
||||
|
||||
fun processInput(input: String) {
|
||||
override fun processInput(input: String) {
|
||||
currentInput.tryEmit(input)
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
override fun reset() {
|
||||
currentInput.tryEmit("")
|
||||
}
|
||||
}
|
||||
|
||||
@Stable
|
||||
interface IRelaySuggestionState {
|
||||
val results: Flow<List<BasicRelaySetupInfo>>
|
||||
|
||||
fun processInput(input: String)
|
||||
|
||||
fun reset()
|
||||
}
|
||||
|
||||
+137
-61
@@ -20,13 +20,15 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults.cardElevation
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Text
|
||||
@@ -35,33 +37,81 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.R
|
||||
import com.vitorpamplona.amethyst.model.nip11RelayInfo.Nip11CachedRetriever
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.stringRes
|
||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
||||
import com.vitorpamplona.amethyst.ui.theme.HalfHorzPadding
|
||||
import com.vitorpamplona.amethyst.ui.theme.PopupUpEffect
|
||||
import com.vitorpamplona.amethyst.ui.theme.StdEndPadding
|
||||
import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn
|
||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.client.stats.RelayStat
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.normalizeRelayUrl
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun RelayUrlEditFieldPreview() {
|
||||
val suggestions =
|
||||
listOf(
|
||||
BasicRelaySetupInfo(
|
||||
relay = "wss://nos.lol".normalizeRelayUrl(),
|
||||
relayStat =
|
||||
RelayStat(
|
||||
receivedBytes = 1000,
|
||||
sentBytes = 1000,
|
||||
spamCounter = 12,
|
||||
errorCounter = 0,
|
||||
),
|
||||
),
|
||||
BasicRelaySetupInfo(
|
||||
relay = "wss://nostr.mom".normalizeRelayUrl(),
|
||||
relayStat =
|
||||
RelayStat(
|
||||
receivedBytes = 1000,
|
||||
sentBytes = 1000,
|
||||
spamCounter = 12,
|
||||
errorCounter = 0,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val relaySuggestions =
|
||||
remember {
|
||||
object : IRelaySuggestionState {
|
||||
override val results: Flow<List<BasicRelaySetupInfo>> =
|
||||
MutableStateFlow(suggestions)
|
||||
|
||||
override fun processInput(input: String) {}
|
||||
|
||||
override fun reset() {}
|
||||
}
|
||||
}
|
||||
|
||||
val accountViewModel = mockAccountViewModel()
|
||||
|
||||
ThemeComparisonColumn {
|
||||
RelayUrlEditField(
|
||||
onNewRelay = {},
|
||||
accountViewModel = mockAccountViewModel(),
|
||||
relaySuggestions = relaySuggestions,
|
||||
nip11CachedRetriever = Nip11CachedRetriever { TODO() },
|
||||
accountViewModel = accountViewModel,
|
||||
nav = EmptyNav(),
|
||||
)
|
||||
}
|
||||
@@ -73,11 +123,29 @@ fun RelayUrlEditField(
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
var url by remember { mutableStateOf("") }
|
||||
val relaySuggestions = remember { RelaySuggestionState() }
|
||||
val nip11CachedRetriever = remember { Amethyst.instance.nip11Cache }
|
||||
RelayUrlEditField(
|
||||
onNewRelay = onNewRelay,
|
||||
relaySuggestions = relaySuggestions,
|
||||
nip11CachedRetriever = nip11CachedRetriever,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun RelayUrlEditField(
|
||||
onNewRelay: (NormalizedRelayUrl) -> Unit,
|
||||
relaySuggestions: IRelaySuggestionState,
|
||||
nip11CachedRetriever: Nip11CachedRetriever,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
var url by remember { mutableStateOf("") }
|
||||
|
||||
fun submitRelay() {
|
||||
if (url.isNotBlank() && url != "/") {
|
||||
if (url.isNotBlank()) {
|
||||
val relay = RelayUrlNormalizer.normalizeOrNull(url)
|
||||
if (relay != null) {
|
||||
onNewRelay(relay)
|
||||
@@ -88,61 +156,69 @@ fun RelayUrlEditField(
|
||||
}
|
||||
|
||||
Column {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(Size10dp)) {
|
||||
OutlinedTextField(
|
||||
label = { Text(text = stringRes(R.string.add_a_relay)) },
|
||||
modifier = Modifier.weight(1f),
|
||||
value = url,
|
||||
onValueChange = {
|
||||
url = it
|
||||
relaySuggestions.processInput(it)
|
||||
},
|
||||
placeholder = {
|
||||
Text(
|
||||
text = "server.com",
|
||||
color = MaterialTheme.colorScheme.placeholderText,
|
||||
maxLines = 1,
|
||||
)
|
||||
},
|
||||
singleLine = true,
|
||||
keyboardOptions =
|
||||
KeyboardOptions.Default.copy(
|
||||
autoCorrectEnabled = false,
|
||||
imeAction = ImeAction.Go,
|
||||
capitalization = KeyboardCapitalization.None,
|
||||
keyboardType = KeyboardType.Text,
|
||||
),
|
||||
keyboardActions =
|
||||
KeyboardActions(
|
||||
onGo = { submitRelay() },
|
||||
),
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = { submitRelay() },
|
||||
shape = ButtonBorder,
|
||||
colors =
|
||||
ButtonDefaults.buttonColors(
|
||||
containerColor =
|
||||
if (url.isNotBlank()) {
|
||||
MaterialTheme.colorScheme.primary
|
||||
} else {
|
||||
MaterialTheme.colorScheme.placeholderText
|
||||
},
|
||||
),
|
||||
) {
|
||||
Text(text = stringRes(id = R.string.add), color = Color.White)
|
||||
}
|
||||
}
|
||||
|
||||
ShowRelaySuggestionList(
|
||||
relaySuggestions = relaySuggestions,
|
||||
onSelect = { relay ->
|
||||
url = relay.url
|
||||
relaySuggestions.reset()
|
||||
OutlinedTextField(
|
||||
label = { Text(text = stringRes(R.string.add_a_relay)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = url,
|
||||
onValueChange = {
|
||||
url = it
|
||||
relaySuggestions.processInput(it)
|
||||
},
|
||||
placeholder = {
|
||||
Text(
|
||||
text = "server.com",
|
||||
color = MaterialTheme.colorScheme.placeholderText,
|
||||
maxLines = 1,
|
||||
)
|
||||
},
|
||||
singleLine = true,
|
||||
keyboardOptions =
|
||||
KeyboardOptions.Default.copy(
|
||||
autoCorrectEnabled = false,
|
||||
imeAction = ImeAction.Go,
|
||||
capitalization = KeyboardCapitalization.None,
|
||||
keyboardType = KeyboardType.Text,
|
||||
),
|
||||
keyboardActions =
|
||||
KeyboardActions(
|
||||
onGo = { submitRelay() },
|
||||
),
|
||||
trailingIcon = {
|
||||
Button(
|
||||
onClick = { submitRelay() },
|
||||
shape = ButtonBorder,
|
||||
colors =
|
||||
ButtonDefaults.buttonColors(
|
||||
containerColor =
|
||||
if (url.isNotBlank()) {
|
||||
MaterialTheme.colorScheme.primary
|
||||
} else {
|
||||
MaterialTheme.colorScheme.placeholderText
|
||||
},
|
||||
),
|
||||
modifier = StdEndPadding,
|
||||
) {
|
||||
Text(text = stringRes(id = R.string.add), color = Color.White)
|
||||
}
|
||||
},
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier = Modifier.padding(horizontal = 1.dp),
|
||||
elevation = cardElevation(5.dp),
|
||||
shape = PopupUpEffect,
|
||||
) {
|
||||
ShowRelaySuggestionList(
|
||||
relaySuggestions = relaySuggestions,
|
||||
onSelect = { relay ->
|
||||
url = relay.url
|
||||
relaySuggestions.reset()
|
||||
},
|
||||
modifier = HalfHorzPadding,
|
||||
nip11CachedRetriever = nip11CachedRetriever,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -27,6 +27,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.model.nip11RelayInfo.Nip11CachedRetriever
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||
@@ -34,9 +35,10 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
|
||||
@Composable
|
||||
fun ShowRelaySuggestionList(
|
||||
relaySuggestions: RelaySuggestionState,
|
||||
relaySuggestions: IRelaySuggestionState,
|
||||
onSelect: (NormalizedRelayUrl) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
nip11CachedRetriever: Nip11CachedRetriever,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
@@ -51,6 +53,7 @@ fun ShowRelaySuggestionList(
|
||||
loadRobohash = accountViewModel.settings.isNotPerformanceMode(),
|
||||
onClick = { onSelect(relayInfo.relay) },
|
||||
onDelete = null,
|
||||
nip11CachedRetriever = nip11CachedRetriever,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
||||
+3
-1
@@ -28,6 +28,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -64,8 +65,9 @@ fun LazyListScope.renderConnectedItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = null,
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -68,6 +69,7 @@ fun LazyListScope.renderDMItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -69,8 +70,9 @@ fun LazyListScope.renderFavoriteItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -69,8 +70,9 @@ fun LazyListScope.renderIndexerItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -68,8 +69,9 @@ fun LazyListScope.renderLocalItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -68,8 +69,9 @@ fun LazyListScope.renderPrivateOutboxItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -111,8 +112,9 @@ fun LazyListScope.renderNip65HomeItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteHomeRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -136,8 +138,9 @@ fun LazyListScope.renderNip65NotifItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteNotifRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -69,8 +70,9 @@ fun LazyListScope.renderProxyItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -69,8 +70,9 @@ fun LazyListScope.renderSearchItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.rememberExtendedNav
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
@@ -69,8 +70,9 @@ fun LazyListScope.renderTrustedItems(
|
||||
BasicRelaySetupInfoDialog(
|
||||
item,
|
||||
onDelete = { postViewModel.deleteRelay(item) },
|
||||
nip11CachedRetriever = Amethyst.instance.nip11Cache,
|
||||
accountViewModel = accountViewModel,
|
||||
nav,
|
||||
nav = nav,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@ val Size100dp = 100.dp
|
||||
val Size110dp = 110.dp
|
||||
val Size165dp = 165.dp
|
||||
|
||||
val StdEndPadding = Modifier.padding(end = 10.dp)
|
||||
val HalfEndPadding = Modifier.padding(end = 5.dp)
|
||||
val HalfStartPadding = Modifier.padding(start = 5.dp)
|
||||
val StdStartPadding = Modifier.padding(start = 10.dp)
|
||||
|
||||
Reference in New Issue
Block a user