SES-2715 Calls toggle and Mic permission

Making sure we tell the user when microphone permissions are denied permanently when toggling calls on.
This commit is contained in:
ThomasSession 2024-09-12 09:38:24 +10:00
parent ad944e3398
commit d30ff252ab

View File

@ -3,11 +3,14 @@ package org.thoughtcrime.securesms.preferences
import android.Manifest
import androidx.fragment.app.Fragment
import androidx.preference.Preference
import com.squareup.phrase.Phrase
import network.loki.messenger.R
import org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY
import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsession.utilities.TextSecurePreferences.Companion.setBooleanPreference
import org.thoughtcrime.securesms.permissions.Permissions
import org.thoughtcrime.securesms.showSessionDialog
import org.thoughtcrime.securesms.ui.getSubbedString
internal class CallToggleListener(
private val context: Fragment,
@ -39,6 +42,10 @@ internal class CallToggleListener(
)
setCallback(true)
}
.withPermanentDenialDialog(
context.requireContext().getSubbedString(R.string.permissionsMicrophoneAccessRequired,
APP_NAME_KEY to context.requireContext().getString(R.string.app_name)
))
.onAnyDenied { setCallback(false) }
.execute()
}