Only show GIF metadata warning once

pull/192/head
nielsandriesse 5 years ago
parent 79e5e6fc53
commit 40200fe5e1

@ -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;
}
}

@ -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();
}

Loading…
Cancel
Save