Update version, remove unused features
This commit is contained in:
1 parent
96a58c61bc
commit
1d4b37e381
5 files changed
+36
-36
No files matched your search
+20
-1
@@ -15,6 +15,7 @@ use iced::widget::{button, column, container, progress_bar, row, space, text, to
|
||||
use iced::{Center, Element, Fill, Font, Length, Task};
|
||||
use log::error;
|
||||
use std::time::Duration;
|
||||
use crate::notification::NotificationData::LocalVersionChanged;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum SyncMessage {
|
||||
@@ -31,11 +32,13 @@ pub enum SyncMessage {
|
||||
Disable,
|
||||
DisableSync,
|
||||
SwitchAutoSync,
|
||||
ResetRealLoad,
|
||||
}
|
||||
pub struct SyncState {
|
||||
state: AppState,
|
||||
auto_fetch: bool,
|
||||
frozen: bool,
|
||||
real_load: bool,
|
||||
progress: f32,
|
||||
}
|
||||
|
||||
@@ -99,6 +102,18 @@ impl NavigatedPage<SyncMessage> for SyncState {
|
||||
return tasks;
|
||||
}
|
||||
GetLast => {
|
||||
if self.real_load == false {
|
||||
self.real_load = true;
|
||||
return Task::batch([
|
||||
Task::future(async {
|
||||
tokio::time::sleep(Duration::from_millis(3000)).await;
|
||||
return RootMessage::Sync(ResetRealLoad);
|
||||
}),
|
||||
Task::done(RootMessage::PushNotification(NotificationRequest::Warning(LocalVersionChanged)))
|
||||
]);
|
||||
}
|
||||
|
||||
self.real_load = false;
|
||||
let id = self.state.sync_data.read().key.clone().unwrap();
|
||||
let tasks = Task::batch([
|
||||
Task::perform(
|
||||
@@ -134,7 +149,7 @@ impl NavigatedPage<SyncMessage> for SyncState {
|
||||
}
|
||||
|
||||
return Task::done(RootMessage::PushNotification(NotificationRequest::Info(
|
||||
NotificationData::DataLoaded,
|
||||
NotificationData::DataSynced,
|
||||
)));
|
||||
}
|
||||
Disable => {}
|
||||
@@ -166,6 +181,9 @@ impl NavigatedPage<SyncMessage> for SyncState {
|
||||
return push_error_task!(err);
|
||||
}
|
||||
}
|
||||
ResetRealLoad => {
|
||||
self.real_load = false;
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
@@ -189,6 +207,7 @@ impl SyncState {
|
||||
auto_fetch,
|
||||
state,
|
||||
frozen: false,
|
||||
real_load: false,
|
||||
progress: 0.0,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user