From 3c1e183ed6006a94bb6bf3589cae5e867af3b030 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 29 Jul 2022 13:34:48 +0100 Subject: [PATCH] using low privacy log from the vector module for code within vector, instead of the sdk flag --- .../features/attachments/AttachmentsHelper.kt | 18 ++++++++++-------- .../home/room/detail/TimelineFragment.kt | 5 +++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/attachments/AttachmentsHelper.kt b/vector/src/main/java/im/vector/app/features/attachments/AttachmentsHelper.kt index d0843b3b64..f8aa22f418 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/AttachmentsHelper.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/AttachmentsHelper.kt @@ -23,9 +23,9 @@ import android.os.Bundle import androidx.activity.result.ActivityResultLauncher import im.vector.app.core.dialogs.PhotoOrVideoDialog import im.vector.app.core.platform.Restorable +import im.vector.app.core.resources.BuildMeta import im.vector.app.features.settings.VectorPreferences import im.vector.lib.multipicker.MultiPicker -import org.matrix.android.sdk.BuildConfig import org.matrix.android.sdk.api.session.content.ContentAttachmentData import timber.log.Timber @@ -35,15 +35,14 @@ private const val PENDING_TYPE_KEY = "PENDING_TYPE_KEY" /** * This class helps to handle attachments by providing simple methods. */ -class AttachmentsHelper(val context: Context, val callback: Callback) : Restorable { +class AttachmentsHelper( + val context: Context, + val callback: Callback, + private val buildMeta: BuildMeta, +) : Restorable { interface Callback { - fun onContactAttachmentReady(contactAttachment: ContactAttachment) { - if (BuildConfig.LOG_PRIVATE_DATA) { - Timber.v("On contact attachment ready: $contactAttachment") - } - } - + fun onContactAttachmentReady(contactAttachment: ContactAttachment) fun onContentAttachmentsReady(attachments: List) } @@ -144,6 +143,9 @@ class AttachmentsHelper(val context: Context, val callback: Callback) : Restorab .firstOrNull() ?.toContactAttachment() ?.let { + if (buildMeta.lowPrivacyLoggingEnabled) { + Timber.v("On contact attachment ready: $it") + } callback.onContactAttachmentReady(it) } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 727791c540..8f9564789a 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -91,6 +91,7 @@ import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.platform.VectorMenuProvider import im.vector.app.core.platform.lifecycleAwareLazy import im.vector.app.core.platform.showOptimizedSnackbar +import im.vector.app.core.resources.BuildMeta import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.UserPreferencesProvider import im.vector.app.core.time.Clock @@ -277,6 +278,7 @@ class TimelineFragment @Inject constructor( private val shareIntentHandler: ShareIntentHandler, private val clock: Clock, private val vectorFeatures: VectorFeatures, + private val buildMeta: BuildMeta, ) : VectorBaseFragment(), TimelineEventController.Callback, @@ -373,7 +375,7 @@ class TimelineFragment @Inject constructor( sharedActionViewModel = activityViewModelProvider.get(MessageSharedActionViewModel::class.java) sharedActivityActionViewModel = activityViewModelProvider.get(RoomDetailSharedActionViewModel::class.java) knownCallsViewModel = activityViewModelProvider.get(SharedKnownCallsViewModel::class.java) - attachmentsHelper = AttachmentsHelper(requireContext(), this).register() + attachmentsHelper = AttachmentsHelper(requireContext(), this, buildMeta).register() callActionsHandler = StartCallActionsHandler( roomId = timelineArgs.roomId, fragment = this, @@ -2647,7 +2649,6 @@ class TimelineFragment @Inject constructor( } override fun onContactAttachmentReady(contactAttachment: ContactAttachment) { - super.onContactAttachmentReady(contactAttachment) val formattedContact = contactAttachment.toHumanReadable() messageComposerViewModel.handle(MessageComposerAction.SendMessage(formattedContact, false)) }