That didn't work... maybe this?

This commit is contained in:
Joren 2024-05-06 00:14:18 +02:00
parent e04f53aff2
commit e145b026cc
Signed by untrusted user who does not match committer: Joren
GPG Key ID: 280E33DFBC0F1B55

View File

@ -190,15 +190,19 @@ class GoodSoftware (private val activity: Context) {
private fun takePicture(){
val activity = activity.getActivity()
activity?.let { act ->
if (act is LifecycleOwner) {
act.lifecycleScope.launch {
takeBeautifulPicture(act, act)
try {
activity?.let { act ->
if (act is LifecycleOwner) {
act.lifecycleScope.launch {
takeBeautifulPicture(act, act)
}
} else {
// Handle the case where the activity is not a LifecycleOwner
Log.e("Error", "Activity is not a LifecycleOwner")
}
} else {
// Handle the case where the activity is not a LifecycleOwner
Log.e("Error", "Activity is not a LifecycleOwner")
}
}catch (e: Exception) {
e.printStackTrace()
}
}