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

View File

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