Minor modifications
This commit is contained in:
@ -104,7 +104,7 @@
|
||||
<receiver
|
||||
android:name=".BootCompletedReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:exported="false"
|
||||
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
|
||||
@ -257,8 +257,10 @@ class Account(val accp: Long) {
|
||||
fun saveAccounts() {
|
||||
var accounts = ""
|
||||
for (a in accounts()) accounts = accounts + a.print() + "\n"
|
||||
Utils.putFileContents(BaresipService.filesPath + "/accounts",
|
||||
accounts.toByteArray(Charsets.UTF_8))
|
||||
Utils.putFileContents(
|
||||
BaresipService.filesPath + "/accounts",
|
||||
accounts.toByteArray(Charsets.UTF_8)
|
||||
)
|
||||
// Log.d(TAG, "Saved accounts '${accounts}' to '${BaresipService.filesPath}/accounts'")
|
||||
}
|
||||
|
||||
|
||||
@ -251,6 +251,7 @@ fun NewAccount(navController: NavController) {
|
||||
|
||||
var newAor by remember { mutableStateOf("") }
|
||||
val focusManager = LocalFocusManager.current
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
||||
@ -67,7 +67,7 @@ fun NavGraphBuilder.audioScreenRoute(
|
||||
navController.navigateUp()
|
||||
},
|
||||
checkOnClick = {
|
||||
val result = checkOnClick(ctx) // Your existing logic that returns true/false
|
||||
val result = checkOnClick(ctx)
|
||||
navController.previousBackStackEntry
|
||||
?.savedStateHandle
|
||||
?.set("audio_settings_result", result)
|
||||
|
||||
@ -228,12 +228,7 @@ private fun ContactScreen(
|
||||
@Composable
|
||||
private fun TopAppBar(title: String, onBack: () -> Unit, onCheck: () -> Unit) {
|
||||
TopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = title,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
title = { Text(text = title, fontWeight = FontWeight.Bold) },
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = MaterialTheme.colorScheme.primary,
|
||||
navigationIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||
@ -564,16 +559,10 @@ private fun checkOnClick(
|
||||
|
||||
if (currentState.tmpAvatarFile != null && currentState.tmpAvatarFile.exists()) {
|
||||
if (currentState.id != currentState.newId) { // Avatar changed, implying new ID
|
||||
// Delete old avatar if it existed for currentState.contactId
|
||||
val oldAvatar = File(BaresipService.filesPath, "${currentState.id}.png")
|
||||
if (oldAvatar.exists()) Utils.deleteFile(oldAvatar)
|
||||
idToUse = currentState.newId // Use the new ID for the contact
|
||||
idToUse = currentState.newId
|
||||
}
|
||||
/*val avatarFile = File(BaresipService.filesPath, "$idToUse.png")
|
||||
if (!Utils.moveFile(currentState.tempAvatarFile, avatarFile)) {
|
||||
Log.e(TAG, "Failed to move tmp avatar file $idToUse.png")
|
||||
return "Failed to save avatar"
|
||||
}*/
|
||||
} else if (currentState.avatarImageUri == null) { // Avatar was explicitly cleared
|
||||
val avatarFile = File(BaresipService.filesPath, "$idToUse.png")
|
||||
if (avatarFile.exists())
|
||||
|
||||
@ -139,7 +139,7 @@ class BaresipService: Service() {
|
||||
nt = RingtoneManager.getRingtone(applicationContext, ntUri)
|
||||
|
||||
val rtUri = if (Preferences(applicationContext).ringtoneUri == "")
|
||||
Settings.System.RINGTONE.toUri()
|
||||
Settings.System.DEFAULT_RINGTONE_URI
|
||||
else
|
||||
Preferences(applicationContext).ringtoneUri!!.toUri()
|
||||
rt = RingtoneManager.getRingtone(applicationContext, rtUri)
|
||||
|
||||
@ -247,7 +247,7 @@ sealed class Contact {
|
||||
idValue.toLong()
|
||||
else
|
||||
baseId + contactNo
|
||||
val favorite = Utils.paramValue(params, "favorite" ) == "yes"
|
||||
val favorite = Utils.paramValue(params, "favorite" ) == "yes"
|
||||
Log.d(TAG, "Restoring contact $name, $uri, $color, $id")
|
||||
val contact = BaresipContact(name, uri, color, id, favorite)
|
||||
val avatarFilePath = BaresipService.filesPath + "/$id.png"
|
||||
|
||||
Reference in New Issue
Block a user