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
Generated
+5
-8
@@ -2203,7 +2203,7 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
||||
|
||||
[[package]]
|
||||
name = "jap_learn"
|
||||
version = "0.1.3"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"criterion",
|
||||
@@ -2501,9 +2501,6 @@ name = "litemap"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "litrs"
|
||||
@@ -3596,9 +3593,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.10.2"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
|
||||
checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"
|
||||
dependencies = [
|
||||
"chacha20",
|
||||
"getrandom 0.4.1",
|
||||
@@ -3857,9 +3854,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rhai"
|
||||
version = "1.26.0"
|
||||
version = "1.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e6e1be9d697d537ce450766df42ad6adf1a93f25f21d73217354ad7e3d3dae1"
|
||||
checksum = "0334639972c0ea5a3fd366aa36116754a11431b619fec3ed559b3f73bcbcebf5"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bitflags 2.10.0",
|
||||
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
[package]
|
||||
name = "jap_learn"
|
||||
version = "0.1.3"
|
||||
version = "0.2.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
iced = { version = "0.14.0", features = ["tokio", "svg", "lazy", "crisp", "tiny-skia", "wayland", "wgpu"], default-features = false}
|
||||
iced_core = "0.14.0"
|
||||
rand = "0.10.2"
|
||||
rand = "0.10.3"
|
||||
dirs = "7.0.0"
|
||||
serde_json = "1.0.151"
|
||||
rhai = { version = "1.26.0", features = ["sync"] }
|
||||
rhai = { version = "1.26.1", features = ["sync"] }
|
||||
chrono = "0.4.45"
|
||||
rusqlite = { version = "0.40.2", features = ["chrono", "bundled"] }
|
||||
reqwest = { version = "0.13.5", features = ["json", "stream", "multipart"] }
|
||||
@@ -27,7 +27,7 @@ parking_lot = "0.12.5"
|
||||
env_logger = "0.11.11"
|
||||
log = "0.4.34"
|
||||
fsrs = "6.6.2"
|
||||
litemap = { version = "0.8.3", features = ["serde"] }
|
||||
litemap = { version = "0.8.3" }
|
||||
|
||||
[profile.super-release]
|
||||
inherits = "release"
|
||||
|
||||
@@ -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
@@ -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
@@ -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