Allow locked iPhone Git actions (#51)

This commit is contained in:
2026-08-14 17:53:48 +02:00
parent 65eb1da71c
commit cc2c30b0ef
5 changed files with 49 additions and 27 deletions

View File

@@ -6519,6 +6519,30 @@ fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer {
} }
} }
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeMobileAuthentication: FfiConverterRustBuffer {
typealias SwiftType = MobileAuthentication?
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
guard let value = value else {
writeInt(&buf, Int8(0))
return
}
writeInt(&buf, Int8(1))
FfiConverterTypeMobileAuthentication.write(value, into: &buf)
}
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
switch try readInt(&buf) as Int8 {
case 0: return nil
case 1: return try FfiConverterTypeMobileAuthentication.read(from: &buf)
default: throw UniffiInternalError.unexpectedOptionalTag
}
}
}
#if swift(>=5.8) #if swift(>=5.8)
@_documentation(visibility: private) @_documentation(visibility: private)
#endif #endif
@@ -7020,11 +7044,11 @@ public func mobileAuthentication()throws -> MobileAuthentication {
) )
}) })
} }
public func mobileHomeOperation(authentication: MobileAuthentication) -> MobileHomeOperation { public func mobileHomeOperation(authentication: MobileAuthentication?) -> MobileHomeOperation {
return try! FfiConverterTypeMobileHomeOperation_lift(try! rustCall() { return try! FfiConverterTypeMobileHomeOperation_lift(try! rustCall() {
uniffiCallStatus in uniffiCallStatus in
uniffi_ironstorage_apple_fn_func_mobile_home_operation( uniffi_ironstorage_apple_fn_func_mobile_home_operation(
FfiConverterTypeMobileAuthentication_lower(authentication),uniffiCallStatus FfiConverterOptionTypeMobileAuthentication.lower(authentication),uniffiCallStatus
) )
}) })
} }
@@ -7125,7 +7149,7 @@ private let initializationResult: InitializationResult = {
if (uniffi_ironstorage_apple_checksum_func_mobile_authentication() != 38258) { if (uniffi_ironstorage_apple_checksum_func_mobile_authentication() != 38258) {
return InitializationResult.apiChecksumMismatch return InitializationResult.apiChecksumMismatch
} }
if (uniffi_ironstorage_apple_checksum_func_mobile_home_operation() != 64540) { if (uniffi_ironstorage_apple_checksum_func_mobile_home_operation() != 26980) {
return InitializationResult.apiChecksumMismatch return InitializationResult.apiChecksumMismatch
} }
if (uniffi_ironstorage_apple_checksum_func_mobile_key_transfer() != 57389) { if (uniffi_ironstorage_apple_checksum_func_mobile_key_transfer() != 57389) {

View File

@@ -561,7 +561,7 @@ uint64_t uniffi_ironstorage_apple_fn_func_mobile_authentication(RustCallStatus *
#endif #endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_HOME_OPERATION #ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_HOME_OPERATION
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_HOME_OPERATION #define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_HOME_OPERATION
uint64_t uniffi_ironstorage_apple_fn_func_mobile_home_operation(uint64_t authentication, RustCallStatus *_Nonnull out_status uint64_t uniffi_ironstorage_apple_fn_func_mobile_home_operation(RustBuffer authentication, RustCallStatus *_Nonnull out_status
); );
#endif #endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_KEY_TRANSFER #ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_KEY_TRANSFER

View File

@@ -592,10 +592,6 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
guard homePage == nil, homeTask == nil, !isHomeWorking else { return } guard homePage == nil, homeTask == nil, !isHomeWorking else { return }
homeGeneration += 1 homeGeneration += 1
let current = homeGeneration let current = homeGeneration
guard let authentication else {
showHomeFailure(.unavailable)
return
}
let operation = mobileHomeOperation(authentication: authentication) let operation = mobileHomeOperation(authentication: authentication)
homeOperation = operation homeOperation = operation
isHomeWorking = true isHomeWorking = true
@@ -621,10 +617,6 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
private func runHome(_ request: HomeRequest) { private func runHome(_ request: HomeRequest) {
guard page.state == .ready, shellTab == .home, !isHomeWorking else { return } guard page.state == .ready, shellTab == .home, !isHomeWorking else { return }
guard let authentication else {
showHomeFailure(.unavailable)
return
}
cancelHomeWork() cancelHomeWork()
homeGeneration += 1 homeGeneration += 1
let current = homeGeneration let current = homeGeneration
@@ -5421,12 +5413,6 @@ private struct HomeFailure: Error, Sendable {
detail: "IronStorage could not load the storage-provided Home page." detail: "IronStorage could not load the storage-provided Home page."
) )
static let unavailable = HomeFailure(
kind: .configuration,
title: "Home Is Unavailable",
detail: "Complete password-store setup before using Git actions."
)
private init(kind: MobileHomeErrorKind, title: String, detail: String) { private init(kind: MobileHomeErrorKind, title: String, detail: String) {
self.kind = kind self.kind = kind
self.title = title self.title = title

View File

@@ -1912,12 +1912,12 @@ pub fn set_selected_mobile_tab(tab: MobileTab) -> Result<(), MobilePreferenceErr
#[uniffi::export] #[uniffi::export]
pub fn mobile_home_operation( pub fn mobile_home_operation(
authentication: Arc<MobileAuthentication>, authentication: Option<Arc<MobileAuthentication>>,
) -> Arc<MobileHomeOperation> { ) -> Arc<MobileHomeOperation> {
Arc::new(MobileHomeOperation { Arc::new(MobileHomeOperation {
operation: mobile_home::MobileHomeOperation::new(Arc::clone( operation: mobile_home::MobileHomeOperation::new(
&authentication.authentication, authentication.map(|authentication| Arc::clone(&authentication.authentication)),
)), ),
}) })
} }
@@ -1991,7 +1991,7 @@ pub fn replace_configured_mobile_application_token(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{ use super::{
MobileHomeActionKind, MobileOnboardingErrorKind, MobileOnboardingFfiError, MobileHomeActionKind, MobileHomePhase, MobileOnboardingErrorKind, MobileOnboardingFfiError,
MobileShellState, MobileTab, StorageHomeActionKind, MobileShellState, MobileTab, StorageHomeActionKind,
}; };
@@ -2042,4 +2042,11 @@ mod tests {
MobileHomeActionKind::Push MobileHomeActionKind::Push
); );
} }
#[test]
fn home_bridge_does_not_require_entry_authentication() {
let operation = super::mobile_home_operation(None);
assert_eq!(operation.progress().phase, MobileHomePhase::Validating);
operation.cancel();
}
} }

View File

@@ -313,14 +313,14 @@ impl MobileHomeProgress {
} }
pub struct MobileHomeOperation { pub struct MobileHomeOperation {
authentication: Arc<MobileAuthentication>, authentication: Option<Arc<MobileAuthentication>>,
control: GitOperationControl, control: GitOperationControl,
phase: Arc<Mutex<MobileHomePhase>>, phase: Arc<Mutex<MobileHomePhase>>,
action: Mutex<Option<MobileHomeActionKind>>, action: Mutex<Option<MobileHomeActionKind>>,
} }
impl MobileHomeOperation { impl MobileHomeOperation {
pub fn new(authentication: Arc<MobileAuthentication>) -> Self { pub fn new(authentication: Option<Arc<MobileAuthentication>>) -> Self {
let phase = Arc::new(Mutex::new(MobileHomePhase::Validating)); let phase = Arc::new(Mutex::new(MobileHomePhase::Validating));
let observed = Arc::clone(&phase); let observed = Arc::clone(&phase);
Self { Self {
@@ -413,8 +413,13 @@ impl MobileHomeOperation {
} }
let reservation = self let reservation = self
.authentication .authentication
.reserve_repository_operation(repository_operation(action)) .as_ref()
.map_err(MobileHomeError::from_reservation)?; .map(|authentication| {
authentication
.reserve_repository_operation(repository_operation(action))
.map_err(MobileHomeError::from_reservation)
})
.transpose()?;
let result = operation(); let result = operation();
drop(reservation); drop(reservation);
result result