mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 20:48:24 +00:00
Prevent from removing last relay, adjust bootstrap relay group
This commit is contained in:
+2
-1
@@ -219,7 +219,8 @@ final appInitializationProvider = FutureProvider<void>((ref) async {
|
|||||||
),
|
),
|
||||||
defaultRelays: {
|
defaultRelays: {
|
||||||
'default': {'wss://relay.zapstore.dev'},
|
'default': {'wss://relay.zapstore.dev'},
|
||||||
'bootstrap': {'wss://purplepag.es', 'wss://relay.zapstore.dev'},
|
'bootstrap': {'wss://relay.zapstore.dev'},
|
||||||
|
// TODO: add 'wss://purplepag.es' back when it's fixed
|
||||||
'AppCatalog': {'wss://relay.zapstore.dev'},
|
'AppCatalog': {'wss://relay.zapstore.dev'},
|
||||||
'social': {
|
'social': {
|
||||||
'wss://relay.damus.io',
|
'wss://relay.damus.io',
|
||||||
|
|||||||
@@ -124,7 +124,17 @@ class RelayManagementCard extends HookConsumerWidget {
|
|||||||
|
|
||||||
void removeRelay(String relayUrl) {
|
void removeRelay(String relayUrl) {
|
||||||
final currentRelays = pendingRelays.value ?? savedRelays;
|
final currentRelays = pendingRelays.value ?? savedRelays;
|
||||||
pendingRelays.value = currentRelays.where((r) => r != relayUrl).toList();
|
final newRelays = currentRelays.where((r) => r != relayUrl).toList();
|
||||||
|
// App catalog relays can never be empty - show error if trying to remove last
|
||||||
|
if (newRelays.isEmpty) {
|
||||||
|
context.showError(
|
||||||
|
'Cannot remove last relay',
|
||||||
|
description: 'App catalog relays cannot be empty. '
|
||||||
|
'Add another relay before removing this one.',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pendingRelays.value = newRelays;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> applyChanges() async {
|
Future<void> applyChanges() async {
|
||||||
|
|||||||
Reference in New Issue
Block a user