From c7c9550466ec14b1e2329566ed30f7412f90e571 Mon Sep 17 00:00:00 2001 From: ShenMian Date: Tue, 10 Dec 2024 22:57:00 +0000 Subject: [PATCH] refactor(app): reorganize `App` methods for better readability - Move `refresh_objects` method inline into `update` to simplify `App` structure --- src/app.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/app.rs b/src/app.rs index 9aee80d..9409ea2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -67,15 +67,6 @@ impl App { /// Handles the tick event of the terminal. pub async fn update(&mut self) { - self.refresh_objects().await; - } - - /// Set running to false to quit the application. - pub fn quit(&mut self) { - self.running = false; - } - - async fn refresh_objects(&mut self) { const OBJECT_UPDATE_INTERVAL: Duration = Duration::from_secs(2 * 60); let now = Instant::now(); if now.duration_since(self.satellites_state.last_object_update) >= OBJECT_UPDATE_INTERVAL { @@ -83,4 +74,9 @@ impl App { self.satellites_state.last_object_update = now; } } + + /// Set running to false to quit the application. + pub fn quit(&mut self) { + self.running = false; + } }