mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
fix: Emit AccountsItemChanged when own key is generated/imported, use gray self-color until that (#7296)
Emitting an `AccountsItemChanged` event is needed for UIs to know when `Contact::get_color()` starts returning the true color for `SELF`. Before, an address-based color was returned for a new account which was changing to a fingerprint-based color e.g. on app restart. Now the self-color is our favorite gray until own keypair is generated or imported e.g. via ASM.
This commit is contained in:
@@ -1582,6 +1582,8 @@ impl Contact {
|
||||
pub fn get_color(&self) -> u32 {
|
||||
if let Some(fingerprint) = self.fingerprint() {
|
||||
str_to_color(&fingerprint.hex())
|
||||
} else if self.id == ContactId::SELF {
|
||||
0x808080
|
||||
} else {
|
||||
str_to_color(&self.addr.to_lowercase())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user