Coding style changes

This commit is contained in:
Juha Heinanen
2026-05-19 18:56:51 +03:00
parent cbcd0e7f7d
commit ed726ffe6a
4 changed files with 46 additions and 58 deletions

View File

@ -404,11 +404,7 @@ class BaresipService: Service() {
cleanService()
isServiceRunning = false
postServiceEvent(
ServiceEvent(
"stopped",
arrayListOf(""),
System.nanoTime()
)
ServiceEvent("stopped", arrayListOf(""), System.nanoTime())
)
stopSelf()
// exitProcess(0)
@ -461,13 +457,11 @@ class BaresipService: Service() {
if (!file.exists() && a != "config") {
Log.i(TAG, "Copying asset '$a'")
Utils.copyAssetToFile(this, a, "$filesPath/$a")
} else {
else
Log.i(TAG, "Asset '$a' already copied")
}
if (a == "config") {
if (a == "config")
Config.initialize(this)
}
}
if (contactsMode != "android")
Contact.restoreBaresipContacts()
@ -920,8 +914,10 @@ class BaresipService: Service() {
Utils.friendlyUri(this, peerUri, ua.account)
)
else if (ua.account.blockUnknown && Contact.contactName(peerUri) == peerUri)
String.format(getString(R.string.call_blocked),
Utils.friendlyUri(this, peerUri, ua.account))
String.format(
getString(R.string.call_blocked),
Utils.friendlyUri(this, peerUri, ua.account)
)
else if (!Utils.checkPermissions(this, arrayOf(RECORD_AUDIO)))
getString(R.string.no_calls)
else
@ -1222,12 +1218,16 @@ class BaresipService: Service() {
rxFile.delete()
txFile.delete()
} catch (e: Exception) {
Log.w(TAG, "Could not delete temporary raw files " +
"after merge: ${e.message}")
Log.w(
TAG,
"Could not delete temporary raw files after merge: ${e.message}"
)
}
} else {
Log.e(TAG, "Automatic merge failed. " +
"Storing raw file paths as fallback.")
else {
Log.e(
TAG,
"Automatic merge failed. Storing raw file paths as fallback."
)
history.recording = call.dumpfiles
}
}

View File

@ -46,6 +46,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.Chat
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Call
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Remove
@ -680,21 +681,19 @@ private fun UrisSection(
color = MaterialTheme.colorScheme.onBackground,
)
val ua = UserAgent.ofAor(selectedAor)
// Chat Button
if (ua != null)
IconButton(
onClick = {
val aor = viewModel.selectedAor.value
val ua = UserAgent.ofAor(aor)
if (ua == null)
Log.w(TAG, "Message clickable did not find AoR $aor")
else {
if (ua.account.isMobile && Utils.isAirplaneModeOn(ctx)) {
if (ua.account.isMobile && Utils.isAirplaneModeOn(ctx))
handleDialog(ctx, ctx.getString(R.string.notice),
ctx.getString(R.string.airplane_mode))
} else if (ua.account.isMobile && !Utils.isDefaultSmsApp(ctx)) {
else if (ua.account.isMobile && !Utils.isDefaultSmsApp(ctx))
handleDialog(ctx, ctx.getString(R.string.notice),
ctx.getString(R.string.enable_default_messaging))
} else {
else {
val intent = Intent(ctx, MainActivity::class.java)
intent.putExtra("uap", ua.uap)
intent.putExtra("peer", uri)
@ -705,27 +704,23 @@ private fun UrisSection(
}
}
}
}
) {
Icon(
imageVector = Icons.AutoMirrored.Filled.Chat,
contentDescription = "Send Message",
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.onBackground
)
}
// Call Button
if (ua != null)
IconButton(
onClick = {
val aor = viewModel.selectedAor.value
val ua = UserAgent.ofAor(aor)
if (ua == null)
Log.w(TAG, "Call clickable did not find AoR $aor")
else {
if (ua.account.isMobile && Utils.isAirplaneModeOn(ctx)) {
if (ua.account.isMobile && Utils.isAirplaneModeOn(ctx))
handleDialog(ctx, ctx.getString(R.string.notice),
ctx.getString(R.string.airplane_mode))
} else {
else {
val intent = Intent(ctx, MainActivity::class.java)
intent.putExtra("uap", ua.uap)
intent.putExtra("peer", uri)
@ -736,11 +731,11 @@ private fun UrisSection(
}
}
}
}
) {
Icon(
imageVector = Icons.Outlined.Call,
imageVector = Icons.Filled.Call,
contentDescription = "Call",
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.onBackground
)
}

View File

@ -2057,7 +2057,8 @@ private fun callClick(ctx: Context, viewModel: ViewModel, dialerState: ViewModel
else
String.format(ctx.getString(R.string.contact_no_sip_or_tel_uri), uriText)
showAlert.value = true
} else {
}
else
makeCall(
ctx,
viewModel,
@ -2065,7 +2066,6 @@ private fun callClick(ctx: Context, viewModel: ViewModel, dialerState: ViewModel
dialerState
)
}
}
else if (uris.size == 1)
makeCall(
ctx,

View File

@ -16,13 +16,6 @@ class MmsReceiver : BroadcastReceiver() {
val contentType = intent.type
if (contentType == "application/vnd.wap.mms-message") {
Log.d(TAG, "Received MMS WAP Push Deliver")
// For a robust implementation, we'd need to parse the PDU.
// However, since we are the default SMS app, the OS will also
// save the MMS to the system provider. We can query it.
// Note: WAP_PUSH_DELIVER usually triggers before or during the save.
// We might need a small delay or use a ContentObserver if the query fails.
extractTextFromProvider(context)
}
}