Allow locked iPhone Git actions (#51)
This commit is contained in:
@@ -1912,12 +1912,12 @@ pub fn set_selected_mobile_tab(tab: MobileTab) -> Result<(), MobilePreferenceErr
|
||||
|
||||
#[uniffi::export]
|
||||
pub fn mobile_home_operation(
|
||||
authentication: Arc<MobileAuthentication>,
|
||||
authentication: Option<Arc<MobileAuthentication>>,
|
||||
) -> Arc<MobileHomeOperation> {
|
||||
Arc::new(MobileHomeOperation {
|
||||
operation: mobile_home::MobileHomeOperation::new(Arc::clone(
|
||||
&authentication.authentication,
|
||||
)),
|
||||
operation: mobile_home::MobileHomeOperation::new(
|
||||
authentication.map(|authentication| Arc::clone(&authentication.authentication)),
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1991,7 +1991,7 @@ pub fn replace_configured_mobile_application_token(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{
|
||||
MobileHomeActionKind, MobileOnboardingErrorKind, MobileOnboardingFfiError,
|
||||
MobileHomeActionKind, MobileHomePhase, MobileOnboardingErrorKind, MobileOnboardingFfiError,
|
||||
MobileShellState, MobileTab, StorageHomeActionKind,
|
||||
};
|
||||
|
||||
@@ -2042,4 +2042,11 @@ mod tests {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,14 +313,14 @@ impl MobileHomeProgress {
|
||||
}
|
||||
|
||||
pub struct MobileHomeOperation {
|
||||
authentication: Arc<MobileAuthentication>,
|
||||
authentication: Option<Arc<MobileAuthentication>>,
|
||||
control: GitOperationControl,
|
||||
phase: Arc<Mutex<MobileHomePhase>>,
|
||||
action: Mutex<Option<MobileHomeActionKind>>,
|
||||
}
|
||||
|
||||
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 observed = Arc::clone(&phase);
|
||||
Self {
|
||||
@@ -413,8 +413,13 @@ impl MobileHomeOperation {
|
||||
}
|
||||
let reservation = self
|
||||
.authentication
|
||||
.reserve_repository_operation(repository_operation(action))
|
||||
.map_err(MobileHomeError::from_reservation)?;
|
||||
.as_ref()
|
||||
.map(|authentication| {
|
||||
authentication
|
||||
.reserve_repository_operation(repository_operation(action))
|
||||
.map_err(MobileHomeError::from_reservation)
|
||||
})
|
||||
.transpose()?;
|
||||
let result = operation();
|
||||
drop(reservation);
|
||||
result
|
||||
|
||||
Reference in New Issue
Block a user