mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
improve get current platform logic
This commit is contained in:
parent
8ef83d8e7c
commit
935d61f08c
@ -44,7 +44,11 @@ interface PlatformFInder {
|
||||
}
|
||||
|
||||
private class JvmPlatformFinder : PlatformFInder {
|
||||
override fun getCurrentPlatform(): Platform {
|
||||
private val _platform by lazy {
|
||||
getCurrentPlatformFromJVMProperty()
|
||||
}
|
||||
|
||||
private fun getCurrentPlatformFromJVMProperty(): Platform {
|
||||
val osString = System.getProperty("os.name").lowercase()
|
||||
return when {
|
||||
osString.contains("android") -> Android
|
||||
@ -54,6 +58,10 @@ private class JvmPlatformFinder : PlatformFInder {
|
||||
else -> error("this platform is not detected: $osString")
|
||||
}
|
||||
}
|
||||
|
||||
override fun getCurrentPlatform(): Platform {
|
||||
return _platform
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface DesktopPlatform
|
||||
|
Loading…
x
Reference in New Issue
Block a user