mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
detekt cleanup (#2159)
This commit is contained in:
parent
e205f1d6d6
commit
ca69051075
1 changed files with 2 additions and 5 deletions
|
|
@ -400,6 +400,7 @@ class RadioConfigViewModel @Inject constructor(
|
|||
writeSecurityKeysJsonToUri(uri, securityConfig)
|
||||
}
|
||||
|
||||
private val indentSpaces = 4
|
||||
private suspend fun writeSecurityKeysJsonToUri(uri: Uri, securityConfig: SecurityConfig) =
|
||||
withContext(Dispatchers.IO) {
|
||||
try {
|
||||
|
|
@ -408,7 +409,6 @@ class RadioConfigViewModel @Inject constructor(
|
|||
val privateKeyBytes =
|
||||
securityConfig.privateKey.toByteArray()
|
||||
|
||||
|
||||
// Convert byte arrays to Base64 strings for human readability in JSON
|
||||
val publicKeyBase64 = Base64.encodeToString(publicKeyBytes, Base64.NO_WRAP)
|
||||
val privateKeyBase64 = Base64.encodeToString(privateKeyBytes, Base64.NO_WRAP)
|
||||
|
|
@ -422,7 +422,7 @@ class RadioConfigViewModel @Inject constructor(
|
|||
|
||||
// Convert JSON object to a string
|
||||
val jsonString =
|
||||
jsonObject.toString(4)
|
||||
jsonObject.toString(indentSpaces)
|
||||
|
||||
app.contentResolver.openFileDescriptor(uri, "wt")?.use { parcelFileDescriptor ->
|
||||
FileOutputStream(parcelFileDescriptor.fileDescriptor).use { outputStream ->
|
||||
|
|
@ -430,15 +430,12 @@ class RadioConfigViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
setResponseStateSuccess()
|
||||
|
||||
} catch (ex: Exception) {
|
||||
val errorMessage = "Can't write security keys JSON error: ${ex.message}"
|
||||
errormsg(errorMessage)
|
||||
sendError(ex.customMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun installProfile(protobuf: DeviceProfile) = with(protobuf) {
|
||||
meshService?.beginEditSettings()
|
||||
if (hasLongName() || hasShortName()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue