Skip to content

Commit 0b36842

Browse files
committed
Fix synchronization issues and bump 0.16.1
1 parent 0a1317d commit 0b36842

File tree

3 files changed

+49
-17
lines changed

3 files changed

+49
-17
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rust_keylock"
3-
version = "0.16.0"
3+
version = "0.16.1"
44
authors = ["aston <astonbitecode@gmail.com>"]
55
description = "A password manager with goals to be Secure, Simple to use, Portable and Extensible"
66
keywords = ["password", "manager", "safe", "encryption", "key"]

src/lib.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,23 @@ impl CoreLogicHandler {
325325
.map_err(|error| error!("Cannot update system for save: {:?}", error));
326326
// Reset the filter
327327
s.safe.set_filter("".to_string());
328+
// Initialize the synchronizers
329+
let mut nc_synchronizer = nextcloud::Synchronizer::new(
330+
&s.configuration.nextcloud,
331+
&s.configuration.system,
332+
FILENAME
333+
).unwrap();
334+
nc_synchronizer.init().await;
335+
s.nc_synchronizer = nc_synchronizer;
336+
337+
let mut dbx_synchronizer = dropbox::Synchronizer::new(
338+
&s.configuration.dropbox,
339+
&s.configuration.system,
340+
FILENAME
341+
).unwrap();
342+
dbx_synchronizer.init().await;
343+
s.dbx_synchronizer = dbx_synchronizer;
344+
328345
let rkl_content = RklContent::from((
329346
&s.safe,
330347
&s.configuration.nextcloud,
@@ -686,11 +703,26 @@ Warning: Saving will discard all the entries that could not be recovered.
686703
debug!("A valid configuration for Nextcloud synchronization was found after being updated by the User. Spawning \
687704
nextcloud sync task");
688705
s.contents_changed = true;
706+
// Initialize the synchronizer
707+
let mut nc_synchronizer = nextcloud::Synchronizer::new(
708+
&s.configuration.nextcloud,
709+
&s.configuration.system,
710+
FILENAME
711+
).unwrap();
712+
nc_synchronizer.init().await;
713+
s.nc_synchronizer = nc_synchronizer;
689714
}
690715
if s.configuration.dropbox.is_filled() {
691716
debug!("A valid configuration for dropbox synchronization was found after being updated by the User. Spawning \
692717
dropbox sync task");
693718
s.contents_changed = true;
719+
let mut dbx_synchronizer = dropbox::Synchronizer::new(
720+
&s.configuration.dropbox,
721+
&s.configuration.system,
722+
FILENAME
723+
).unwrap();
724+
dbx_synchronizer.init().await;
725+
s.dbx_synchronizer = dbx_synchronizer;
694726
}
695727
Box::pin(future::ready(UserSelection::GoTo(Menu::Main)))
696728
}

tests/execution_cases.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -524,58 +524,58 @@ impl TestEditor {
524524
#[async_trait]
525525
impl AsyncEditor for TestEditor {
526526
async fn show_password_enter(&self) -> UserSelection {
527-
println!("TestEditor::show_password_enter");
527+
println!("====== TestEditor::show_password_enter");
528528
let to_ret = self.return_first_selection();
529-
println!("Returning {:?}", to_ret);
529+
println!("====== Returning {:?}", to_ret);
530530
to_ret
531531
}
532532

533533
async fn show_change_password(&self) -> UserSelection {
534-
println!("TestEditor::show_change_password");
534+
println!("====== TestEditor::show_change_password");
535535
let to_ret = self.return_first_selection();
536-
println!("Returning {:?}", to_ret);
536+
println!("====== Returning {:?}", to_ret);
537537
to_ret
538538
}
539539

540540
async fn show_menu(&self, m: Menu) -> UserSelection {
541-
println!("TestEditor::show_menu {:?}", m);
541+
println!("====== TestEditor::show_menu {:?}", m);
542542
let to_ret = self.return_first_selection();
543-
println!("Returning {:?}", to_ret);
543+
println!("====== Returning {:?}", to_ret);
544544
to_ret
545545
}
546546

547547
async fn show_entries(&self, entries: Vec<Entry>, filter: String) -> UserSelection {
548-
println!("TestEditor::show_entries {:?} with filter {}", entries, filter);
548+
println!("====== TestEditor::show_entries {:?} with filter {}", entries, filter);
549549
let to_ret = self.return_first_selection();
550-
println!("Returning {:?}", to_ret);
550+
println!("====== Returning {:?}", to_ret);
551551
to_ret
552552
}
553553

554554
async fn show_entry(&self, entry: Entry, index: usize, presentation_type: EntryPresentationType) -> UserSelection {
555-
println!("TestEditor::show_entry {:?} with index {} and presentation_type {:?}", entry, index, presentation_type);
555+
println!("====== TestEditor::show_entry {:?} with index {} and presentation_type {:?}", entry, index, presentation_type);
556556
let to_ret = self.return_first_selection();
557-
println!("Returning {:?}", to_ret);
557+
println!("====== Returning {:?}", to_ret);
558558
to_ret
559559
}
560560

561561
async fn exit(&self, force: bool) -> UserSelection {
562-
println!("TestEditor::exit {}", force);
562+
println!("====== TestEditor::exit {}", force);
563563
let to_ret = self.return_first_selection();
564-
println!("Returning {:?}", to_ret);
564+
println!("====== Returning {:?}", to_ret);
565565
to_ret
566566
}
567567

568568
async fn show_configuration(&self, nextcloud: NextcloudConfiguration, dropbox: DropboxConfiguration, gen: GeneralConfiguration) -> UserSelection {
569-
println!("TestEditor::show_configuration with {:?}, {:?} and {:?}", nextcloud, dropbox, gen);
569+
println!("====== TestEditor::show_configuration with {:?}, {:?} and {:?}", nextcloud, dropbox, gen);
570570
let to_ret = self.return_first_selection();
571-
println!("Returning {:?}", to_ret);
571+
println!("====== Returning {:?}", to_ret);
572572
to_ret
573573
}
574574

575575
async fn show_message(&self, m: &str, _: Vec<UserOption>, _: MessageSeverity) -> UserSelection {
576-
println!("TestEditor::show_message {}", m);
576+
println!("====== TestEditor::show_message {}", m);
577577
let to_ret = self.return_first_selection();
578-
println!("Returning {:?}", to_ret);
578+
println!("====== Returning {:?}", to_ret);
579579
to_ret
580580
}
581581

0 commit comments

Comments
 (0)