Skip to content

Commit 688fb0c

Browse files
committed
fix #1762: show blog url in the share blog spinner if the blog title is an empty string
1 parent af63e40 commit 688fb0c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,15 @@ public int compare(Object blog1, Object blog2) {
2222
return blogName1.compareToIgnoreCase(blogName2);
2323
}
2424
};
25+
26+
/**
27+
* Return a blog name or blog url (host part only) if trimmed name is an empty string
28+
*/
29+
public static String getBlogNameFromAccountMap(Map<String, Object> account) {
30+
String blogName = StringUtils.unescapeHTML(MapUtils.getMapStr(account, "blogName"));
31+
if (blogName.trim().length() == 0) {
32+
blogName = StringUtils.getHost(MapUtils.getMapStr(account, "url"));
33+
}
34+
return blogName;
35+
}
2536
}

0 commit comments

Comments
 (0)