fix(settings): pass the connection dialect when listing known servers in discovery

PR #1666 merged without compiling: it maps existing connections into the
add-server discovered list, but DiscoveredJellyfinServer gained a required
dialect with the Emby backend. Carry the connection's dialect through and
list only connections matching the screen's dialect, so the Add Emby screen
does not offer existing Jellyfin servers.
This commit is contained in:
edde746
2026-08-23 10:30:36 +02:00
parent 0964ab8ba2
commit 02a5f8ad2c
+16 -8
View File
@@ -158,15 +158,23 @@ class _AddJellyfinScreenState extends State<AddJellyfinScreen> with AsyncFormSta
Future<void> _discoverLocalServers() async {
final attemptId = ++_localDiscoveryAttemptId;
try {
List<Connection> existingConnections = const <Connection>[];
try {
existingConnections = await context.read<ConnectionRegistry>().list();
} on ProviderNotFoundException {
// No ConnectionRegistry in the tree (tests / isolated subtrees).
}
final existing = existingConnections
List<Connection> existingConnections = const <Connection>[];
try {
existingConnections = await context.read<ConnectionRegistry>().list();
} on ProviderNotFoundException {
// No ConnectionRegistry in the tree (tests / isolated subtrees).
}
final existing = existingConnections
.whereType<JellyfinConnection>()
.map((c) => DiscoveredJellyfinServer(address: c.baseUrl, id: c.serverMachineId, name: c.serverName));
.where((c) => c.dialect == widget.dialect)
.map(
(c) => DiscoveredJellyfinServer(
address: c.baseUrl,
id: c.serverMachineId,
name: c.serverName,
dialect: c.dialect,
),
);
final factory = widget._localDiscoveryFactory;
final lanServers = factory != null