mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Store and use 'do not display anymore' option of zrtp trust call dialog
This commit is contained in:
parent
d64f1e033b
commit
8ec7542a60
3 changed files with 30 additions and 6 deletions
|
|
@ -93,6 +93,13 @@ class CorePreferences @UiThread constructor(private val context: Context) {
|
|||
config.setBool("app", "auto_start_call_record", value)
|
||||
}
|
||||
|
||||
@get:WorkerThread @set:WorkerThread
|
||||
var showDialogWhenCallingDeviceUuidDirectly: Boolean
|
||||
get() = config.getBool("app", "show_confirmation_dialog_zrtp_trust_call", true)
|
||||
set(value) {
|
||||
config.setBool("app", "show_confirmation_dialog_zrtp_trust_call", value)
|
||||
}
|
||||
|
||||
// Conversation settings
|
||||
|
||||
var exportMediaToNativeGallery: Boolean // TODO: use it!
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ class SendMessageInConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
viewModelScope.launch {
|
||||
for (file in attachments.value.orEmpty()) {
|
||||
file.deleteFile()
|
||||
file.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -320,8 +321,7 @@ class SendMessageInConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
list.addAll(attachments.value.orEmpty())
|
||||
|
||||
val fileName = FileUtils.getNameFromFilePath(file)
|
||||
val isEncrypted = true // Really ? //TODO FIXME: is it really encrypted here?
|
||||
val model = FileModel(file, fileName, 0, isEncrypted) { model ->
|
||||
val model = FileModel(file, fileName, 0, isEncrypted = false) { model ->
|
||||
removeAttachment(model.file)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import androidx.navigation.fragment.navArgs
|
|||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import java.io.File
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.R
|
||||
import org.linphone.core.Factory
|
||||
import org.linphone.core.tools.Log
|
||||
|
|
@ -211,7 +212,7 @@ class ContactFragment : SlidingPaneChildFragment() {
|
|||
|
||||
viewModel.startCallToDeviceToIncreaseTrustEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { pair ->
|
||||
showConfirmTrustCallDialog(pair.first, pair.second)
|
||||
callDirectlyOrShowConfirmTrustCallDialog(pair.first, pair.second)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -291,6 +292,21 @@ class ContactFragment : SlidingPaneChildFragment() {
|
|||
dialog.show()
|
||||
}
|
||||
|
||||
private fun callDirectlyOrShowConfirmTrustCallDialog(contactName: String, deviceSipUri: String) {
|
||||
coreContext.postOnCoreThread {
|
||||
if (corePreferences.showDialogWhenCallingDeviceUuidDirectly) {
|
||||
coreContext.postOnMainThread {
|
||||
showConfirmTrustCallDialog(contactName, deviceSipUri)
|
||||
}
|
||||
} else {
|
||||
val address = Factory.instance().createAddress(deviceSipUri)
|
||||
if (address != null) {
|
||||
coreContext.startCall(address, forceZRTP = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showConfirmTrustCallDialog(contactName: String, deviceSipUri: String) {
|
||||
val model = TrustCallDialogModel(contactName, deviceSipUri)
|
||||
val dialog = DialogUtils.getContactTrustCallConfirmationDialog(requireActivity(), model)
|
||||
|
|
@ -303,10 +319,11 @@ class ContactFragment : SlidingPaneChildFragment() {
|
|||
|
||||
model.confirmCallEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (model.doNotShowAnymore.value == true) {
|
||||
// TODO: never display this anymore
|
||||
}
|
||||
coreContext.postOnCoreThread {
|
||||
if (model.doNotShowAnymore.value == true) {
|
||||
corePreferences.showDialogWhenCallingDeviceUuidDirectly = false
|
||||
}
|
||||
|
||||
val address = Factory.instance().createAddress(deviceSipUri)
|
||||
if (address != null) {
|
||||
coreContext.startCall(address, forceZRTP = true)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue