apply review feedback
This commit is contained in:
parent
d92e2407f3
commit
015e63ba66
|
@ -1012,8 +1012,26 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
return new String[]{"image/jpeg", "image/gif", "image/png", "video/mp4"};
|
return new String[]{"image/jpeg", "image/gif", "image/png", "video/mp4"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String sanitizeMediaDescription(String description){
|
||||||
|
if(description == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Gboard android keyboard attaches this text whenever the user
|
||||||
|
// pastes something from the keyboard's suggestion bar.
|
||||||
|
// Due to different end user locales, the exact text may vary, but at
|
||||||
|
// least in version 13.4.08, all of the translations contained the
|
||||||
|
// string "Gboard".
|
||||||
|
if (description.contains("Gboard")){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onAddMediaAttachmentFromEditText(Uri uri, String description){
|
public boolean onAddMediaAttachmentFromEditText(Uri uri, String description){
|
||||||
|
description = sanitizeMediaDescription(description);
|
||||||
return mediaViewController.addMediaAttachment(uri, description);
|
return mediaViewController.addMediaAttachment(uri, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,25 +126,7 @@ public class ComposeMediaViewController{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String sanitizeMediaDescription(String description){
|
|
||||||
if(description == null){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The Gboard android keyboard attaches this text whenever the user
|
|
||||||
// pastes something from the keyboard's suggestion bar.
|
|
||||||
// Due to different end user locales, the exact text may vary, but at
|
|
||||||
// least in version 13.4.08, all of the translations contained the
|
|
||||||
// string "Gboard".
|
|
||||||
if (description.contains("Gboard")){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean addMediaAttachment(Uri uri, String description){
|
public boolean addMediaAttachment(Uri uri, String description){
|
||||||
description = sanitizeMediaDescription(description);
|
|
||||||
if(getMediaAttachmentsCount()==MAX_ATTACHMENTS){
|
if(getMediaAttachmentsCount()==MAX_ATTACHMENTS){
|
||||||
showMediaAttachmentError(fragment.getResources().getQuantityString(R.plurals.cant_add_more_than_x_attachments, MAX_ATTACHMENTS, MAX_ATTACHMENTS));
|
showMediaAttachmentError(fragment.getResources().getQuantityString(R.plurals.cant_add_more_than_x_attachments, MAX_ATTACHMENTS, MAX_ATTACHMENTS));
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue