Removes the forced search relay selection and helps users setup their relay list for search.

pull/882/head
Vitor Pamplona 2024-05-29 15:21:54 -04:00
rodzic add65b094d
commit 90c9deecd4
9 zmienionych plików z 404 dodań i 113 usunięć

Wyświetl plik

@ -229,32 +229,69 @@ class Account(
val connectToRelaysFlow = val connectToRelaysFlow =
combineTransform( combineTransform(
getNIP65RelayListFlow(),
getDMRelayListFlow(), getDMRelayListFlow(),
getSearchRelayListFlow(),
userProfile().flow().relays.stateFlow, userProfile().flow().relays.stateFlow,
) { dmRelayList, userProfile -> ) { nip65RelayList, dmRelayList, searchRelayList, userProfile ->
val newRelaySet = activeRelays() ?: convertLocalRelays() val baseRelaySet = activeRelays() ?: convertLocalRelays()
val newDMRelaySet = (dmRelayList.note.event as? ChatMessageRelayListEvent)?.relays() val newDMRelaySet = (dmRelayList.note.event as? ChatMessageRelayListEvent)?.relays()?.toSet() ?: emptySet()
val searchRelaySet = (dmRelayList.note.event as? SearchRelayListEvent)?.relays()?.toSet() ?: Constants.defaultSearchRelaySet
val nip65RelaySet = (dmRelayList.note.event as? AdvertisedRelayListEvent)?.relays()
if (newDMRelaySet == null) { var mappedRelaySet =
emit(newRelaySet) baseRelaySet.map {
} else { if (newDMRelaySet.contains(it.url) == true) {
var mappedRelaySet = Relay(it.url, true, true, it.activeTypes + FeedType.PRIVATE_DMS)
newRelaySet.map { } else {
if (newDMRelaySet?.contains(it.url) == true) { it
Relay(it.url, true, true, it.activeTypes + FeedType.PRIVATE_DMS)
} else {
it
}
}
newDMRelaySet.forEach { newUrl ->
if (mappedRelaySet.filter { it.url == newUrl }.isEmpty()) {
mappedRelaySet = mappedRelaySet + Relay(newUrl, true, true, setOf(FeedType.PRIVATE_DMS))
} }
} }
emit(mappedRelaySet.toTypedArray()) newDMRelaySet.forEach { newUrl ->
if (mappedRelaySet.filter { it.url == newUrl }.isEmpty()) {
mappedRelaySet = mappedRelaySet + Relay(newUrl, true, true, setOf(FeedType.PRIVATE_DMS))
}
} }
mappedRelaySet =
mappedRelaySet.map {
if (searchRelaySet.contains(it.url) == true) {
Relay(it.url, true, true, it.activeTypes + FeedType.PRIVATE_DMS)
} else {
it
}
}
searchRelaySet.forEach { newUrl ->
if (mappedRelaySet.filter { it.url == newUrl }.isEmpty()) {
mappedRelaySet = mappedRelaySet + Relay(newUrl, true, true, setOf(FeedType.SEARCH))
}
}
mappedRelaySet =
mappedRelaySet.map { relay ->
val nip65setup = nip65RelaySet?.firstOrNull { relay.url == it.relayUrl }
if (nip65setup != null) {
val read = nip65setup.type == AdvertisedRelayListEvent.AdvertisedRelayType.BOTH || nip65setup.type == AdvertisedRelayListEvent.AdvertisedRelayType.READ
val write = nip65setup.type == AdvertisedRelayListEvent.AdvertisedRelayType.BOTH || nip65setup.type == AdvertisedRelayListEvent.AdvertisedRelayType.READ
Relay(relay.url, read, write, relay.activeTypes)
} else {
relay
}
}
nip65RelaySet?.forEach { newNip65Setup ->
if (mappedRelaySet.filter { it.url == newNip65Setup.relayUrl }.isEmpty()) {
val read = newNip65Setup.type == AdvertisedRelayListEvent.AdvertisedRelayType.BOTH || newNip65Setup.type == AdvertisedRelayListEvent.AdvertisedRelayType.READ
val write = newNip65Setup.type == AdvertisedRelayListEvent.AdvertisedRelayType.BOTH || newNip65Setup.type == AdvertisedRelayListEvent.AdvertisedRelayType.READ
mappedRelaySet = mappedRelaySet + Relay(newNip65Setup.relayUrl, read, write, setOf(FeedType.FOLLOWS, FeedType.PUBLIC_CHATS))
}
}
emit(mappedRelaySet.toTypedArray())
} }
val connectToRelays = connectToRelaysFlow.stateIn(scope, SharingStarted.Eagerly, activeRelays() ?: convertLocalRelays()) val connectToRelays = connectToRelaysFlow.stateIn(scope, SharingStarted.Eagerly, activeRelays() ?: convertLocalRelays())
@ -2463,7 +2500,7 @@ class Account(
// Takes a User's relay list and adds the types of feeds they are active for. // Takes a User's relay list and adds the types of feeds they are active for.
fun activeRelays(): Array<Relay>? { fun activeRelays(): Array<Relay>? {
var usersRelayList = val usersRelayList =
userProfile().latestContactList?.relays()?.map { userProfile().latestContactList?.relays()?.map {
val localFeedTypes = val localFeedTypes =
localRelays.firstOrNull { localRelay -> localRelay.url == it.key }?.feedTypes localRelays.firstOrNull { localRelay -> localRelay.url == it.key }?.feedTypes
@ -2476,24 +2513,6 @@ class Account(
Relay(it.key, it.value.read, it.value.write, localFeedTypes) Relay(it.key, it.value.read, it.value.write, localFeedTypes)
} ?: return null } ?: return null
// Ugly, but forces nostr.band as the only search-supporting relay today.
// TODO: Remove when search becomes more available.
val searchRelays =
usersRelayList.filter { it.url.removeSuffix("/") in Constants.forcedRelaysForSearchSet }
val hasSearchRelay = usersRelayList.any { it.activeTypes.contains(FeedType.SEARCH) }
if (!hasSearchRelay && searchRelays.isEmpty()) {
usersRelayList =
usersRelayList +
Constants.forcedRelayForSearch.map {
Relay(
it.url,
it.read,
it.write,
it.feedTypes,
)
}
}
return usersRelayList.toTypedArray() return usersRelayList.toTypedArray()
} }

Wyświetl plik

@ -52,11 +52,5 @@ object Constants {
RelaySetupInfo("wss://relay.noswhere.com", read = true, write = false, feedTypes = activeTypesSearch), RelaySetupInfo("wss://relay.noswhere.com", read = true, write = false, feedTypes = activeTypesSearch),
) )
val forcedRelayForSearch = val defaultSearchRelaySet = setOf("wss://relay.nostr.band", "wss://nostr.wine", "wss://relay.noswhere.com")
arrayOf(
RelaySetupInfo("wss://relay.nostr.band", read = true, write = false, feedTypes = activeTypesSearch),
RelaySetupInfo("wss://nostr.wine", read = true, write = false, feedTypes = activeTypesSearch),
RelaySetupInfo("wss://relay.noswhere.com", read = true, write = false, feedTypes = activeTypesSearch),
)
val forcedRelaysForSearchSet = forcedRelayForSearch.map { it.url }
} }

