Update version, remove unused features

This commit is contained in:
micialware committed 2026-09-20 22:18:59 +03:00
1 parent 96a58c61bc
commit 1d4b37e381
5 files changed
+36 -36

No files matched your search

-20
View File
@@ -69,26 +69,6 @@ fn additional_to_string(map: &LiteMap<Id, String>) -> String {
parts.join("")
}
fn additional_from_string_temp(data: String) -> LiteMap<Id, String> {
let pre_map: LiteMap<String, String> = serde_json::from_str(data.as_str()).unwrap();
LiteMap::from(
pre_map
.iter()
.map(|(k, v)| {
(
match k.as_str() {
"reading" => Id(1),
"description" => Id(2),
"context" => Id(3),
&_ => Id(0),
},
v.to_string(),
)
})
.collect(),
)
}
fn additional_from_string(data: String) -> LiteMap<Id, String> {
if data.is_empty() {
return LiteMap::new();
+7 -3
View File
@@ -138,8 +138,8 @@ impl NotificationManager {
fn draw_data<'a>(data: &NotificationData) -> Element<'a, NotificationMessage> {
match data {
NotificationData::DataLoaded => {
text!("Данные успешно загружены на сервер")
NotificationData::DataSynced => {
text!("Данные успешно синхронизированы")
}
NotificationData::ImportError => {
text!("Ошибка при импорте данных из Anki")
@@ -168,6 +168,9 @@ impl NotificationManager {
NotificationData::CompressError => {
text!("Ошибка сжатия или распаковки данных")
}
NotificationData::LocalVersionChanged => {
text!("Локальная версия будет заменена")
}
}
.width(Fill)
.into()
@@ -184,7 +187,7 @@ pub enum NotificationRequest {
#[derive(Clone, Debug)]
pub enum NotificationData {
PermissionDenied,
DataLoaded,
DataSynced,
ImportError,
IncorrectAnkiFile,
OpenFileError,
@@ -193,6 +196,7 @@ pub enum NotificationData {
DbSaveError,
DbLoadError,
CompressError,
LocalVersionChanged,
}
pub type MaybeError = Result<(), NotificationData>;
+20 -1
View File
@@ -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,
}
}