Finishing deunprap
This commit is contained in:
1 parent
a60ed37cd4
commit
1d24fe2631
5 files changed
+14
-8
No files matched your search
@@ -15,7 +15,7 @@ pub fn get_history_of_set(id: Id) -> Result<Vec<HistoryItem>, NotificationData>
|
||||
let head = app_dir.clone().join(format!("set_{}_history.csv", id));
|
||||
let mut lines = Vec::new();
|
||||
|
||||
append_lines_if_exists(head, &mut lines);
|
||||
append_lines_if_exists(head, &mut lines)?;
|
||||
lines.reverse();
|
||||
Ok(parse_history_items(lines))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::notification::{MaybeError, NotificationData};
|
||||
use crate::notification::NotificationData::{DbLoadError, DbSaveError};
|
||||
use iced::futures::StreamExt;
|
||||
use crate::notification::{MaybeError, NotificationData};
|
||||
use rusqlite::Connection;
|
||||
|
||||
pub fn get_setting(key: String, connection: &Connection) -> Option<String> {
|
||||
|
||||
@@ -30,7 +30,7 @@ pub async fn send_data(id: String) -> MaybeError {
|
||||
.text()
|
||||
.await
|
||||
.map_err(|_| WebApiUnavailable)?;
|
||||
set_local_version(new_version.parse::<u32>().unwrap_or_default()).await;
|
||||
set_local_version(new_version.parse::<u32>().unwrap_or_default()).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ pub async fn load_data(id: String, temp: bool) -> MaybeError {
|
||||
.text()
|
||||
.await
|
||||
.map_err(|_| WebApiUnavailable)?;
|
||||
set_local_version(version.parse::<u32>().unwrap_or_default()).await;
|
||||
set_local_version(version.parse::<u32>().unwrap_or_default()).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ impl ScreenState {
|
||||
if web > local {
|
||||
info!("Web version is newer than local version");
|
||||
load_data(string, true).await?;
|
||||
set_local_version(web).await;
|
||||
set_local_version(web).await?;
|
||||
} else {
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
+9
-2
@@ -139,8 +139,15 @@ impl NavigatedPage<SyncMessage> for SyncState {
|
||||
DisableSync => {
|
||||
let mut state = self.state.lock();
|
||||
state.sync_data.key = None;
|
||||
delete_settings("SYNC_KEY".to_string(), &state.connection);
|
||||
delete_settings("AUTO_WEB_FETCH".to_string(), &state.connection);
|
||||
let save_result = || {
|
||||
delete_settings("SYNC_KEY".to_string(), &state.connection)?;
|
||||
delete_settings("AUTO_WEB_FETCH".to_string(), &state.connection)?;
|
||||
Ok::<(), NotificationData>(())
|
||||
};
|
||||
|
||||
if let Err(error) = save_result() {
|
||||
return push_error_task!(error);
|
||||
}
|
||||
}
|
||||
SwitchAutoSync => {
|
||||
self.auto_fetch = !self.auto_fetch;
|
||||
|
||||
Reference in new issue
Block a user