As clients do not handle their own DB anymore, there's no need to perform
operations in a transaction. This logic is now delegated to the rust library.
ET-1697
Since Dagger 2.49, instrumented tests that use setContent + internally call hiltViewModel() fail by default due to issues within the hosting Activity.
This additional activity will be the host for those tests, and the relevant changes will be implemented in the following commit.
NOJIRA
We achieve this by "forcing" the upload when user exists the composer.
Forcing is done through appending an upload job to any existing upload
one (compared to the automatic upload logic which would do nothing when
there is an exisiting job ongoing).
This avoids the edge case of not uploading the last content the user
typed in case the previoud request was still ongoing when the composer
is closed.
- ComposerVM runs storing locally and syncing the draft in a non-cancellable context
- StoreAllFieldsLocally returns only after all use cases were called. This is very important to avoid race conditions between storing locally and uploading when composer is closed
- Forcing upload of draft uses workManager's APPEND_OR_REPLACE existing work policy as it's a valid case for previous work to have failed (eg. new draft without body, works fails due to "DraftRequestNotPerformed" to satisfy API constraints)
MAILANDR-491
The API doesn't accept being called with an empty body.
Body is empty when the draft was just created and any data (subject, recipients..) was added
but the body wasn't. In order to avoid adding ad-hoc logic to create an encrypted empty-string
body, we block the draft creation (triggered by the automatic sync) from happening till a body was added
MAILANDR-491