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

View File

@ -1305,6 +1305,14 @@ public class TextSecurePreferences {
setLongPreference(context, "last_profile_picture_upload", newValue); 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) { public static void clearAll(Context context) {
PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit(); PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit();
} }