Sync Home with pull then push and prepare 1.0.1 build 8 (#124)
Dependency security audit / rustsec (push) Successful in 20s
Tagged release / prepare-release (push) Successful in 4s
Tagged release / build-unix (push) Successful in 1h15m17s
Tagged release / build-windows (push) Successful in 19m26s
Tagged release / publish-release (push) Successful in 3s

This commit is contained in:
hugo committed 2026-09-12 12:53:30 +02:00
1 parent 3c3574b449
commit aec3f237a9
12 files changed
+1174 -50

No files matched your search

+29 -1
View File
@@ -1,4 +1,4 @@
//! Storage-owned remote activity and pull-to-refresh models for iPhone Home.
//! Storage-owned remote activity and pull-then-push refresh for iPhone Home.
use std::{
collections::BTreeSet,
@@ -412,6 +412,13 @@ impl MobileHomeOperation {
})
}
pub fn sync(&self) -> Result<MobileHomePage, MobileHomeError> {
// Hold the pull reservation across both steps: sync can replace local entries.
self.run(MobileHomeActionKind::Pull, || {
MobileHomeStorage::load()?.sync(unix_seconds()?, &self.control)
})
}
fn run(
&self,
action: MobileHomeActionKind,
@@ -555,6 +562,27 @@ impl MobileHomeStorage {
.map_err(MobileHomeError::after_push)
}
fn sync(
&self,
now: i64,
control: &GitOperationControl,
) -> Result<MobileHomePage, MobileHomeError> {
let remote = self.remote()?;
let store = self.credentials()?;
let synced = self.git.sync_controlled(remote, &store, control);
let locked = store.lock();
let (_, pushed) = synced.map_err(MobileHomeError::from_git)?;
locked.map_err(MobileHomeError::partial_secret)?;
control
.report(GitProgressPhase::Refreshing)
.map_err(MobileHomeError::from_git)?;
let mut notice = push_notice(&pushed);
notice.title = "Sync Completed".to_owned();
notice.detail = format!("Pull completed successfully. {}", notice.detail);
self.current_page(now, Some(notice))
.map_err(MobileHomeError::after_push)
}
fn credentials(&self) -> Result<NativeSecretStore, MobileHomeError> {
let store = NativeSecretStore::system(
SecretCachePolicy::Disabled,