Skip to content
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

Merged
merged 1 commit into from
May 12, 2022
Merged

Sync contacts #146

merged 1 commit into from
May 12, 2022

Conversation

boxdot
Copy link
Owner

@boxdot boxdot commented Mar 11, 2022

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

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
Comment on lines +1627 to +1644
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;
}
Copy link
Contributor

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.

Copy link
Owner Author

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...

src/app.rs Show resolved Hide resolved
@Sup3Legacy
Copy link
Contributor

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?

@boxdot
Copy link
Owner Author

boxdot commented May 12, 2022

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.

@boxdot boxdot merged commit 51d34ad into master May 12, 2022
@boxdot boxdot deleted the sync-contacts branch May 12, 2022 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

missing contact names
2 participants