Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.
fix(android): the ringer comes back on even if the app stopped mid-call
Bee97329d588778
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/calls/PhoneCalls.kt b/android/app/src/main/kotlin/app/nectarlink/android/calls/PhoneCalls.ktindex 0d43ef8..b6f6b13 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/calls/PhoneCalls.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/calls/PhoneCalls.kt@@ -23,6 +23,7 @@ import android.telecom.TelecomManagerimport android.telephony.TelephonyManagerimport android.util.Logimport androidx.core.content.ContextCompat+import androidx.core.content.editimport app.nectarlink.android.contacts.PhoneContactsimport app.nectarlink.core.Callimport app.nectarlink.core.CallCommand@@ -454,7 +455,19 @@ internal class PhoneCalls(return telecom()?.endCall() == true}- private var mutedRinger = false+ /**+ * Whether the ring stream is muted to silence a call. Kept on disk: if the+ * app is stopped before the call ends, the next start unmutes it instead+ * of leaving the phone silent for every call after.+ */+ private val prefs = context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE)+ private var mutedRinger: Boolean+ get() = prefs.getBoolean(MUTED_RINGER, false)+ set(value) = prefs.edit { putBoolean(MUTED_RINGER, value) }++ init {+ restoreRinger()+ }@SuppressLint("MissingPermission")private fun silence(telecom: TelecomManager) {@@ -478,6 +491,8 @@ internal class PhoneCalls(}companion object {+ private const val PREFS = "phone_calls"+ private const val MUTED_RINGER = "muted_ringer"private const val TAG = "PhoneCalls"@Volatile private var instance: PhoneCalls? = null