-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync contacts #146
Sync contacts #146
Conversation
Now we resolve user names from the synced address book, if possible. We fallback to the profile name, if contact is not in the address book. And eventually to contacts phone number, if profile retrieval failed. The contacts are synced on start-up of the app, however max one time per hour. Resolves #140
pub(crate) fn filter_channels(&mut self, pattern: &str) { | ||
let pattern = pattern.to_lowercase(); | ||
|
||
// move out `channels` temporarily to make borrow checker happy | ||
let mut channels = std::mem::take(&mut self.data.channels); | ||
channels.filter(|channel: &Channel| match pattern.chars().next() { | ||
None => true, | ||
Some('@') => match channel.group_data.as_ref() { | ||
Some(group_data) => group_data | ||
.members | ||
.iter() | ||
.any(|&id| self.name_by_id(id).to_lowercase().contains(&pattern[1..])), | ||
None => channel.name.to_lowercase().contains(&pattern[1..]), | ||
}, | ||
_ => channel.name.to_lowercase().contains(&pattern), | ||
}); | ||
self.data.channels = channels; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this part here is a nice idea. Have you any other idea or special search pattern that could be implemented? I thought of searching messages, this would need porting the filtering abstraction to messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can take a look at a command palette in popular editors. They have often search prefixes like @name
etc...
Nice, thanks! I understand the rationale behind the hard rate-limit being to avoid getting soft-banned (haha), but is the one hour delay a real limit or simply that sync-ing more often would be overkill and useless? |
This seemed to be reasonable to me. Syncing is anyway done only on start, so if the app is running it is not an issue. Would be actually interesting to know how it is done Signal Desktop. |
Now we resolve user names from the synced address book, if possible.
We fallback to the profile name, if contact is not in the address
book. And eventually to contacts phone number, if profile retrieval
failed.
The contacts are synced on start-up of the app, however max one time
per hour.
Resolves #140