Only show GIF metadata warning once

This commit is contained in:
nielsandriesse 2020-05-19 09:21:39 +10:00
parent 79e5e6fc53
commit 40200fe5e1
2 changed files with 22 additions and 8 deletions

View File

@ -1894,15 +1894,21 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
case AttachmentTypeSelector.TAKE_PHOTO:
attachmentManager.capturePhoto(this, TAKE_PHOTO); break;
case AttachmentTypeSelector.ADD_GIF:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Search GIFs?");
builder.setMessage("You will not have full metadata protection when sending GIFs.");
builder.setPositiveButton("OK", (dialog, which) -> {
boolean hasSeenGIFMetaDataWarning = TextSecurePreferences.hasSeenGIFMetaDataWarning(this);
if (!hasSeenGIFMetaDataWarning) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Search GIFs?");
builder.setMessage("You will not have full metadata protection when sending GIFs.");
builder.setPositiveButton("OK", (dialog, which) -> {
AttachmentManager.selectGif(this, PICK_GIF, !isSecureText);
dialog.dismiss();
});
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
builder.create().show();
TextSecurePreferences.setHasSeenGIFMetaDataWarning(this);
} else {
AttachmentManager.selectGif(this, PICK_GIF, !isSecureText);
dialog.dismiss();
});
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss() );
builder.create().show();
}
break;
}
}

View File

@ -1305,6 +1305,14 @@ public class TextSecurePreferences {
setLongPreference(context, "last_profile_picture_upload", newValue);
}
public static boolean hasSeenGIFMetaDataWarning(Context context) {
return getBooleanPreference(context, "has_seen_gif_metadata_warning", false);
}
public static void setHasSeenGIFMetaDataWarning(Context context) {
setBooleanPreference(context, "has_seen_gif_metadata_warning", true);
}
public static void clearAll(Context context) {
PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit();
}