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