Added explanation bottom sheet for unsafe conversations instead of going into account profile mode fragment that was recently removed

This commit is contained in:
Sylvain Berfini 2024-05-17 17:18:56 +02:00
parent fc8ac5fc56
commit 7cf51f51a1
6 changed files with 151 additions and 7 deletions

View file

@ -565,10 +565,7 @@ class ConversationFragment : SlidingPaneChildFragment() {
}
binding.setWarningConversationDisabledClickListener {
Log.i(
"$TAG Navigating to account profile mode fragment to let user change mode to interop"
)
// TODO FIXME: show bottom dialog like for encrypted conversation
showUnsafeConversationDetailsBottomSheet()
}
sendMessageViewModel.emojiToAddEvent.observe(viewLifecycleOwner) {
@ -1279,6 +1276,15 @@ class ConversationFragment : SlidingPaneChildFragment() {
bottomSheetDialog = e2eEncryptionDetailsBottomSheet
}
private fun showUnsafeConversationDetailsBottomSheet() {
val unsafeConversationDetailsBottomSheet = UnsafeConversationDetailsDialogFragment()
unsafeConversationDetailsBottomSheet.show(
requireActivity().supportFragmentManager,
UnsafeConversationDetailsDialogFragment.TAG
)
bottomSheetDialog = unsafeConversationDetailsBottomSheet
}
private fun showOpenOrExportFileDialog(path: String, mime: String) {
val model = ConfirmationDialogModel()
val dialog = DialogUtils.getOpenOrExportFileDialog(

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2010-2023 Belledonne Communications SARL.
*
* This file is part of linphone-android
* (see https://www.linphone.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.linphone.ui.main.chat.fragment
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.UiThread
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import org.linphone.R
import org.linphone.databinding.ChatConversationUnsafeDetailsBottomSheetBinding
@UiThread
class UnsafeConversationDetailsDialogFragment(
private val onDismiss: (() -> Unit)? = null
) : BottomSheetDialogFragment() {
companion object {
const val TAG = "UnsafeConversationDetailsDialogFragment"
}
override fun onCancel(dialog: DialogInterface) {
onDismiss?.invoke()
super.onCancel(dialog)
}
override fun onDismiss(dialog: DialogInterface) {
onDismiss?.invoke()
super.onDismiss(dialog)
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
// Makes sure all menu entries are visible,
// required for landscape mode (otherwise only first item is visible)
dialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
// Force this navigation bar color
dialog.window?.navigationBarColor = requireContext().getColor(R.color.gray_600)
return dialog
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val view = ChatConversationUnsafeDetailsBottomSheetBinding.inflate(layoutInflater)
return view.root
}
}

View file

@ -234,7 +234,7 @@ class AudioUtils {
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
val audioAttrs = AudioAttributesCompat.Builder()
.setUsage(AudioAttributesCompat.USAGE_MEDIA)
.setContentType(AudioAttributesCompat.CONTENT_TYPE_SPEECH)
.setContentType(AudioAttributesCompat.CONTENT_TYPE_MUSIC)
.build()
val request =

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="@drawable/shape_bottom_sheet_gray_100_background"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_600"
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:text="@string/conversation_warning_disabled_encrypted_bottom_sheet_title"
android:textSize="16sp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/icon"/>
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:src="@drawable/profile_secure_logo"
android:contentDescription="@null"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/message" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:text="@string/conversation_warning_disabled_encrypted_bottom_sheet_message"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -451,7 +451,9 @@
<string name="conversation_end_to_end_encrypted_bottom_sheet_message">Grâce à la technologie de chiffrement de bout en bout de &appName;, la confidentialité de vos messages, appels et réunions avec vos correspondants est garantie. Personne ne pourra déchiffrer vos conversations, pas même &appName;.</string>
<string name="conversation_end_to_end_encrypted_bottom_sheet_link"><u>https://linphone.org/security</u></string>
<string name="conversation_warning_disabled_because_not_secured_title">Cette conversation n\'est pas chiffrée !</string>
<string name="conversation_warning_disabled_because_not_secured_subtitle">Cette conversation a été désactivée car elle n\'est pas chiffrée. Vous pouvez l\'activer en changeant le mode de votre compte pour Intéropérable.</string>
<string name="conversation_warning_disabled_because_not_secured_subtitle">Cette conversation a été désactivée pour garantir votre sécurité.</string>
<string name="conversation_warning_disabled_encrypted_bottom_sheet_title">Chiffrement obligatoire</string>
<string name="conversation_warning_disabled_encrypted_bottom_sheet_message">Vous avez activé le chiffrement obligatoire. Vos conversations non chiffrées sont désactivées pour garantir votre sécurité. Vous pouvez recréer cette conversation ou bien désactiver le chiffrement obligatoire dans vos paramètres de compte.</string>
<string name="conversation_dialog_set_subject">Nommer la conversation</string>
<string name="conversation_dialog_edit_subject">Renommer la conversation</string>
<string name="conversation_dialog_subject_hint">Nom de la conversation</string>

View file

@ -487,7 +487,9 @@
<string name="conversation_end_to_end_encrypted_bottom_sheet_message">Thanks to end-to-end encryption technology in &appName;, messages, calls and meetings confidentiality are guaranteed. No-one can decrypt exchanged data, not even ourselves.</string>
<string name="conversation_end_to_end_encrypted_bottom_sheet_link"><u>https://linphone.org/security</u></string>
<string name="conversation_warning_disabled_because_not_secured_title">This conversation is not encrypted!</string>
<string name="conversation_warning_disabled_because_not_secured_subtitle">This conversation was disabled because it is not encrypted. You can enable it back by switching your account profile mode from Secure to Interoperable.</string>
<string name="conversation_warning_disabled_because_not_secured_subtitle">For your safety, this conversation was disabled.</string>
<string name="conversation_warning_disabled_encrypted_bottom_sheet_title">Mandatory encryption</string>
<string name="conversation_warning_disabled_encrypted_bottom_sheet_message"></string>
<string name="conversation_dialog_set_subject">Set conversation subject</string>
<string name="conversation_dialog_edit_subject">Edit conversation subject</string>
<string name="conversation_dialog_subject_hint">Conversation subject</string>