mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-30 12:05:46 +00:00
desktop: theme detector try-catch (#2817)
This commit is contained in:
committed by
GitHub
parent
298dd9744f
commit
7f662ec7cc
@@ -1,5 +1,7 @@
|
||||
package chat.simplex.common.ui.theme
|
||||
|
||||
import chat.simplex.common.platform.Log
|
||||
import chat.simplex.common.platform.TAG
|
||||
import com.jthemedetecor.OsThemeDetector
|
||||
|
||||
private val detector: OsThemeDetector = OsThemeDetector.getDetector()
|
||||
@@ -7,4 +9,11 @@ private val detector: OsThemeDetector = OsThemeDetector.getDetector()
|
||||
registerListener(::reactOnDarkThemeChanges)
|
||||
}
|
||||
|
||||
actual fun isSystemInDarkTheme(): Boolean = detector.isDark
|
||||
actual fun isSystemInDarkTheme(): Boolean = try {
|
||||
detector.isDark
|
||||
}
|
||||
catch (e: Exception) {
|
||||
Log.e(TAG, e.stackTraceToString())
|
||||
/* On Mac this code can produce exception */
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user