make OS icon a public fun

This commit is contained in:
2026-03-11 12:44:24 +05:00
parent fbda9fedfb
commit 7c269d5e59
@@ -47,30 +47,6 @@ import sh.sar.isodroid.ui.theme.MountedGreen
import sh.sar.isodroid.ui.theme.UnmountedGray
import java.io.File
/**
* Finds a matching OS icon filename for a given file by dynamically checking available icons.
*/
private fun findOsIcon(context: android.content.Context, filename: String): String? {
return try {
val availableIcons = context.assets.list("osicons")
?.filter { it.endsWith(".svg", ignoreCase = true) }
?.map { it.removeSuffix(".svg").lowercase() }
?: emptyList()
val lowerFilename = filename.lowercase()
availableIcons
.filter { lowerFilename.contains(it) }
.maxWithOrNull(compareBy(
{ it.length },
{ -lowerFilename.indexOf(it) }
))
?.let { "$it.svg" }
} catch (e: Exception) {
null
}
}
@Composable
fun StatusCard(
mountStatus: MountStatus,