From 11aea3f1c45af85782fa746d56a104602fd3a159 Mon Sep 17 00:00:00 2001 From: Zane Schepke Date: Mon, 25 Sep 2023 06:49:07 -0400 Subject: [PATCH] fix: trusted SSIDs bug Fixes bugs where trusted SSIDs were getting whitespace added every time they were saved to the DB. Fixes file explorer bug on AndroidTV where the app crashes if they do not have a file explorer installed on the device. --- app/build.gradle.kts | 4 ++-- .../repository/DatabaseListConverters.kt | 2 +- .../wireguardautotunnel/ui/screens/main/MainScreen.kt | 8 ++++++-- app/src/main/res/values/strings.xml | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index dce8bc1..f9dddd8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,8 +14,8 @@ android { applicationId = "com.zaneschepke.wireguardautotunnel" minSdk = 26 targetSdk = 34 - versionCode = 30001 - versionName = "3.0.1" + versionCode = 30002 + versionName = "3.0.2" multiDexEnabled = true diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/repository/DatabaseListConverters.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/repository/DatabaseListConverters.kt index e4e94c8..aee8e76 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/repository/DatabaseListConverters.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/repository/DatabaseListConverters.kt @@ -5,7 +5,7 @@ import androidx.room.TypeConverter class DatabaseListConverters { @TypeConverter fun listToString(value: MutableList): String { - return value.joinToString() + return value.joinToString(",") } @TypeConverter fun stringToList(value: String): MutableList { diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt index 3a8195f..a8d52af 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt @@ -214,7 +214,11 @@ fun MainScreen( addCategory(Intent.CATEGORY_OPENABLE) type = Constants.ALLOWED_FILE_TYPES } - pickFileLauncher.launch(fileSelectionIntent) + if (fileSelectionIntent.resolveActivity(context.packageManager) != null) { + pickFileLauncher.launch(fileSelectionIntent) + } else { + viewModel.showSnackBarMessage(context.getString(R.string.no_file_app)) + } } .padding(10.dp) ) { @@ -271,7 +275,7 @@ fun MainScreen( .nestedScroll(nestedScrollConnection), ) { items(tunnels, key = { tunnel -> tunnel.id }) {tunnel -> - val focusRequester = FocusRequester() + val focusRequester = remember { FocusRequester() } RowListItem(leadingIcon = Icons.Rounded.Circle, leadingIconColor = if (tunnelName == tunnel.name) when (handshakeStatus) { HandshakeStatus.HEALTHY -> mint diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cfbec0b..cc42aeb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -96,4 +96,5 @@ Never Failed to open file stream. An unknown error occurred. + No file app installed. \ No newline at end of file