Implement iPhone and Apple Watch preferences (#53)

This commit is contained in:
2026-08-15 22:37:31 +02:00
parent 81886756a2
commit affdb55519
15 changed files with 1409 additions and 60 deletions

View File

@@ -4,8 +4,10 @@ use std::{collections::BTreeSet, error::Error, ffi::OsStr, fs, path::Path, time:
use ironstorage::presentation::DEFAULT_CLIPBOARD_TIMEOUT;
use ironstorage::{
authentication::{DEFAULT_AUTHENTICATION_TIMEOUT, MAX_AUTHENTICATION_TIMEOUT},
config::{ConfigError, ConfigLoader, EditorSource},
authentication::{
AuthenticationTimeout, DEFAULT_AUTHENTICATION_TIMEOUT, MAX_AUTHENTICATION_TIMEOUT,
},
config::{ConfigError, ConfigLoader, EditorSource, MobileAppearance},
desktop::DesktopStorage,
git::GitIdentity,
mobile::MobileTab,
@@ -299,6 +301,29 @@ fn biometric_preference_is_secret_free_and_defaults_to_disabled() -> TestResult
Ok(())
}
#[test]
fn mobile_timeout_and_appearance_share_the_secret_free_configuration() -> TestResult {
let fixture = ConfigurationFixture::new()?;
fs::create_dir_all(fixture.temporary.path().join("cwd/vault"))?;
fixture.write_explicit(fixture.valid_contents())?;
let config = fixture.loader().load(Some(&fixture.explicit_path()))?;
assert_eq!(config.mobile_appearance(), MobileAppearance::System);
config.update_mobile_appearance(MobileAppearance::Dark)?;
config.update_authentication_timeout(AuthenticationTimeout::new(Duration::from_secs(300))?)?;
let reloaded = fixture.loader().load(Some(&fixture.explicit_path()))?;
assert_eq!(reloaded.mobile_appearance(), MobileAppearance::Dark);
assert_eq!(
reloaded.authentication_timeout().duration(),
Duration::from_secs(300)
);
let contents = fs::read_to_string(fixture.explicit_path())?;
assert!(contents.contains("mobile_appearance = \"dark\""));
assert!(contents.contains("inactivity_timeout_seconds = 300"));
assert!(!contents.to_ascii_lowercase().contains("token ="));
Ok(())
}
#[test]
fn desktop_vault_switch_preserves_and_reloads_the_shared_configuration() -> TestResult {
let fixture = ConfigurationFixture::new()?;