Skip to content

Commit

Permalink
Start background matrix sync tasks on the Startup event (#43)
Browse files Browse the repository at this point in the history
This is more appropriate than doing so when the App widget is
created, as that can happen multiple times on Android, e.g.,
when switching apps.
  • Loading branch information
kevinaboos authored Feb 10, 2024
1 parent aed9250 commit aae2e66
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 39 deletions.
75 changes: 42 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 21 additions & 6 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,29 @@ impl LiveRegister for App {
crate::profile::my_profile_screen::live_design(cx);
}
}
impl LiveHook for App {
fn after_new_from_doc(&mut self, _cx: &mut Cx) {
log!("after_new_from_doc(): starting matrix sdk loop");
crate::sliding_sync::start_matrix_tokio().unwrap();
}
}

impl LiveHook for App { }

impl MatchEvent for App {
fn handle_startup(&mut self, _cx: &mut Cx) {
log!("App::handle_startup(): starting matrix sdk loop");
crate::sliding_sync::start_matrix_tokio().unwrap();
}
fn handle_shutdown(&mut self, _cx: &mut Cx) {
log!("App::handle_shutdown()");
}
fn handle_pause(&mut self, _cx: &mut Cx) {
log!("App::handle_pause()");
}
fn handle_resume(&mut self, _cx: &mut Cx) {
log!("App::handle_resume()");
}
fn handle_app_got_focus(&mut self, _cx: &mut Cx) {
log!("App::handle_app_got_focus()");
}
fn handle_app_lost_focus(&mut self, _cx: &mut Cx) {
log!("App::handle_app_lost_focus()");
}
fn handle_actions(&mut self, cx: &mut Cx, actions: &Actions) {
self.ui.radio_button_set(ids!(
mobile_modes.tab1,
Expand Down

0 comments on commit aae2e66

Please sign in to comment.