Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ tasks.named("check") {
}

dependencies {
val composeBom = platform("androidx.compose:compose-bom:2024.10.01")
val composeBom = platform("androidx.compose:compose-bom:2026.03.00")
implementation(composeBom)

implementation("androidx.compose.ui:ui")
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />

<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package studio.etsoftware.obdapp.data.logging

import android.net.Uri
import androidx.core.net.toUri
import javax.inject.Inject
import javax.inject.Singleton
import studio.etsoftware.obdapp.domain.model.DebugLogEntry
Expand All @@ -25,5 +25,5 @@ class LogExportRepositoryImpl
override suspend fun export(
destination: String,
content: String,
): Result<Unit> = exporter.export(Uri.parse(destination), content)
): Result<Unit> = exporter.export(destination.toUri(), content)
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
Expand All @@ -69,7 +69,7 @@ fun DashboardScreen(
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
val logs by viewModel.logs.collectAsStateWithLifecycle()
val snackbarHostState = remember { SnackbarHostState() }
val context = LocalContext.current
val resources = LocalResources.current
var showDebugLog by rememberSaveable { mutableStateOf(false) }
var isDisconnecting by rememberSaveable { mutableStateOf(false) }

Expand All @@ -84,13 +84,13 @@ fun DashboardScreen(
viewModel.events.collect { event ->
val message =
when (event) {
DashboardEvent.ExportSuccess -> context.getString(R.string.debug_log_export_success)
DashboardEvent.ExportSkippedNoLogs -> context.getString(R.string.debug_log_export_empty)
DashboardEvent.ExportSuccess -> resources.getString(R.string.debug_log_export_success)
DashboardEvent.ExportSkippedNoLogs -> resources.getString(R.string.debug_log_export_empty)
is DashboardEvent.ExportError -> {
if (event.reason.isNullOrBlank()) {
context.getString(R.string.debug_log_export_failed)
resources.getString(R.string.debug_log_export_failed)
} else {
context.getString(R.string.debug_log_export_failed_with_reason, event.reason)
resources.getString(R.string.debug_log_export_failed_with_reason, event.reason)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.ClipEntry
import androidx.compose.ui.platform.LocalClipboard
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.toClipEntry
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -195,7 +195,7 @@ private fun VinCard(vin: String) {
.fillMaxWidth()
.clickable(enabled = vin.isNotBlank()) {
coroutineScope.launch {
clipboard.setClipEntry(ClipData.newPlainText("VIN", vin).toClipEntry())
clipboard.setClipEntry(ClipEntry(ClipData.newPlainText("VIN", vin)))
Toast.makeText(context, "VIN copied to clipboard", Toast.LENGTH_SHORT).show()
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package studio.etsoftware.obdapp.ui.theme
import android.content.Context
import android.content.ContextWrapper
import android.os.Build
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.enableEdgeToEdge
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -48,9 +49,9 @@ private val LightColorScheme =
onSurfaceVariant = Color(0xFF49454F),
)

private tailrec fun Context.findContextActivity(): androidx.activity.ComponentActivity? =
private tailrec fun Context.findContextActivity(): ComponentActivity? =
when (this) {
is androidx.activity.ComponentActivity -> this
is ComponentActivity -> this
is ContextWrapper -> baseContext.findContextActivity()
else -> null
}
Expand All @@ -61,17 +62,16 @@ fun ObdScannerAppTheme(
dynamicColor: Boolean = false,
content: @Composable () -> Unit,
) {
val context = LocalContext.current
val colorScheme =
when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}

val context = LocalContext.current
SideEffect {
context.findContextActivity()?.enableEdgeToEdge(
statusBarStyle =
Expand Down
Loading