mirror of
https://codeberg.org/bg443/JetBird.git
synced 2025-12-22 13:17:12 +00:00
Add error handling to commit -> tag lookup
This commit is contained in:
13
.idea/deviceManager.xml
generated
Normal file
13
.idea/deviceManager.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DeviceTable">
|
||||||
|
<option name="columnSorters">
|
||||||
|
<list>
|
||||||
|
<ColumnSorterState>
|
||||||
|
<option name="column" value="Name" />
|
||||||
|
<option name="order" value="ASCENDING" />
|
||||||
|
</ColumnSorterState>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -172,10 +172,16 @@ fun getShortNetbirdCommit(): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getNetbirdVersionFromCommit(): String {
|
fun getNetbirdVersionFromCommit(): String {
|
||||||
// val stdout = ByteArrayOutputStream()
|
val stdout = ByteArrayOutputStream()
|
||||||
// exec {
|
val commit = getNetbirdCommit()
|
||||||
// commandLine("git", "-C", "../netbird", "describe", "--tags", "--abbrev=0", getNetbirdCommit())
|
return try {
|
||||||
// standardOutput = stdout
|
exec {
|
||||||
// }
|
commandLine("git", "-C", "../netbird", "describe", "--tags", "--abbrev=0", getNetbirdCommit())
|
||||||
return "\"v0.49.0\""
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
return "\"${stdout.toString().trim()}${if (commit.startsWith('+')) "+" else ""}\""
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println("Failed to get NetBird submodule tag from commit ${commit}: $e")
|
||||||
|
"null"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package dev.bg.jetbird.ui.screens.settings
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.ApplicationInfo
|
import android.content.pm.ApplicationInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
@@ -52,6 +51,7 @@ import androidx.compose.ui.text.input.KeyboardType
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
|
import androidx.core.net.toUri
|
||||||
import androidx.core.os.LocaleListCompat
|
import androidx.core.os.LocaleListCompat
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
@@ -78,6 +78,7 @@ import kotlinx.coroutines.flow.StateFlow
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.io.FileNotFoundException
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -424,7 +425,7 @@ fun SettingsScreen(
|
|||||||
onClick = {
|
onClick = {
|
||||||
ctx.startActivity(
|
ctx.startActivity(
|
||||||
Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
|
Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
|
||||||
data = Uri.parse("package:${ctx.packageName}")
|
data = "package:${ctx.packageName}".toUri()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -438,7 +439,7 @@ fun SettingsScreen(
|
|||||||
)
|
)
|
||||||
SettingsTile(
|
SettingsTile(
|
||||||
title = stringResource(R.string.about_netbird_version),
|
title = stringResource(R.string.about_netbird_version),
|
||||||
description = "${BuildConfig.NETBIRD_COMMIT} (${BuildConfig.NETBIRD_VERSION})"
|
description = "${BuildConfig.NETBIRD_COMMIT} ${if (BuildConfig.NETBIRD_VERSION != null) "(${BuildConfig.NETBIRD_VERSION})" else ""}"
|
||||||
)
|
)
|
||||||
SettingsTile(
|
SettingsTile(
|
||||||
title = stringResource(R.string.credits),
|
title = stringResource(R.string.credits),
|
||||||
@@ -500,7 +501,13 @@ private fun ConfigViewDialog(
|
|||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
val clipboardManager = LocalClipboardManager.current
|
val clipboardManager = LocalClipboardManager.current
|
||||||
|
|
||||||
val config = remember(state) { File(ctx.getConfigPath()).readText() }
|
val config = remember(state) {
|
||||||
|
try {
|
||||||
|
File(ctx.getConfigPath()).readText()
|
||||||
|
} catch (e: FileNotFoundException) {
|
||||||
|
"NetBird config not found"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (open) {
|
if (open) {
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
|
|||||||
Reference in New Issue
Block a user