Work on Blocked screen

This commit is contained in:
Juha Heinanen
2025-12-28 12:13:59 +02:00
parent 3cf6c1dbaf
commit 2a4aac1bae
4 changed files with 24 additions and 2 deletions

View File

@ -457,6 +457,8 @@ class BaresipService: Service() {
}
}
Blocked.restore()
val recordings = File(filesDir, "recordings")
val restored = File(filesPath, "restored")
@ -866,7 +868,14 @@ class BaresipService: Service() {
Api.sip_treply(callp, 486, "Busy Here")
Api.bevent_stop(bevent)
toast(toastMsg)
if (!blockUnknown) {
if (blockUnknown)
Blocked(
ua.account.aor,
peerUri,
"invite",
GregorianCalendar().timeInMillis
).add()
else {
val name = "callwaiting_$toneCountry"
val resourceId = applicationContext.resources.getIdentifier(
name,
@ -1872,6 +1881,7 @@ class BaresipService: Service() {
val baresipContacts = mutableStateOf(emptyList<Contact.BaresipContact>())
val androidContacts = mutableStateOf(emptyList<Contact.AndroidContact>())
val contactNames = mutableStateOf(emptyList<String>())
val darkTheme = mutableStateOf(false)
val dynamicColors = mutableStateOf(false)
var messages by mutableStateOf(emptyList<Message>())
@ -1883,6 +1893,8 @@ class BaresipService: Service() {
val calls = ArrayList<Call>()
var callHistory = ArrayList<CallHistoryNew>()
var blocked = ArrayList<Blocked>()
var contactsMode = "baresip"
var addressFamily = ""
var dnsServers = listOf<InetAddress>()

View File

@ -155,6 +155,7 @@ private fun TopAppBar(navController: NavController, account: Account, callHistor
val delete = stringResource(R.string.delete)
val disable = stringResource(R.string.disable_history)
val enable = stringResource(R.string.enable_history)
val blocked = stringResource(R.string.blocked)
val showDialog = remember { mutableStateOf(false) }
val positiveAction = remember { mutableStateOf({}) }
@ -207,7 +208,7 @@ private fun TopAppBar(navController: NavController, account: Account, callHistor
CustomElements.DropdownMenu(
expanded,
{ expanded = false },
listOf(delete, if (account.callHistory) disable else enable),
if (account.callHistory) listOf(delete, disable, blocked) else listOf(enable),
onItemClick = { selectedItem ->
expanded = false
when (selectedItem) {
@ -222,6 +223,9 @@ private fun TopAppBar(navController: NavController, account: Account, callHistor
account.callHistory = !account.callHistory
Account.saveAccounts()
}
blocked -> {
navController.navigate("blocked/${account.aor}")
}
}
}
)

View File

@ -302,6 +302,7 @@ class MainActivity : ComponentActivity() {
androidContactScreenRoute(navController, viewModel)
callsScreenRoute(navController, viewModel)
callDetailsScreenRoute(navController, viewModel)
blockedScreenRoute(navController)
chatsScreenRoute(navController)
chatScreenRoute(navController, viewModel)
}

View File

@ -281,6 +281,11 @@
<string name="save_recording_question">Do you want to save this recording?</string>
<string name="recording_saved">Recording saved</string>
<string name="delete_call_alert">Do you want to delete this call from history?</string>
<!-- Blocked Activity -->
<string name="blocked">Blocked</string>
<string name="blocked_calls">Blocked Calls</string>
<string name="blocked_delete_alert">Do you want to delete blocked calls of \'%1$s\'\?</string>
<string name="blocked_contact_question">Do you want to add peer \'%1$s\' to contacts\?</string>
<!-- Chat Activity -->
<string name="chat_with">Chat with %1$s</string>
<string name="new_message">New message</string>