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.
This commit is contained in:
Zane Schepke 2023-09-25 06:49:07 -04:00
parent 7fbc51af4c
commit 11aea3f1c4
4 changed files with 10 additions and 5 deletions

View File

@ -14,8 +14,8 @@ android {
applicationId = "com.zaneschepke.wireguardautotunnel" applicationId = "com.zaneschepke.wireguardautotunnel"
minSdk = 26 minSdk = 26
targetSdk = 34 targetSdk = 34
versionCode = 30001 versionCode = 30002
versionName = "3.0.1" versionName = "3.0.2"
multiDexEnabled = true multiDexEnabled = true

View File

@ -5,7 +5,7 @@ import androidx.room.TypeConverter
class DatabaseListConverters { class DatabaseListConverters {
@TypeConverter @TypeConverter
fun listToString(value: MutableList<String>): String { fun listToString(value: MutableList<String>): String {
return value.joinToString() return value.joinToString(",")
} }
@TypeConverter @TypeConverter
fun <T> stringToList(value: String): MutableList<String> { fun <T> stringToList(value: String): MutableList<String> {

View File

@ -214,7 +214,11 @@ fun MainScreen(
addCategory(Intent.CATEGORY_OPENABLE) addCategory(Intent.CATEGORY_OPENABLE)
type = Constants.ALLOWED_FILE_TYPES 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) .padding(10.dp)
) { ) {
@ -271,7 +275,7 @@ fun MainScreen(
.nestedScroll(nestedScrollConnection), .nestedScroll(nestedScrollConnection),
) { ) {
items(tunnels, key = { tunnel -> tunnel.id }) {tunnel -> items(tunnels, key = { tunnel -> tunnel.id }) {tunnel ->
val focusRequester = FocusRequester() val focusRequester = remember { FocusRequester() }
RowListItem(leadingIcon = Icons.Rounded.Circle, RowListItem(leadingIcon = Icons.Rounded.Circle,
leadingIconColor = if (tunnelName == tunnel.name) when (handshakeStatus) { leadingIconColor = if (tunnelName == tunnel.name) when (handshakeStatus) {
HandshakeStatus.HEALTHY -> mint HandshakeStatus.HEALTHY -> mint

View File

@ -96,4 +96,5 @@
<string name="never">Never</string> <string name="never">Never</string>
<string name="stream_failed">Failed to open file stream.</string> <string name="stream_failed">Failed to open file stream.</string>
<string name="unknown_error_message">An unknown error occurred.</string> <string name="unknown_error_message">An unknown error occurred.</string>
<string name="no_file_app">No file app installed.</string>
</resources> </resources>