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]]
|
[[package]]
|
||||||
name = "jap_learn"
|
name = "jap_learn"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"criterion",
|
"criterion",
|
||||||
@@ -2501,9 +2501,6 @@ name = "litemap"
|
|||||||
version = "0.8.3"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
|
checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
|
||||||
dependencies = [
|
|
||||||
"serde_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "litrs"
|
name = "litrs"
|
||||||
@@ -3596,9 +3593,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.10.2"
|
version = "0.10.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
|
checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chacha20",
|
"chacha20",
|
||||||
"getrandom 0.4.1",
|
"getrandom 0.4.1",
|
||||||
@@ -3857,9 +3854,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rhai"
|
name = "rhai"
|
||||||
version = "1.26.0"
|
version = "1.26.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5e6e1be9d697d537ce450766df42ad6adf1a93f25f21d73217354ad7e3d3dae1"
|
checksum = "0334639972c0ea5a3fd366aa36116754a11431b619fec3ed559b3f73bcbcebf5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
|
|||||||
+4
-4
@@ -1,15 +1,15 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "jap_learn"
|
name = "jap_learn"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
iced = { version = "0.14.0", features = ["tokio", "svg", "lazy", "crisp", "tiny-skia", "wayland", "wgpu"], default-features = false}
|
iced = { version = "0.14.0", features = ["tokio", "svg", "lazy", "crisp", "tiny-skia", "wayland", "wgpu"], default-features = false}
|
||||||
iced_core = "0.14.0"
|
iced_core = "0.14.0"
|
||||||
rand = "0.10.2"
|
rand = "0.10.3"
|
||||||
dirs = "7.0.0"
|
dirs = "7.0.0"
|
||||||
serde_json = "1.0.151"
|
serde_json = "1.0.151"
|
||||||
rhai = { version = "1.26.0", features = ["sync"] }
|
rhai = { version = "1.26.1", features = ["sync"] }
|
||||||
chrono = "0.4.45"
|
chrono = "0.4.45"
|
||||||
rusqlite = { version = "0.40.2", features = ["chrono", "bundled"] }
|
rusqlite = { version = "0.40.2", features = ["chrono", "bundled"] }
|
||||||
reqwest = { version = "0.13.5", features = ["json", "stream", "multipart"] }
|
reqwest = { version = "0.13.5", features = ["json", "stream", "multipart"] }
|
||||||
@@ -27,7 +27,7 @@ parking_lot = "0.12.5"
|
|||||||
env_logger = "0.11.11"
|
env_logger = "0.11.11"
|
||||||
log = "0.4.34"
|
log = "0.4.34"
|
||||||
fsrs = "6.6.2"
|
fsrs = "6.6.2"
|
||||||
litemap = { version = "0.8.3", features = ["serde"] }
|
litemap = { version = "0.8.3" }
|
||||||
|
|
||||||
[profile.super-release]
|
[profile.super-release]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
|
|||||||
@@ -69,26 +69,6 @@ fn additional_to_string(map: &LiteMap<Id, String>) -> String {
|
|||||||
parts.join("")
|
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> {
|
fn additional_from_string(data: String) -> LiteMap<Id, String> {
|
||||||
if data.is_empty() {
|
if data.is_empty() {
|
||||||
return LiteMap::new();
|
return LiteMap::new();
|
||||||
|
|||||||
+7
-3
@@ -138,8 +138,8 @@ impl NotificationManager {
|
|||||||
|
|
||||||
fn draw_data<'a>(data: &NotificationData) -> Element<'a, NotificationMessage> {
|
fn draw_data<'a>(data: &NotificationData) -> Element<'a, NotificationMessage> {
|
||||||
match data {
|
match data {
|
||||||
NotificationData::DataLoaded => {
|
NotificationData::DataSynced => {
|
||||||
text!("Данные успешно загружены на сервер")
|
text!("Данные успешно синхронизированы")
|
||||||
}
|
}
|
||||||
NotificationData::ImportError => {
|
NotificationData::ImportError => {
|
||||||
text!("Ошибка при импорте данных из Anki")
|
text!("Ошибка при импорте данных из Anki")
|
||||||
@@ -168,6 +168,9 @@ impl NotificationManager {
|
|||||||
NotificationData::CompressError => {
|
NotificationData::CompressError => {
|
||||||
text!("Ошибка сжатия или распаковки данных")
|
text!("Ошибка сжатия или распаковки данных")
|
||||||
}
|
}
|
||||||
|
NotificationData::LocalVersionChanged => {
|
||||||
|
text!("Локальная версия будет заменена")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.width(Fill)
|
.width(Fill)
|
||||||
.into()
|
.into()
|
||||||
@@ -184,7 +187,7 @@ pub enum NotificationRequest {
|
|||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum NotificationData {
|
pub enum NotificationData {
|
||||||
PermissionDenied,
|
PermissionDenied,
|
||||||
DataLoaded,
|
DataSynced,
|
||||||
ImportError,
|
ImportError,
|
||||||
IncorrectAnkiFile,
|
IncorrectAnkiFile,
|
||||||
OpenFileError,
|
OpenFileError,
|
||||||
@@ -193,6 +196,7 @@ pub enum NotificationData {
|
|||||||
DbSaveError,
|
DbSaveError,
|
||||||
DbLoadError,
|
DbLoadError,
|
||||||
CompressError,
|
CompressError,
|
||||||
|
LocalVersionChanged,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type MaybeError = Result<(), NotificationData>;
|
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 iced::{Center, Element, Fill, Font, Length, Task};
|
||||||
use log::error;
|
use log::error;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use crate::notification::NotificationData::LocalVersionChanged;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum SyncMessage {
|
pub enum SyncMessage {
|
||||||
@@ -31,11 +32,13 @@ pub enum SyncMessage {
|
|||||||
Disable,
|
Disable,
|
||||||
DisableSync,
|
DisableSync,
|
||||||
SwitchAutoSync,
|
SwitchAutoSync,
|
||||||
|
ResetRealLoad,
|
||||||
}
|
}
|
||||||
pub struct SyncState {
|
pub struct SyncState {
|
||||||
state: AppState,
|
state: AppState,
|
||||||
auto_fetch: bool,
|
auto_fetch: bool,
|
||||||
frozen: bool,
|
frozen: bool,
|
||||||
|
real_load: bool,
|
||||||
progress: f32,
|
progress: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +102,18 @@ impl NavigatedPage<SyncMessage> for SyncState {
|
|||||||
return tasks;
|
return tasks;
|
||||||
}
|
}
|
||||||
GetLast => {
|
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 id = self.state.sync_data.read().key.clone().unwrap();
|
||||||
let tasks = Task::batch([
|
let tasks = Task::batch([
|
||||||
Task::perform(
|
Task::perform(
|
||||||
@@ -134,7 +149,7 @@ impl NavigatedPage<SyncMessage> for SyncState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Task::done(RootMessage::PushNotification(NotificationRequest::Info(
|
return Task::done(RootMessage::PushNotification(NotificationRequest::Info(
|
||||||
NotificationData::DataLoaded,
|
NotificationData::DataSynced,
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
Disable => {}
|
Disable => {}
|
||||||
@@ -166,6 +181,9 @@ impl NavigatedPage<SyncMessage> for SyncState {
|
|||||||
return push_error_task!(err);
|
return push_error_task!(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ResetRealLoad => {
|
||||||
|
self.real_load = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
@@ -189,6 +207,7 @@ impl SyncState {
|
|||||||
auto_fetch,
|
auto_fetch,
|
||||||
state,
|
state,
|
||||||
frozen: false,
|
frozen: false,
|
||||||
|
real_load: false,
|
||||||
progress: 0.0,
|
progress: 0.0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user