Skip to content

Commit

Permalink
[mail-import] rewrite state handling for mail file import, improve UI
Browse files Browse the repository at this point in the history
we're moving to persisting the import state only on the server,
with the files to be imported on disk the only local state that
is kept by the importer.

Most errors happen during import preparation after we receive the files
to import. These can be caught & handled immediately. If no errors
happen, the remote state will be set up on the server at this stage and
can be subscribed to by the UI by loading it via its ID

Some other errors can happen asynchronously while the importer is
running in the background. For those, the importer sets a hook to
receive and handle them as they happen.

any normal state updates are sent to the server in node-mimimi and
received in the UI via entity updates.

Co-authored-by: nig <[email protected]>
Co-authored-by: sug <[email protected]>
Co-authored-by: map <[email protected]>
Co-authored-by: jhm <[email protected]>
Co-authored-by: Kinan <[email protected]>
Co-authored-by: abp <[email protected]>
  • Loading branch information
6 people committed Jan 16, 2025
1 parent dc4d536 commit a2e991d
Show file tree
Hide file tree
Showing 42 changed files with 2,650 additions and 1,940 deletions.
62 changes: 21 additions & 41 deletions ipc-schema/facades/NativeMailImportFacade.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,67 @@
"receivers": ["desktop"],
"doc": "Facade implemented by the native desktop client enabling mail imports, both from files, and via IMAP.",
"methods": {
"startFileImport": {
"doc": "Import multiple mails from .eml or .mbox files.",
"getResumableImport": {
"doc": "@returns the mail import state id of the import that might be resumed",
"arg": [
{
"mailboxId": "string"
},
{
"apiUrl": "string"
},
{
"unencryptedTutaCredentials": "UnencryptedCredentials"
},
{
"targetOwnerGroup": "string"
},
{
"targetFolder": "List<string>"
"unencryptedTutaCredentials": "UnencryptedCredentials"
},
{
"filePaths": "List<string>"
"apiUrl": "string"
}
],
"ret": "void"
"ret": "IdTuple?"
},
"setProgressAction": {
"doc": "Sets progress action for next import iteration",
"prepareNewImport": {
"doc": "set up a new import state for the given parameters and return the ID of the new state entity on the server",
"arg": [
{
"mailboxId": "string"
},
{
"apiUrl": "string"
"targetOwnerGroup": "string"
},
{
"unencryptedTutaCredentials": "UnencryptedCredentials"
"targetMailSet": "List<string>"
},
{
"progressAction": "number"
}
],
"ret": "void"
},
"getResumeableImport": {
"doc": "@returns the mail import state id of the import that might be resumed",
"arg": [
"filePaths": "List<string>"
},
{
"mailboxId": "string"
"unencryptedTutaCredentials": "UnencryptedCredentials"
},
{
"apiUrl": "string"
}
],
"ret": "ResumableImport"
"ret": "IdTuple"
},
"resumeFileImport": {
"doc": "resumes the import for a previously paused import",
"setProgressAction": {
"doc": "Sets progress action for next import iteration",
"arg": [
{
"mailboxId": "string"
},
{
"apiUrl": "string"
},
{
"unencryptedTutaCredentials": "UnencryptedCredentials"
},
{
"importStateId": "IdTuple"
"importProgressAction": "number"
}
],
"ret": "void"
},
"getImportState": {
"doc": "Gets LocalImportState from Importer",
"setAsyncErrorHook": {
"doc": "await to receive any errors and import state changes that must be handled locally",
"arg": [
{
"mailboxId": "string"
}
],
"ret": "LocalImportMailState?"
},
"deinitLogger": {
"doc": "",
"arg": [],
"ret": "void"
}
}
Expand Down
Loading

0 comments on commit a2e991d

Please sign in to comment.