Merge pull request #510 from PR0M3TH3AN/codex/refactor-sync-calls-in-password-manager

Use background sync after profile changes
This commit is contained in:
thePR0M3TH3AN
2025-07-13 17:10:56 -04:00
committed by GitHub

View File

@@ -533,13 +533,7 @@ class PasswordManager:
# Initialize BIP85 and other managers # Initialize BIP85 and other managers
self.initialize_bip85() self.initialize_bip85()
self.initialize_managers() self.initialize_managers()
if ( self.start_background_sync()
getattr(self, "config_manager", None)
and self.config_manager.get_quick_unlock()
):
self.start_background_sync()
else:
self.sync_index_from_nostr()
print(colored(f"Switched to seed profile {selected_fingerprint}.", "green")) print(colored(f"Switched to seed profile {selected_fingerprint}.", "green"))
# Re-initialize NostrClient with the new fingerprint # Re-initialize NostrClient with the new fingerprint
@@ -613,13 +607,7 @@ class PasswordManager:
self.initialize_managers() self.initialize_managers()
self.locked = False self.locked = False
self.update_activity() self.update_activity()
if ( self.start_background_sync()
getattr(self, "config_manager", None)
and self.config_manager.get_quick_unlock()
):
self.start_background_sync()
else:
self.sync_index_from_nostr()
def handle_existing_seed(self) -> None: def handle_existing_seed(self) -> None:
""" """
@@ -791,13 +779,7 @@ class PasswordManager:
self.initialize_bip85() self.initialize_bip85()
self.initialize_managers() self.initialize_managers()
if ( self.start_background_sync()
getattr(self, "config_manager", None)
and self.config_manager.get_quick_unlock()
):
self.start_background_sync()
else:
self.sync_index_from_nostr()
return fingerprint # Return the generated or added fingerprint return fingerprint # Return the generated or added fingerprint
except BaseException: except BaseException:
# Clean up partial profile on failure or interruption # Clean up partial profile on failure or interruption
@@ -952,13 +934,7 @@ class PasswordManager:
self.initialize_bip85() self.initialize_bip85()
self.initialize_managers() self.initialize_managers()
if ( self.start_background_sync()
getattr(self, "config_manager", None)
and self.config_manager.get_quick_unlock()
):
self.start_background_sync()
else:
self.sync_index_from_nostr()
except Exception as e: except Exception as e:
logging.error(f"Failed to encrypt and save parent seed: {e}", exc_info=True) logging.error(f"Failed to encrypt and save parent seed: {e}", exc_info=True)
print(colored(f"Error: Failed to encrypt and save parent seed: {e}", "red")) print(colored(f"Error: Failed to encrypt and save parent seed: {e}", "red"))