Skip to content

Commit 9eb7273

Browse files
committed
new BlogUtils.getHostNameFromAccountMap function
1 parent 6186933 commit 9eb7273

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,25 @@ public int compare(Object blog1, Object blog2) {
2626
/**
2727
* Return a blog name or blog url (host part only) if trimmed name is an empty string
2828
*/
29-
public static String getBlogNameFromAccountMap(Map<String, Object> account) {
30-
String blogName = StringUtils.unescapeHTML(MapUtils.getMapStr(account, "blogName"));
29+
public static String getBlogNameOrHostNameFromAccountMap(Map<String, Object> account) {
30+
String blogName = getBlogNameFromAccountMap(account);
3131
if (blogName.trim().length() == 0) {
3232
blogName = StringUtils.getHost(MapUtils.getMapStr(account, "url"));
3333
}
3434
return blogName;
3535
}
36-
}
36+
37+
/**
38+
* Return a blog name or blog url (host part only) if trimmed name is an empty string
39+
*/
40+
public static String getBlogNameFromAccountMap(Map<String, Object> account) {
41+
return StringUtils.unescapeHTML(MapUtils.getMapStr(account, "blogName"));
42+
}
43+
44+
/**
45+
* Return blog url (host part only) if trimmed name is an empty string
46+
*/
47+
public static String getHostNameFromAccountMap(Map<String, Object> account) {
48+
return StringUtils.getHost(MapUtils.getMapStr(account, "url"));
49+
}
50+
}

0 commit comments

Comments
 (0)