mirror of https://github.com/M66B/FairEmail.git
Prioritize web app manifest favicons
This commit is contained in:
parent
652145e365
commit
3d5eb73d08
|
@ -712,12 +712,14 @@ public class ContactInfo {
|
|||
String src = jicon.optString("src");
|
||||
String sizes = jicon.optString("sizes", "");
|
||||
String type = jicon.optString("type", "");
|
||||
String purpose = jicon.optString("purpose", "");
|
||||
if (!TextUtils.isEmpty(src)) {
|
||||
Element img = doc.createElement("link")
|
||||
.attr("rel", "manifest")
|
||||
.attr("href", src)
|
||||
.attr("sizes", sizes)
|
||||
.attr("type", type);
|
||||
.attr("type", type)
|
||||
.attr("purpose", purpose);
|
||||
imgs.add(img);
|
||||
}
|
||||
}
|
||||
|
@ -849,6 +851,9 @@ public class ContactInfo {
|
|||
.trim();
|
||||
String type = img.attr("type")
|
||||
.trim();
|
||||
String purpose = img.attr("purpose")
|
||||
.toLowerCase(Locale.ROOT)
|
||||
.trim();
|
||||
|
||||
int order = 0;
|
||||
if ("link".equals(img.tagName()))
|
||||
|
@ -856,12 +861,15 @@ public class ContactInfo {
|
|||
|
||||
boolean isIco = (href.endsWith(".ico") || "image/x-icon".equals(type));
|
||||
boolean isSvg = (href.endsWith(".svg") || "image/svg+xml".equals(type));
|
||||
boolean isMask = ("mask-icon".equals(rel) || img.hasAttr("mask"));
|
||||
boolean isMask = ("mask-icon".equals(rel) || img.hasAttr("mask") || purpose.contains("mask"));
|
||||
boolean isMonochrome = purpose.contains("monochrome");
|
||||
|
||||
if (isMask)
|
||||
if (isMask || isMonochrome)
|
||||
order = -10; // Safari: "mask-icon"
|
||||
else if ("icon".equals(rel) && !isIco)
|
||||
order += 20;
|
||||
else if ("manifest".equals(rel))
|
||||
order += 20;
|
||||
else if ("apple-touch-icon".equals(rel) ||
|
||||
"apple-touch-icon-precomposed".equals(rel)) {
|
||||
// "apple-touch-startup-image"
|
||||
|
|
Loading…
Reference in New Issue