support color avatar
This commit is contained in:
@@ -38,6 +38,8 @@ pub struct ProfileSummary {
|
||||
pub email: Option<String>,
|
||||
pub avatar_data_url: Option<String>,
|
||||
pub avatar_icon: Option<String>,
|
||||
pub default_avatar_fill_color: Option<i64>,
|
||||
pub default_avatar_stroke_color: Option<i64>,
|
||||
pub avatar_label: String,
|
||||
pub path: String,
|
||||
}
|
||||
@@ -69,6 +71,8 @@ pub struct AssociatedProfileSummary {
|
||||
pub name: String,
|
||||
pub avatar_data_url: Option<String>,
|
||||
pub avatar_icon: Option<String>,
|
||||
pub default_avatar_fill_color: Option<i64>,
|
||||
pub default_avatar_stroke_color: Option<i64>,
|
||||
pub avatar_label: String,
|
||||
}
|
||||
|
||||
@@ -79,6 +83,8 @@ pub struct BookmarkAssociatedProfileSummary {
|
||||
pub name: String,
|
||||
pub avatar_data_url: Option<String>,
|
||||
pub avatar_icon: Option<String>,
|
||||
pub default_avatar_fill_color: Option<i64>,
|
||||
pub default_avatar_stroke_color: Option<i64>,
|
||||
pub avatar_label: String,
|
||||
pub bookmark_path: String,
|
||||
}
|
||||
|
||||
@@ -159,6 +159,12 @@ fn build_profile_summary(
|
||||
.and_then(Value::as_str)
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(str::to_string);
|
||||
let default_avatar_fill_color = profile_info
|
||||
.and_then(|value| value.get("default_avatar_fill_color"))
|
||||
.and_then(Value::as_i64);
|
||||
let default_avatar_stroke_color = profile_info
|
||||
.and_then(|value| value.get("default_avatar_stroke_color"))
|
||||
.and_then(Value::as_i64);
|
||||
let avatar_label = name
|
||||
.chars()
|
||||
.find(|character| !character.is_whitespace())
|
||||
@@ -171,6 +177,8 @@ fn build_profile_summary(
|
||||
email,
|
||||
avatar_data_url,
|
||||
avatar_icon,
|
||||
default_avatar_fill_color,
|
||||
default_avatar_stroke_color,
|
||||
avatar_label,
|
||||
path: profile_path.display().to_string(),
|
||||
}
|
||||
@@ -262,6 +270,8 @@ fn scan_extensions_for_profile(
|
||||
name: profile.name.clone(),
|
||||
avatar_data_url: profile.avatar_data_url.clone(),
|
||||
avatar_icon: profile.avatar_icon.clone(),
|
||||
default_avatar_fill_color: profile.default_avatar_fill_color,
|
||||
default_avatar_stroke_color: profile.default_avatar_stroke_color,
|
||||
avatar_label: profile.avatar_label.clone(),
|
||||
});
|
||||
}
|
||||
@@ -423,6 +433,8 @@ fn collect_bookmarks(
|
||||
name: profile.name.clone(),
|
||||
avatar_data_url: profile.avatar_data_url.clone(),
|
||||
avatar_icon: profile.avatar_icon.clone(),
|
||||
default_avatar_fill_color: profile.default_avatar_fill_color,
|
||||
default_avatar_stroke_color: profile.default_avatar_stroke_color,
|
||||
avatar_label: profile.avatar_label.clone(),
|
||||
bookmark_path,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user