Duplicate identity: user override with Continue Anyway button

When anchor reports duplicate identity, sync pauses and a red banner
shows with a "Continue Anyway" button. Clicking it clears the flag and
starts all sync tasks. Handles false positives from network changes
(WiFi/cellular/VPN switches) without requiring complex staleness checks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Scott Reimers 2026-04-19 15:25:17 -04:00
parent 288b53ffb1
commit 4220674960
2 changed files with 36 additions and 3 deletions

View file

@ -2497,6 +2497,34 @@ async fn export_data(
paths.join(", ")))
}
/// Clear the duplicate identity flag and start sync tasks that were skipped.
#[tauri::command]
async fn clear_duplicate_flag(state: State<'_, AppNode>) -> Result<(), String> {
let node = get_node(&state).await;
node.network.duplicate_detected.store(false, std::sync::atomic::Ordering::Relaxed);
// Start the sync tasks that were skipped during bootstrap
node.start_accept_loop();
node.start_pull_cycle(300);
node.start_diff_cycle(120);
node.start_rebalance_cycle(600);
node.start_growth_loop();
node.start_recovery_loop();
node.start_social_checkin_cycle(3600);
node.start_anchor_register_cycle(600);
node.start_upnp_renewal_cycle();
node.start_upnp_tcp_renewal_cycle();
node.start_http_server();
node.start_bootstrap_connectivity_check();
node.start_replication_cycle(600);
let cache_max_bytes: u64 = {
let storage = node.storage.get().await;
storage.get_setting("cache_size_bytes").ok().flatten()
.and_then(|s| s.parse().ok()).unwrap_or(1_073_741_824u64)
};
Node::start_eviction_cycle(Arc::clone(&node), 300, cache_max_bytes);
Ok(())
}
/// On Android: save a file from the app's internal storage to a user-chosen location via SAF.
/// On desktop: no-op (files are already in ~/Downloads).
#[tauri::command]
@ -2803,6 +2831,7 @@ pub fn run() {
get_active_identity,
export_data,
share_file,
clear_duplicate_flag,
import_summary,
import_public_posts,
import_as_new_identity,