Fixed some TODOs

This commit is contained in:
Sylvain Berfini 2023-11-21 16:40:48 +01:00
parent 373a5f004b
commit 746ddf6457
8 changed files with 74 additions and 13 deletions

View file

@ -0,0 +1,42 @@
/*
* 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.compatibility
import android.graphics.RenderEffect
import android.graphics.Shader
import android.os.Build
import android.view.View
import androidx.annotation.RequiresApi
@RequiresApi(Build.VERSION_CODES.S)
class Api31Compatibility {
companion object {
private const val TAG = "[API 31 Compatibility]"
fun setBlurRenderEffect(view: View) {
val blurEffect = RenderEffect.createBlurEffect(16F, 16F, Shader.TileMode.MIRROR)
view.setRenderEffect(blurEffect)
}
fun removeBlurRenderEffect(view: View) {
view.setRenderEffect(null)
}
}
}

View file

@ -22,6 +22,7 @@ package org.linphone.compatibility
import android.annotation.SuppressLint
import android.app.Notification
import android.app.Service
import android.view.View
import org.linphone.mediastream.Version
@SuppressLint("NewApi")
@ -50,5 +51,17 @@ class Compatibility {
Api28Compatibility.startServiceForeground(service, id, notification)
}
}
fun setBlurRenderEffect(view: View) {
if (Version.sdkAboveOrEqual(Version.API31_ANDROID_12)) {
Api31Compatibility.setBlurRenderEffect(view)
}
}
fun removeBlurRenderEffect(view: View) {
if (Version.sdkAboveOrEqual(Version.API31_ANDROID_12)) {
Api31Compatibility.removeBlurRenderEffect(view)
}
}
}
}

View file

@ -23,7 +23,9 @@ import androidx.annotation.UiThread
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import java.util.Random
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.utils.AppUtils
import org.linphone.utils.Event
class ZrtpSasConfirmationDialogModel @UiThread constructor(
@ -46,7 +48,10 @@ class ZrtpSasConfirmationDialogModel @UiThread constructor(
val dismissEvent = MutableLiveData<Event<Boolean>>()
init {
message.value = "Dites $authTokenToRead et cliquez sur les lettres données par votre interlocuteur :"
message.value = AppUtils.getFormattedString(
R.string.dialog_zrtp_validate_trust_subtitle,
authTokenToRead
)
// TODO: improve algo?
val rnd = Random()

View file

@ -25,8 +25,6 @@ import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.graphics.RenderEffect
import android.graphics.Shader
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.net.Uri
@ -58,6 +56,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.compatibility.Compatibility
import org.linphone.core.ChatMessage
import org.linphone.core.tools.Log
import org.linphone.databinding.ChatBubbleLongPressMenuBinding
@ -502,9 +501,7 @@ class ConversationFragment : GenericFragment() {
}
private fun showChatMessageLongPressMenu(chatMessageModel: ChatMessageModel) {
// TODO: handle backward compat for blurring
val blurEffect = RenderEffect.createBlurEffect(16F, 16F, Shader.TileMode.MIRROR)
binding.root.setRenderEffect(blurEffect)
Compatibility.setBlurRenderEffect(binding.root)
val dialog = Dialog(requireContext(), R.style.Theme_LinphoneDialog)
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
@ -564,7 +561,7 @@ class ConversationFragment : GenericFragment() {
dialog.setContentView(layout.root)
dialog.setOnDismissListener {
binding.root.setRenderEffect(null)
Compatibility.removeBlurRenderEffect(binding.root)
}
dialog.window

View file

@ -58,7 +58,7 @@ class ConversationsListViewModel @UiThread constructor() : AbstractTopBarViewMod
when (state) {
ChatRoom.State.Created, ChatRoom.State.Instantiated, ChatRoom.State.Deleted -> {
computeChatRoomsList(currentFilter)
// TODO: display toast
// TODO: show toast
}
else -> {}
}

View file

@ -257,9 +257,6 @@ private fun loadImageForChatBubble(imageView: ImageView, file: String?, grid: Bo
"$TAG Error getting preview picture from video? [$file]: ${result.throwable}"
)
imageView.visibility = View.GONE
},
onSuccess = { _, _ ->
// TODO: Display "play" button above video preview
}
)
}

View file

@ -316,9 +316,11 @@ class LinphoneUtils {
if (text.isEmpty()) {
val firstContent = message.contents.firstOrNull()
if (firstContent?.isIcalendar == true) {
text = "meeting invite" // TODO: use translated string
text = AppUtils.getString(
R.string.message_meeting_invitation_content_description
)
} else if (firstContent?.isVoiceRecording == true) {
text = "voice message" // TODO: use translated string
text = AppUtils.getString(R.string.message_voice_message_content_description)
} else {
for (content in message.contents) {
if (text.isNotEmpty()) {

View file

@ -97,6 +97,7 @@
<string name="dialog_contact_new_or_edit_abort_confirmation_title">Don\'t save changes?</string>
<string name="dialog_contact_new_or_edit_abort_confirmation_message">All changes will be lost</string>
<string name="dialog_zrtp_validate_trust_title">Validate the device</string>
<string name="dialog_zrtp_validate_trust_subtitle">Say %s and click on the letters given by your correspondent:</string>
<string name="dialog_zrtp_validate_trust_message">Blah</string> <!-- TODO FIXME -->
<string name="dialog_zrtp_validate_trust_letters_do_not_match">Letters don\'t match!</string>
<string name="dialog_contact_increase_trust_level_title">Increase trust level</string>
@ -482,4 +483,8 @@
<string name="welcome_carousel_skip"><u>Skip</u></string>
<string name="assistant_forgotten_password"><u>Forgotten password?</u></string>
<string name="call_zrtp_sas_validation_skip"><u>Skip</u></string>
<!-- Keep <i></i> in following strings translations! -->
<string name="message_meeting_invitation_content_description"><i>meeting invite</i></string>
<string name="message_voice_message_content_description"><i>voice message</i></string>
</resources>