Do not show rec icon when mobile account is selected

Disable account spinner long click and screen swipe when mobile account is selected
This commit is contained in:
Juha Heinanen
2026-05-24 08:20:11 +03:00
parent 68563b1749
commit d16429c246

View File

@ -552,6 +552,11 @@ private fun TopAppBar(
windowInsets = WindowInsets(0, 0, 0, 0),
actions = {
val selectedAor by viewModel.selectedAor.collectAsState()
val uas by BaresipService.uas
val isMobile = uas.find { it.account.aor == selectedAor }?.account?.isMobile ?: false
if (!isMobile) {
Spacer(modifier = Modifier.width(8.dp))
val callRecordingTitle = stringResource(R.string.call_recording_title)
@ -562,17 +567,13 @@ private fun TopAppBar(
.clip(CircleShape)
.combinedClickable(
onClick = {
if (Call.call("connected") == null) {
if (!Call.isAnyCallActive(ctx)) {
BaresipService.isRecOn = !BaresipService.isRecOn
if (BaresipService.isRecOn) {
Api.module_load("sndfile")
} else {
Api.module_unload("sndfile")
}
Api.aufilt_enable("sndfile", BaresipService.isRecOn)
isRecOn = BaresipService.isRecOn
} else {
Toast.makeText(ctx, R.string.rec_in_call, Toast.LENGTH_SHORT).show()
}
else
Toast.makeText(ctx, R.string.rec_in_call, Toast.LENGTH_SHORT).show()
},
onLongClick = {
alertTitle.value = callRecordingTitle
@ -591,6 +592,7 @@ private fun TopAppBar(
modifier = Modifier.size(40.dp)
)
}
}
Spacer(modifier = Modifier.width(22.dp))
@ -1086,6 +1088,7 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
val ua = UserAgent.ofAor(selected)
if (ua != null) {
val acc = ua.account
if (!acc.isMobile) {
if (Api.account_regint(acc.accp) > 0) {
Api.account_set_regint(acc.accp, 0)
Api.ua_unregister(ua.uap)
@ -1100,6 +1103,7 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
Account.saveAccounts()
}
}
}
)
},
colors = ButtonColors(
@ -1137,6 +1141,7 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
val ua = UserAgent.ofAor(selected)
if (ua != null) {
val acc = ua.account
if (!acc.isMobile) {
if (Api.account_regint(acc.accp) > 0) {
Api.account_set_regint(acc.accp, 0)
Api.ua_unregister(ua.uap)
@ -1151,6 +1156,7 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na
Account.saveAccounts()
}
}
}
)
)
Icon(
@ -2249,7 +2255,7 @@ private fun showCall(ctx: Context, viewModel: ViewModel, ua: UserAgent?, showCal
if (viewModel.isUIRedundant(aor, callp, status, security)) return
if (call == null) {
pullToRefreshEnabled.value = true
pullToRefreshEnabled.value = !ua.account.isMobile
viewModel.dialerState.callUri.value = ua.account.resumeUri
viewModel.dialerState.callUriLabel.value = ctx.getString(R.string.outgoing_call_to_dots)
Handler(Looper.getMainLooper()).postDelayed({