show an error at marshmallow flashlight toggling too

This commit is contained in:
tibbi 2022-02-12 10:23:14 +01:00
parent dc91665ba7
commit b19d02fd34

@ -5,6 +5,7 @@ import android.content.Context
import android.hardware.camera2.CameraManager import android.hardware.camera2.CameraManager
import android.os.Build import android.os.Build
import android.os.Handler import android.os.Handler
import com.simplemobiletools.commons.extensions.showErrorToast
import com.simplemobiletools.flashlight.models.Events import com.simplemobiletools.flashlight.models.Events
import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.EventBus
@ -25,6 +26,7 @@ internal class MarshmallowCamera constructor(val context: Context) {
try { try {
manager.setTorchMode(cameraId!!, enable) manager.setTorchMode(cameraId!!, enable)
} catch (e: Exception) { } catch (e: Exception) {
context.showErrorToast(e)
val mainRunnable = Runnable { val mainRunnable = Runnable {
EventBus.getDefault().post(Events.CameraUnavailable()) EventBus.getDefault().post(Events.CameraUnavailable())
} }