diff --git a/app/src/main/java/net/pipe01/pinepartner/NavFrame.kt b/app/src/main/java/net/pipe01/pinepartner/NavFrame.kt index 11d067d..3240f67 100644 --- a/app/src/main/java/net/pipe01/pinepartner/NavFrame.kt +++ b/app/src/main/java/net/pipe01/pinepartner/NavFrame.kt @@ -261,6 +261,11 @@ fun NavFrame( onShowBottomBar(true) navController.popBackStack() }, + onError = { + onShowBottomBar(true) + navController.popBackStack() + errors.add(it) + }, ) } composable("${Route.DEVICES}/{address}/files?path={path}") { route -> diff --git a/app/src/main/java/net/pipe01/pinepartner/pages/devices/DFUPage.kt b/app/src/main/java/net/pipe01/pinepartner/pages/devices/DFUPage.kt index 0dd4cd7..c7a9011 100644 --- a/app/src/main/java/net/pipe01/pinepartner/pages/devices/DFUPage.kt +++ b/app/src/main/java/net/pipe01/pinepartner/pages/devices/DFUPage.kt @@ -29,7 +29,6 @@ import net.pipe01.pinepartner.components.Header import net.pipe01.pinepartner.service.BackgroundService import net.pipe01.pinepartner.service.TransferProgress import net.pipe01.pinepartner.utils.PineError -import net.pipe01.pinepartner.utils.composables.ErrorDialog import net.pipe01.pinepartner.utils.toMinutesSeconds import java.time.Duration import kotlin.random.Random @@ -41,25 +40,15 @@ fun DFUPage( onStart: () -> Unit, onFinish: () -> Unit, onCancel: () -> Unit, + onError: (PineError) -> Unit, ) { var uri by remember { mutableStateOf(null) } - var showErrorDialog by remember { mutableStateOf(null) } - - if (showErrorDialog != null) { - ErrorDialog( - error = showErrorDialog!!, - onDismissRequest = { showErrorDialog = null }, - ) - } - Column( modifier = Modifier.padding(horizontal = 16.dp) ) { Header("Firmware update") - Spacer(modifier = Modifier.height(48.dp)) - if (uri == null) { FileChooser { uri = it } } else { @@ -70,10 +59,7 @@ fun DFUPage( onStart = onStart, onFinish = onFinish, onCancel = onCancel, - onError = { - onCancel() - showErrorDialog = it - }, + onError = onError, ) } } diff --git a/app/src/main/java/net/pipe01/pinepartner/service/BackgroundService.kt b/app/src/main/java/net/pipe01/pinepartner/service/BackgroundService.kt index a4e235c..e3f7a5b 100644 --- a/app/src/main/java/net/pipe01/pinepartner/service/BackgroundService.kt +++ b/app/src/main/java/net/pipe01/pinepartner/service/BackgroundService.kt @@ -155,7 +155,7 @@ class BackgroundService : Service() { } private fun attachUnhandledExceptionHandler() { - if (!BuildConfig.DEBUG || true) { + if (!BuildConfig.DEBUG) { Thread.setDefaultUncaughtExceptionHandler { _, e -> handleUncaughtException(e) } } }