diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2bea82a0..070d9429 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -104,7 +104,7 @@ diff --git a/app/src/main/kotlin/com/tutpro/baresip/Account.kt b/app/src/main/kotlin/com/tutpro/baresip/Account.kt index 7cea6ea6..28e2fac0 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/Account.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/Account.kt @@ -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'") } diff --git a/app/src/main/kotlin/com/tutpro/baresip/AccountsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/AccountsScreen.kt index 9f5265a5..0a41601c 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AccountsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AccountsScreen.kt @@ -251,6 +251,7 @@ fun NewAccount(navController: NavController) { var newAor by remember { mutableStateOf("") } val focusManager = LocalFocusManager.current + Row( modifier = Modifier .fillMaxWidth() diff --git a/app/src/main/kotlin/com/tutpro/baresip/AudioScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/AudioScreen.kt index ad06f62e..741ffc5d 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AudioScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AudioScreen.kt @@ -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) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipContactScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipContactScreen.kt index 6c45f5e6..00a62ce5 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipContactScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipContactScreen.kt @@ -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()) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index f659bb99..4d9662da 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -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) diff --git a/app/src/main/kotlin/com/tutpro/baresip/Contact.kt b/app/src/main/kotlin/com/tutpro/baresip/Contact.kt index 9076b5ce..2333f174 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/Contact.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/Contact.kt @@ -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"