feat(android): add structured entry editor and encrypted draft recovery (#103)
This commit is contained in:
1 parent
d22d71eb5e
commit
06575363a2
23 files changed
+2330
-21
No files matched your search
@@ -24,7 +24,9 @@ use ironstorage::{
|
||||
MobileAuthenticationError as StorageAuthenticationError,
|
||||
MobileAuthenticationErrorKind as StorageAuthenticationErrorKind,
|
||||
MobileAuthenticationState as StorageAuthenticationState,
|
||||
MobileEntryCopy as StorageEntryCopy, MobileEntryPresentation as StorageEntryPresentation,
|
||||
MobileEntryCopy as StorageEntryCopy,
|
||||
MobileEntryEditorRecovery as StorageEntryEditorRecovery,
|
||||
MobileEntryPresentation as StorageEntryPresentation,
|
||||
MobilePreferences as StorageMobilePreferences,
|
||||
},
|
||||
mobile_entry::{
|
||||
@@ -88,6 +90,11 @@ pub use android_onboarding::*;
|
||||
mod platform;
|
||||
pub use platform::*;
|
||||
|
||||
#[uniffi::export]
|
||||
pub fn mobile_editor_process_recreated_notice() -> String {
|
||||
ironstorage::mobile_entry::editor_process_recreated_notice().to_owned()
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, uniffi::Enum)]
|
||||
pub enum MobileIcon {
|
||||
Home,
|
||||
@@ -1389,6 +1396,29 @@ impl From<MobileEntryEditorInput> for StorageEntryEditorInput {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct MobileEntryEditorRecovery {
|
||||
pub session: MobileEntryEditorSession,
|
||||
pub inputs: Option<Vec<MobileEntryEditorInput>>,
|
||||
}
|
||||
|
||||
impl From<StorageEntryEditorRecovery> for MobileEntryEditorRecovery {
|
||||
fn from(recovery: StorageEntryEditorRecovery) -> Self {
|
||||
Self {
|
||||
session: recovery.session.into(),
|
||||
inputs: recovery.inputs.map(|inputs| {
|
||||
inputs
|
||||
.into_iter()
|
||||
.map(|input| {
|
||||
let (id, name, value) = input.into_parts();
|
||||
MobileEntryEditorInput { id, name, value }
|
||||
})
|
||||
.collect()
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<StorageEntryCopy> for MobileEntryCopy {
|
||||
fn from(copy: StorageEntryCopy) -> Self {
|
||||
Self {
|
||||
@@ -1954,6 +1984,46 @@ impl MobileAuthentication {
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn checkpoint_entry_editor(
|
||||
&self,
|
||||
editor: u64,
|
||||
version: u64,
|
||||
) -> Result<(), MobileAuthenticationFfiError> {
|
||||
self.authentication
|
||||
.checkpoint_entry_editor(editor, version)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn checkpoint_entry_editor_inputs(
|
||||
&self,
|
||||
editor: u64,
|
||||
version: u64,
|
||||
fields: Vec<MobileEntryEditorInput>,
|
||||
) -> Result<(), MobileAuthenticationFfiError> {
|
||||
self.authentication
|
||||
.checkpoint_entry_editor_inputs(
|
||||
editor,
|
||||
version,
|
||||
fields.into_iter().map(Into::into).collect(),
|
||||
)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn resume_entry_editor(
|
||||
&self,
|
||||
editor: u64,
|
||||
passphrase: Option<String>,
|
||||
) -> Result<MobileEntryEditorRecovery, MobileAuthenticationFfiError> {
|
||||
self.authentication
|
||||
.resume_entry_editor(
|
||||
editor,
|
||||
passphrase
|
||||
.map(|value| ironstorage::repository::SecretBytes::new(value.into_bytes())),
|
||||
)
|
||||
.map(Into::into)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn begin_entry_editor(
|
||||
&self,
|
||||
path: String,
|
||||
|
||||
Reference in new issue
Block a user