diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index c25d157bb3..c439862bac 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -3,10 +3,7 @@ package org.thoughtcrime.securesms.conversation.v2 import android.Manifest import android.animation.FloatEvaluator import android.animation.ValueAnimator -import android.content.ClipData -import android.content.ClipboardManager -import android.content.Context -import android.content.Intent +import android.content.* import android.content.res.Resources import android.database.Cursor import android.graphics.Rect @@ -972,7 +969,23 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe } private fun showGIFPicker() { - AttachmentManager.selectGif(this, ConversationActivityV2.PICK_GIF) + val hasSeenGIFMetaDataWarning: Boolean = TextSecurePreferences.hasSeenGIFMetaDataWarning(this) + if (!hasSeenGIFMetaDataWarning) { + val builder = AlertDialog.Builder(this) + builder.setTitle("Search GIFs?") + builder.setMessage("You will not have full metadata protection when sending GIFs.") + builder.setPositiveButton("OK") { dialog: DialogInterface, which: Int -> + TextSecurePreferences.setHasSeenGIFMetaDataWarning(this) + AttachmentManager.selectGif(this, ConversationActivityV2.PICK_GIF) + dialog.dismiss() + } + builder.setNegativeButton( + "Cancel" + ) { dialog: DialogInterface, which: Int -> dialog.dismiss() } + builder.create().show() + } else { + AttachmentManager.selectGif(this, ConversationActivityV2.PICK_GIF) + } } private fun showDocumentPicker() { diff --git a/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt b/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt index 7ac0feae6d..8c67a36b80 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt +++ b/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt @@ -80,6 +80,7 @@ object TextSecurePreferences { const val UNIVERSAL_UNIDENTIFIED_ACCESS = "pref_universal_unidentified_access" const val TYPING_INDICATORS = "pref_typing_indicators" const val LINK_PREVIEWS = "pref_link_previews" + private const val GIF_METADATA_WARNING = "has_seen_gif_metadata_warning" private const val GIF_GRID_LAYOUT = "pref_gif_grid_layout" const val IS_USING_FCM = "pref_is_using_fcm" private const val FCM_TOKEN = "pref_fcm_token" @@ -285,6 +286,16 @@ object TextSecurePreferences { setBooleanPreference(context, LINK_PREVIEWS, enabled) } + @JvmStatic + fun hasSeenGIFMetaDataWarning(context: Context): Boolean { + return getBooleanPreference(context, GIF_METADATA_WARNING, false) + } + + @JvmStatic + fun setHasSeenGIFMetaDataWarning(context: Context) { + setBooleanPreference(context, GIF_METADATA_WARNING, true) + } + @JvmStatic fun isGifSearchInGridLayout(context: Context): Boolean { return getBooleanPreference(context, GIF_GRID_LAYOUT, false)