Merge pull request #720 from hjubb/giphy_privacy_prompt

Prompt gif search metadata
This commit is contained in:
Harris 2021-09-08 04:51:11 +00:00 committed by GitHub
commit 6708047cca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 5 deletions

View File

@ -3,10 +3,7 @@ package org.thoughtcrime.securesms.conversation.v2
import android.Manifest import android.Manifest
import android.animation.FloatEvaluator import android.animation.FloatEvaluator
import android.animation.ValueAnimator import android.animation.ValueAnimator
import android.content.ClipData import android.content.*
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.content.res.Resources import android.content.res.Resources
import android.database.Cursor import android.database.Cursor
import android.graphics.Rect import android.graphics.Rect
@ -972,7 +969,23 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
} }
private fun showGIFPicker() { 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() { private fun showDocumentPicker() {

View File

@ -80,6 +80,7 @@ object TextSecurePreferences {
const val UNIVERSAL_UNIDENTIFIED_ACCESS = "pref_universal_unidentified_access" const val UNIVERSAL_UNIDENTIFIED_ACCESS = "pref_universal_unidentified_access"
const val TYPING_INDICATORS = "pref_typing_indicators" const val TYPING_INDICATORS = "pref_typing_indicators"
const val LINK_PREVIEWS = "pref_link_previews" 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" private const val GIF_GRID_LAYOUT = "pref_gif_grid_layout"
const val IS_USING_FCM = "pref_is_using_fcm" const val IS_USING_FCM = "pref_is_using_fcm"
private const val FCM_TOKEN = "pref_fcm_token" private const val FCM_TOKEN = "pref_fcm_token"
@ -285,6 +286,16 @@ object TextSecurePreferences {
setBooleanPreference(context, LINK_PREVIEWS, enabled) 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 @JvmStatic
fun isGifSearchInGridLayout(context: Context): Boolean { fun isGifSearchInGridLayout(context: Context): Boolean {
return getBooleanPreference(context, GIF_GRID_LAYOUT, false) return getBooleanPreference(context, GIF_GRID_LAYOUT, false)