Skip to content

Commit c204390

Browse files
committed
feat(v0.5): surface local Fabric dependency warnings before Play
1 parent 9549972 commit c204390

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎launcher-desktop/src/main/kotlin/pl/syntaxdevteam/syntaxlauncher/desktop/ui/SyntaxLauncherApp.kt‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,21 @@ private fun LauncherPanel(
301301
var mutationBusy by remember { mutableStateOf(false) }
302302
var instanceError by remember { mutableStateOf<String?>(null) }
303303
val activeInstance = inventory?.instances?.firstOrNull { it.id == instanceId }
304+
var localModWarnings by remember { mutableStateOf<List<String>>(emptyList()) }
305+
LaunchedEffect(activeInstance?.id, modsBusy) {
306+
localModWarnings = emptyList()
307+
val current = activeInstance
308+
if (current?.loader?.id == "fabric" && !modsBusy) {
309+
localModWarnings = try {
310+
session.modManager.list(current.id).warnings
311+
} catch (cancelled: CancellationException) {
312+
throw cancelled
313+
} catch (failure: Exception) {
314+
listOf(failure.message ?: "Could not inspect local mods.")
315+
}
316+
}
317+
}
318+
304319
val launch by session.coordinator.status.collectAsState()
305320
val process by session.processManager.status.collectAsState()
306321
val processProtectionError by session.launchIssue.collectAsState()
@@ -724,6 +739,19 @@ private fun LauncherPanel(
724739
}
725740
(processProtectionError ?: instanceError)?.let { Text(it, color = MaterialTheme.colorScheme.error,
726741
style = MaterialTheme.typography.bodySmall) }
742+
if (localModWarnings.isNotEmpty()) {
743+
Text("Local mod warnings — review Instances → Mods",
744+
color = MaterialTheme.colorScheme.error,
745+
style = MaterialTheme.typography.labelMedium)
746+
localModWarnings.take(2).forEach { warning ->
747+
Text("• $warning", style = MaterialTheme.typography.bodySmall,
748+
color = MaterialTheme.colorScheme.onSurfaceVariant)
749+
}
750+
if (localModWarnings.size > 2) Text(
751+
"+${localModWarnings.size - 2} additional mod warning(s)",
752+
style = MaterialTheme.typography.bodySmall,
753+
color = MaterialTheme.colorScheme.onSurfaceVariant)
754+
}
727755
}
728756
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.75f))
729757
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {

0 commit comments

Comments
 (0)