Wyświetl plik

@ -0,0 +1,139 @@
/**
* Copyright (c) 2024 Vitor Pamplona
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.vitorpamplona.amethyst.ui.actions.relays
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import androidx.lifecycle.viewmodel.compose.viewModel
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.ui.actions.CloseButton
import com.vitorpamplona.amethyst.ui.actions.SaveButton
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
import com.vitorpamplona.amethyst.ui.theme.imageModifier
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun AddSearchRelayListDialog(
onClose: () -> Unit,
accountViewModel: AccountViewModel,
nav: (String) -> Unit,
) {
val postViewModel: SearchRelayListViewModel = viewModel()
LaunchedEffect(Unit) { postViewModel.load(accountViewModel.account) }
Dialog(
onDismissRequest = onClose,
properties = DialogProperties(usePlatformDefaultWidth = false),
) {
Scaffold(
topBar = {
TopAppBar(
title = {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Spacer(modifier = StdHorzSpacer)
Text(stringResource(R.string.search_relays_title))
SaveButton(
onPost = {
postViewModel.create()
onClose()
},
true,
)
}
},
navigationIcon = {
Spacer(modifier = StdHorzSpacer)
CloseButton(
onPress = {
postViewModel.clear()
onClose()
},
)
},
colors =
TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.surface,
),
)
},
) { pad ->
Column(
modifier =
Modifier.padding(
16.dp,
pad.calculateTopPadding(),
16.dp,
pad.calculateBottomPadding(),
),
verticalArrangement = Arrangement.SpaceAround,
) {
Explanation()
SearchRelayList(postViewModel, accountViewModel, onClose, nav)
}
}
}
}
@Composable
private fun Explanation() {
Card(modifier = MaterialTheme.colorScheme.imageModifier) {
Column(modifier = Modifier.padding(16.dp)) {
Text(
text = stringResource(id = R.string.search_relays_not_found_editing),
)
Spacer(modifier = StdVertSpacer)
Text(
text = stringResource(id = R.string.search_relays_not_found_examples),
)
}
}
}

Wyświetl plik

@ -207,7 +207,7 @@ fun ResetSearchRelays(postViewModel: SearchRelayListViewModel) {
Button( Button(
onClick = { onClick = {
postViewModel.deleteAll() postViewModel.deleteAll()
Constants.forcedRelayForSearch.forEach { postViewModel.addRelay(BasicRelaySetupInfo(it.url)) } Constants.defaultSearchRelaySet.forEach { postViewModel.addRelay(BasicRelaySetupInfo(it)) }
postViewModel.loadRelayDocuments() postViewModel.loadRelayDocuments()
}, },
) { ) {

Wyświetl plik

@ -40,7 +40,6 @@ import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.filled.Groups import androidx.compose.material.icons.filled.Groups
import androidx.compose.material.icons.filled.Paid import androidx.compose.material.icons.filled.Paid
import androidx.compose.material.icons.filled.Public import androidx.compose.material.icons.filled.Public
import androidx.compose.material.icons.filled.Search
import androidx.compose.material.icons.filled.SyncProblem import androidx.compose.material.icons.filled.SyncProblem
import androidx.compose.material.icons.filled.Upload import androidx.compose.material.icons.filled.Upload
import androidx.compose.material3.Button import androidx.compose.material3.Button
@ -310,7 +309,6 @@ fun ClickableRelayItem(
onTogglePrivateDMs = onTogglePrivateDMs, onTogglePrivateDMs = onTogglePrivateDMs,
onTogglePublicChats = onTogglePublicChats, onTogglePublicChats = onTogglePublicChats,
onToggleGlobal = onToggleGlobal, onToggleGlobal = onToggleGlobal,
onToggleSearch = onToggleSearch,
) )
} }
@ -492,7 +490,6 @@ private fun ActiveToggles(
onTogglePrivateDMs: (RelaySetupInfo) -> Unit, onTogglePrivateDMs: (RelaySetupInfo) -> Unit,
onTogglePublicChats: (RelaySetupInfo) -> Unit, onTogglePublicChats: (RelaySetupInfo) -> Unit,
onToggleGlobal: (RelaySetupInfo) -> Unit, onToggleGlobal: (RelaySetupInfo) -> Unit,
onToggleSearch: (RelaySetupInfo) -> Unit,
) { ) {
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
val context = LocalContext.current val context = LocalContext.current
@ -638,40 +635,6 @@ private fun ActiveToggles(
}, },
) )
} }
IconButton(
modifier = Size30Modifier,
onClick = { onToggleSearch(item) },
) {
Icon(
imageVector = Icons.Default.Search,
stringResource(R.string.search_feed),
modifier =
Modifier.padding(horizontal = 5.dp)
.size(15.dp)
.combinedClickable(
onClick = { onToggleSearch(item) },
onLongClick = {
scope.launch {
Toast.makeText(
context,
context.getString(R.string.search_feed),
Toast.LENGTH_SHORT,
)
.show()
}
},
),
tint =
if (item.feedTypes.contains(FeedType.SEARCH)) {
MaterialTheme.colorScheme.allGoodColor
} else {
MaterialTheme.colorScheme.onSurface.copy(
alpha = 0.32f,
)
},
)
}
} }
@Composable @Composable

Wyświetl plik

@ -28,7 +28,6 @@ import com.vitorpamplona.amethyst.service.Nip11CachedRetriever
import com.vitorpamplona.amethyst.service.relays.Constants import com.vitorpamplona.amethyst.service.relays.Constants
import com.vitorpamplona.amethyst.service.relays.FeedType import com.vitorpamplona.amethyst.service.relays.FeedType
import com.vitorpamplona.amethyst.service.relays.RelayPool import com.vitorpamplona.amethyst.service.relays.RelayPool
import com.vitorpamplona.quartz.events.ContactListEvent
import kotlinx.collections.immutable.toImmutableSet import kotlinx.collections.immutable.toImmutableSet
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
@ -76,31 +75,6 @@ class Kind3RelayListViewModel : ViewModel() {
var relayFile = account.userProfile().latestContactList?.relays() var relayFile = account.userProfile().latestContactList?.relays()
if (relayFile != null) { if (relayFile != null) {
// Ugly, but forces nostr.band as the only search-supporting relay today.
// TODO: Remove when search becomes more available.
val needsSearchRelay =
relayFile.none { it.key.removeSuffix("/") in Constants.forcedRelaysForSearchSet } &&
relayFile.none {
account.localRelays
.filter { localRelay -> localRelay.url == it.key }
.firstOrNull()
?.feedTypes
?.contains(FeedType.SEARCH)
?: false
}
if (needsSearchRelay) {
relayFile =
relayFile +
Constants.forcedRelayForSearch.map {
Pair(
it.url,
ContactListEvent.ReadWrite(it.read, it.write),
)
}
}
relayFile relayFile
.map { .map {
val liveRelay = RelayPool.getRelay(it.key) val liveRelay = RelayPool.getRelay(it.key)

Wyświetl plik

@ -0,0 +1,194 @@
/**
* Copyright (c) 2024 Vitor Pamplona
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.vitorpamplona.amethyst.ui.note.elements
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.Account
import com.vitorpamplona.amethyst.model.ThemeType
import com.vitorpamplona.amethyst.ui.actions.relays.AddSearchRelayListDialog
import com.vitorpamplona.amethyst.ui.note.LoadAddressableNote
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import com.vitorpamplona.amethyst.ui.theme.BigPadding
import com.vitorpamplona.amethyst.ui.theme.StdPadding
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn
import com.vitorpamplona.amethyst.ui.theme.imageModifier
import com.vitorpamplona.quartz.crypto.KeyPair
import com.vitorpamplona.quartz.encoders.HexKey
import com.vitorpamplona.quartz.events.SearchRelayListEvent
import fr.acinq.secp256k1.Hex
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
@Preview
@Composable
fun AddInboxRelayForSearchCardPreview() {
val sharedPreferencesViewModel: SharedPreferencesViewModel = viewModel()
val myCoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob())
sharedPreferencesViewModel.init()
sharedPreferencesViewModel.updateTheme(ThemeType.DARK)
val pubkey = "989c3734c46abac7ce3ce229971581a5a6ee39cdd6aa7261a55823fa7f8c4799"
val myAccount =
Account(
keyPair =
KeyPair(
privKey = Hex.decode("0f761f8a5a481e26f06605a1d9b3e9eba7a107d351f43c43a57469b788274499"),
pubKey = Hex.decode(pubkey),
forcePubKeyCheck = false,
),
scope = myCoroutineScope,
)
val accountViewModel =
AccountViewModel(
myAccount,
sharedPreferencesViewModel.sharedPrefs,
)
ThemeComparisonColumn {
AddInboxRelayForSearchCard(
accountViewModel = accountViewModel,
nav = {},
)
}
}
@Composable
fun ObserveRelayListForSearchAndDisplayIfNotFound(
accountViewModel: AccountViewModel,
nav: (String) -> Unit,
) {
ObserveRelayListForSearch(
accountViewModel = accountViewModel,
) { relayListEvent ->
if (relayListEvent == null || relayListEvent.relays().isEmpty()) {
AddInboxRelayForSearchCard(
accountViewModel = accountViewModel,
nav = nav,
)
}
}
}
@Composable
fun ObserveRelayListForSearch(
accountViewModel: AccountViewModel,
inner: @Composable (relayListEvent: SearchRelayListEvent?) -> Unit,
) {
ObserveRelayListForSearch(
pubkey = accountViewModel.account.userProfile().pubkeyHex,
accountViewModel = accountViewModel,
) { relayListEvent ->
inner(relayListEvent)
}
}
@Composable
fun ObserveRelayListForSearch(
pubkey: HexKey,
accountViewModel: AccountViewModel,
inner: @Composable (relayListEvent: SearchRelayListEvent?) -> Unit,
) {
LoadAddressableNote(
SearchRelayListEvent.createAddressTag(pubkey),
accountViewModel,
) { relayList ->
if (relayList != null) {
val relayListNoteState by relayList.live().metadata.observeAsState()
val relayListEvent = relayListNoteState?.note?.event as? SearchRelayListEvent
inner(relayListEvent)
}
}
}
@Composable
fun AddInboxRelayForSearchCard(
accountViewModel: AccountViewModel,
nav: (String) -> Unit,
) {
Column(modifier = StdPadding) {
Card(
modifier = MaterialTheme.colorScheme.imageModifier,
) {
Column(
modifier = BigPadding,
) {
// Title
Text(
text = stringResource(id = R.string.search_relays_not_found),
style =
TextStyle(
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
),
)
Spacer(modifier = StdVertSpacer)
Text(
text = stringResource(id = R.string.search_relays_not_found_description),
)
Spacer(modifier = StdVertSpacer)
var wantsToEditRelays by remember { mutableStateOf(false) }
if (wantsToEditRelays) {
AddSearchRelayListDialog({ wantsToEditRelays = false }, accountViewModel, nav = nav)
}
Button(
onClick = {
wantsToEditRelays = true
},
modifier = Modifier.fillMaxWidth(),
) {
Text(text = stringResource(id = R.string.dm_relays_not_found_create_now))
}
}
}
}
}

Wyświetl plik

@ -85,6 +85,7 @@ import com.vitorpamplona.amethyst.ui.note.NoteCompose
import com.vitorpamplona.amethyst.ui.note.SearchIcon import com.vitorpamplona.amethyst.ui.note.SearchIcon
import com.vitorpamplona.amethyst.ui.note.UserCompose import com.vitorpamplona.amethyst.ui.note.UserCompose
import com.vitorpamplona.amethyst.ui.note.UsernameDisplay import com.vitorpamplona.amethyst.ui.note.UsernameDisplay
import com.vitorpamplona.amethyst.ui.note.elements.ObserveRelayListForSearchAndDisplayIfNotFound
import com.vitorpamplona.amethyst.ui.theme.DividerThickness import com.vitorpamplona.amethyst.ui.theme.DividerThickness
import com.vitorpamplona.amethyst.ui.theme.FeedPadding import com.vitorpamplona.amethyst.ui.theme.FeedPadding
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
@ -154,6 +155,7 @@ fun SearchScreen(
Column(Modifier.fillMaxSize()) { Column(Modifier.fillMaxSize()) {
SearchBar(searchBarViewModel, listState) SearchBar(searchBarViewModel, listState)
ObserveRelayListForSearchAndDisplayIfNotFound(accountViewModel, nav)
DisplaySearchResults(searchBarViewModel, listState, nav, accountViewModel) DisplaySearchResults(searchBarViewModel, listState, nav, accountViewModel)
} }
} }

Wyświetl plik

@ -809,15 +809,21 @@
<string name="dm_relays_not_found">Set up your Private Inbox relays</string> <string name="dm_relays_not_found">Set up your Private Inbox relays</string>
<string name="dm_relays_not_found_description">This setting lets everybody know which relays to use when sending messages to you. Without them you might miss some messages.</string> <string name="dm_relays_not_found_description">This setting lets everybody know which relays to use when sending messages to you. Without them you might miss some messages.</string>
<string name="dm_relays_not_found_examples">Good options are:\n - inbox.nostr.wine (paid)\n - you.nostr1.com (personal relays - paid)</string> <string name="dm_relays_not_found_examples">Good options are:\n - inbox.nostr.wine (paid)\n - you.nostr1.com (personal relays - paid)</string>
<string name="dm_relays_not_found_editing">Insert between 1-3 relays to serve as your private inbox. DM Inbox relays should accept any message from anyone, but only allow you to download them.</string> <string name="dm_relays_not_found_editing">Insert between 13 relays to serve as your private inbox. DM Inbox relays should accept any message from anyone, but only allow you to download them.</string>
<string name="dm_relays_not_found_create_now">Set up now</string> <string name="dm_relays_not_found_create_now">Set up now</string>
<string name="search_relays_title">Search Relays</string>
<string name="search_relays_not_found">Set up your Search relays</string>
<string name="search_relays_not_found_description">Creating a relay list specifically designed for search and user tagging will improve these results.</string>
<string name="search_relays_not_found_editing">Insert between 1–3 relays to use when searching for content or tagging users. Make sure your chosen relays implement NIP-50</string>
<string name="search_relays_not_found_examples">Good options are:\n - nostr.wine\n - relay.nostr.band\n - relay.noswhere.com</string>
<string name="public_home_section">Public Home Relays</string> <string name="public_home_section">Public Home Relays</string>
<string name="public_home_section_explainer">This relay type stores all your content. Amethyst will send your posts here and others will use these relays to find your content. Insert between 1-3 relays. They can be personal relays, paid relays or public relays.</string> <string name="public_home_section_explainer">This relay type stores all your content. Amethyst will send your posts here and others will use these relays to find your content. Insert between 13 relays. They can be personal relays, paid relays or public relays.</string>
<string name="public_notif_section">Public Inbox Relays</string> <string name="public_notif_section">Public Inbox Relays</string>
<string name="public_notif_section_explainer">This relay type receives all replies, comments, likes and zaps to your posts. Insert between 1-3 relays and make sure they accept posts from anyone.</string> <string name="public_notif_section_explainer">This relay type receives all replies, comments, likes and zaps to your posts. Insert between 13 relays and make sure they accept posts from anyone.</string>
<string name="private_inbox_section">DM Inbox Relays</string> <string name="private_inbox_section">DM Inbox Relays</string>
<string name="private_inbox_section_explainer">Insert between 1-3 relays to serve as your private inbox. Others will use these relays to send DMs to you. DM Inbox relays should accept any message from anyone, but only allow you to download them. Good options are:\n - inbox.nostr.wine (paid)\n - you.nostr1.com (personal relays - paid)</string> <string name="private_inbox_section_explainer">Insert between 13 relays to serve as your private inbox. Others will use these relays to send DMs to you. DM Inbox relays should accept any message from anyone, but only allow you to download them. Good options are:\n - inbox.nostr.wine (paid)\n - you.nostr1.com (personal relays - paid)</string>
<string name="kind_3_section">General Relays</string> <string name="kind_3_section">General Relays</string>
<string name="kind_3_section_description">Amethyst uses these relays to download posts for you.</string> <string name="kind_3_section_description">Amethyst uses these relays to download posts for you.</string>
<string name="search_section">Search Relays</string> <string name="search_section">Search Relays</string>