Merge branch 'main' of https://github.com/vitorpamplona/amethyst
This commit is contained in:
@@ -58,6 +58,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
|
|||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.model.RelayInformation
|
import com.vitorpamplona.amethyst.model.RelayInformation
|
||||||
import com.vitorpamplona.amethyst.model.RelaySetupInfo
|
import com.vitorpamplona.amethyst.model.RelaySetupInfo
|
||||||
|
import com.vitorpamplona.amethyst.service.relays.Constants.defaultRelays
|
||||||
import com.vitorpamplona.amethyst.service.relays.FeedType
|
import com.vitorpamplona.amethyst.service.relays.FeedType
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
@@ -105,6 +106,22 @@ fun NewRelayListView(onClose: () -> Unit, accountViewModel: AccountViewModel, re
|
|||||||
onClose()
|
onClose()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
postViewModel.deleteAll()
|
||||||
|
defaultRelays.forEach {
|
||||||
|
postViewModel.addRelay(it)
|
||||||
|
}
|
||||||
|
postViewModel.relays.value.forEach { item ->
|
||||||
|
loadRelayInfo(item.url, context, scope) {
|
||||||
|
postViewModel.togglePaidRelay(item, it.limitation?.payment_required ?: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(stringResource(R.string.default_relays))
|
||||||
|
}
|
||||||
|
|
||||||
PostButton(
|
PostButton(
|
||||||
onPost = {
|
onPost = {
|
||||||
postViewModel.create()
|
postViewModel.create()
|
||||||
|
|||||||
@@ -90,6 +90,12 @@ class NewRelayListViewModel : ViewModel() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun deleteAll() {
|
||||||
|
_relays.update { relays ->
|
||||||
|
relays.dropWhile { relays.isNotEmpty() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun toggleDownload(relay: RelaySetupInfo) {
|
fun toggleDownload(relay: RelaySetupInfo) {
|
||||||
_relays.update {
|
_relays.update {
|
||||||
it.updated(relay, relay.copy(read = !relay.read))
|
it.updated(relay, relay.copy(read = !relay.read))
|
||||||
|
|||||||
@@ -507,4 +507,5 @@
|
|||||||
<string name="nip05_failed">Nostr address failed verification</string>
|
<string name="nip05_failed">Nostr address failed verification</string>
|
||||||
<string name="nip05_checking">Checking Nostr address</string>
|
<string name="nip05_checking">Checking Nostr address</string>
|
||||||
<string name="select_deselect_all">Select/Deselect all</string>
|
<string name="select_deselect_all">Select/Deselect all</string>
|
||||||
|
<string name="default_relays">Default</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user