boxdot / gurk-rs

Signal Messenger client for terminal
GNU Affero General Public License v3.0
458 stars 33 forks source link

Reduce number of system notifications on startup #196

Open boxdot opened 1 year ago

boxdot commented 1 year ago

When starting the app, usually there many messages that have to be synced. For each incoming message, we send out a system notification. This massively slows down the initial sync.

mucinoab commented 1 year ago

A simple approach is to add something like this:

if self // skip notifications for the first 60 seconds
    .start_time // std::time::SystemTime::now() 
    .elapsed()
    .unwrap_or(std::time::Duration::from_secs(64))
    .as_secs()
    < 60
{
    return;
}

... to the beginning of: https://github.com/boxdot/gurk-rs/blob/3858be937a494af56b6b70b122858c53a042eebe/src/app.rs#L753-L762


Another more complicated approach is to add a "loading screen" similar to the one in the official desktop client. image

boxdot commented 1 year ago

I wonder how Signal Desktop decide when it is loading. I guess they wait until a stream of incoming messages at the beginning stops, that is, does not send messages anymore for a predefined duration.