Commit Graph

200 Commits

Author SHA1 Message Date
Marino Meneghel c97869b0ed Adapt 'display remote content' functionality to conversations
By passing through the callback the message on which the 'loading remote
resources' was requested and notify the item changed once 'loading
remote data' was enabled on the webview.

MAILAND-1770
2021-06-14 17:34:51 +02:00
Marino Meneghel b249049468 Change MessageRenderer to define images directory dynamically
Since the "file directory" where images are stored is the messageId,
injecting it at class creation is not sufficient anymore with the
addition of conversations (when showing a converation's details
MessageRenderer would be init with conversationId, which is not a valid
image directory and would cause images not to be found).

The directory is now defined using each embedded image `messageId` field

MAILAND-1770
2021-06-14 17:34:51 +02:00
Marino Meneghel 99b0d41d77 Adapt 'load embedded images' functionality to work for conversations too
Beforehand, this functionality was working by injecting a string (the
html body with the images) into the adapter which would replace any
content of the webview with the new string. As with conversations we can
have multiple webviews, this didn't work anymore.

The new approach leverages the components currently in place to avoid
touching on a too wide scope: `MessageRenderer` is still in charge of
creating a message body with inline images. Such body is now being
returned with the messageId to which the body refers too. It's observed
in the MessageDetailsViewModel.init method and when fired it "hot swaps"
the `decryptedHtml` on the correct message and emit the
convresationUiModel again for the adapter to refresh the displayed data.

Summary of tech changes:
- Changed MessageRender to return an object containing both the
"rendered message body" and the messageId for which such body was rendered
- Removed `distinctUntilChanged` from _decryptedMessageLiveData as it
prevented embedded images from being emitted (as Message.decryptedHtml
field is not considered for computing equality)

- Rename `embeddedImagesAttachments` field following naming conventions
- `prepareEmbeddedImages` method receives message for which images should be prepared
- Message.decryptedHTML field can be set from outside of the model
- Remove redundant downloadEmbeddedImagesResult live data

MAILAND-1770
2021-06-14 17:34:51 +02:00
Marino Meneghel 83f49e43cc Refactor MessageDetailsAdapter to make it simpler and more readable
- Move adapter fields to local variables where possible
- Remove redundant "refresh recipeints" logic (this wouldn't work with
  conversations as it would always use the first message's recipeint.
  Moreover, when keys are refreshed on the VM, a new message is emitted
  and the adapter will be refreshed)
- Reformat MessageBodyScaleListener class
- Do not pass MessageInfoView to MessageBodyScaleListener as the
  transitionY that was applied to it had no visible effect.
- Rename displayRemoteContentButton for clarity

- Manually fixed rebase conflicts due to changes from 609fdbb596

MAILAND-1770
2021-06-14 17:34:51 +02:00
Marino Meneghel 01949c57eb Messages inside a conversation are ordered chronologically
MAILAND-1770
2021-06-14 17:34:51 +02:00
Marino Meneghel 9a9909e940 Display attachments for each message in a conversation
By pulling the creation of the "attachments adapter" and the displaying
logic into the adapter (so that it gets executed for each item).
Twp pieces of functionality to "set is pgp encrypted" and hide the
"download attachments" spinner were dropped, as migrating them implied a
relevant effort and the existing plan to change attachment presentation
will invalidate such features anyways.

- Manually changed AttachmentsView to MessageDetailsAttachmentView in
  layout_message_details_web_view while rebasing over
  609fdbb596 changes

MAILAND-1770
2021-06-14 17:34:38 +02:00
Marino Meneghel afb0568b46 Message detail displays the right body for each message in a conversation
Instaead of "injecting" a 'content' string into the adapter once the
message body was ready for rendering, this commit introduces a
`loadMessageBody` method on the VM which takes care of fetching the
messageBody from network when not available, decrypting it and returning
it to the adapter to be displayed into the message's webview.

MAILAND-1770
2021-06-14 17:32:30 +02:00
Marino Meneghel 76b5f530f9 Message Detail only marks a message as read when it was unread
MAILAND-1767
2021-06-14 17:31:34 +02:00
Marino Meneghel 76bb319e59 Extract mapping of conversation / message to UiModel to separated mapper
- Make private getMessageFlow and getConversationFlow be flows to keep
  `asLiveData` in a signle place

MAILAND-1767
2021-06-14 17:31:34 +02:00
Marino Meneghel efa1c3d02b Mark a message as read when the message detail screen is loaded successully
We use the message decryption as "milestone" to define the message was
loaded successfully.

MAILAND-1767
2021-06-14 17:31:34 +02:00
Marino Meneghel 2da64589f4 ConversationUiModel exposes an optional 'messagesCount' field
This will be shown in the UI (top of subject) when conversation mode is on

MAILAND-1767
2021-06-14 17:31:34 +02:00
Marino Meneghel e2eea59cc4 Simplify outdated logic and extract methods for readability
Since MessageDetailsActivity is not observing the attachments anymore we
can drop the workaround that was storing attachments in a field and
performing some odd checks on it at each method call.

- Extract loadConversationDetails method for clarity
- Rename messageId in MessageDetailsActivity to messageOrConversationId
- Extract lastMessageId method to force the existing logic to work on
  the last conversation message (when in conversation mode)

MAILAND-1767
2021-06-14 17:31:34 +02:00
Marino Meneghel 3ae34e3b32 Separate logic to handle conversation / message loaded actions
This solves a couple of UI issues:
- Error Toast being shown when opeining a conversation as the first
  returned conversation in the flow has no messages
- Pass conversation data to the view when a conversation is loaded
  (subject, labels etc)

MAILAND-1767
2021-06-14 17:31:34 +02:00
Marino Meneghel a2f08fcedc Prevent attachments view from randomly not being displayed
This issue started happening after 648f4710e56a4797360e1. The bit that
was preventing this was the flag `isDecrypted` which was ensuring the
view was only being called once with a given message.
Mutiple calls to the view cause the issue mentioned above, for which
opening the same message multiple times causes the attachments view to
being shown / hidden randomly.
No issue was found in the attachments data itself (which is always
valid). The assumption is that the issue lies in the adapter's logic
which resets / invalidates the attachments view when showing the
message. This will be tracked in the backlog as tech debt.

- Do not emit the same data twice (distinctUntilChanged)

MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel fb7bd878fb ConversationUiModel is assigned at ViewModel's creation time
As otherwise some methods which depends on this (such as loading of
embedded images) might encounter race conditions which would break
their functionality

MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel f1d22547d6 MessageDetails VM observes either conversation or message in the DB
Depending on whether conversation mode is enabled or not. This is
particularly useful to have access to the model that's currently being
displayed to the user to perform actions.

MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel 8c781c36a6 Rename message Id vars to "messageOrConversationId"
MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel 8fe8c1b5f0 Message Detail's view receives a List of messages from a conversation
The messages are wrapped into the `ConversationUiModel` object and they
are always a list (with 1 message when loading a detail in single message mode)

Currently, all the functionalities that are depending on a single
message (eg. decryption, getting attachments, labels etc) **were changed
to act on the last message of the list**

MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel 03f343578f Message Details shows last message of a converations
when passing in a conversation ID. This is an intermediate step to get to show
all the messages of a conversation.

- MessageDetailsActivity receives "location" as input param (extra) and
  uses it to infer if conversation mode is ON
- loadMessageDetails loads conversation (when ON) and return the last
  message within the ConversationUiModel

MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel b6b3393999 Revert removal of observing message in DB for message Details
This is a (manual) partial revert of commit e46d10dbf1061b4c.

Since at now the Detail UI relies on the DB to display updates about
any actions (eg. Add / remove label, star...) we can't stop observing
the message.

MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel 41506bad7e Manually fix rebase conflicts leftovers
Rebasing over develop these methods were mistakenly kept

MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel 17f3d6251a Introduce ConversationUiModel to break Detail View dependency on Message model
MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel aef1daf21e Remove unneded 'request pending' boolean flag
MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel 34fce5c331 Merge decryptMessage and emitMessage methods to improve clarity
- Remove duplicated, uneeded emission
- Remove unneded instance variables

MAILAND-1767
2021-06-14 17:31:33 +02:00
Marino Meneghel a9745f4d68 Simplify Message Details loading logic
- Remove public "message" live data / flow to encapsulate loading logic in the VM
- View now observes only 'decryptedMessageData' to get the detail (source of truth)
- Refactor fetching logic to be synchronous over having a
  "MediatorLiveData" which observes multiple properties. Now the message
  detail should only be emitted once, when all the needed data was computed.
- Replace "manual" local vs API logic with usage of MessageRepository
- Drop reloading dependencies by user

MAILAND-1767
2021-06-14 17:31:33 +02:00
Davide Farella f377536660 Implement adding attachments from forwarded message
MAILAND-1669
2021-06-08 09:51:15 +02:00
Davide Farella 4bef62cfb0 Leverage default label coloring logic from ViewModels 2021-05-18 08:26:35 +00:00
Marino Meneghel 255dc47089 Manually solve conflicts after rebasing on develop
- Define value of `userId` field directly in the VM instead of relying
  on clients to set it
2021-05-17 18:41:07 +02:00
Marino Meneghel 0078229871 Remove "isTransient" flag from everywhere
Such flag was used to differentiate between messages that were coming
from "Search" (being the transient ones) and those that weren't.

This conditional being performed in many places was adding a lot of
noise and not really bringing any value, as the same behaviour can be
achieved by not storing messages from search in the first place.
2021-05-17 18:41:05 +02:00
Marino Meneghel 6dd27b509c Cleanup MessageDetailsViewModel by removing unused code
- Remove unused methods
- Remove prepareMessage method and calls as it is doing nothing
- Track some improvements in the backlog and link back the tasks in the
  comments

MAILAND-1767
2021-05-17 18:38:01 +02:00
Tomasz Giszczak 58be7ac3ec Check isDecrypted state before marking message as read in message details view model.
MAILAND-1868
2021-05-17 13:06:49 +02:00
Tomasz Giszczak 469669e3e7 Updated message read/unread logic settings, make as unread when message is decrypted, added more loging.
MAILAND-1868
2021-05-17 11:41:59 +02:00
Tomasz Giszczak f835cb7dbe Fixed saving multiple times different attachments with the same name, causing a counter being added in the wrong place of file name due to mime type resolution.
MAILAND-1855
2021-05-14 13:53:11 +00:00
Davide Farella ae5510f913 Move mapping to LabelChipUiModel to MessageDetailsViewModel.kt
MAILAND-1502
2021-05-13 17:20:52 +02:00
Davide Farella 65ac54efd3 Move mapping to LabelChipUiModel to MessageDetailsViewModel.kt
MAILAND-1502
2021-05-13 17:20:52 +02:00
Davide Farella 514f83e1bd Move new files to proper packages inside /label/
MAILAND-1401
2021-05-11 15:50:25 +02:00
Tomasz Giszczak 001d21f92a Created MessageActionSheetViewModel renamed MessageDetailsActionSheet as MessageActionSheet for more generic usage.
MAILAND-1401
2021-05-11 15:50:25 +02:00
Tomasz Giszczak b70c58c64a Defined move message logic in MessageDetailsActionSheet depending on current message location.
MAILAND-1401
2021-05-11 15:50:25 +02:00
Tomasz Giszczak 32a3f92cf4 Updated details sheet with the latest design items order changes.
MAILAND-1401
2021-05-11 15:50:25 +02:00
Tomasz Giszczak 8e0b49d694 Added back pressed to close details screen when move to trash/archive/spam happens. Therefore 2 screens are closed at the same time.
MAILAND-1401
2021-05-11 15:50:24 +02:00
Tomasz Giszczak ac1c8b5054 Sending mail actions reply, reply to all, forward added to details actions sheet.
MAILAND-1401
2021-05-11 15:50:24 +02:00
Davide Farella 88484df8c0 Added support of auxiliary actions of MessageDetailsActionSheet.
MAILAND-1401
2021-05-11 15:50:24 +02:00
Tomasz Giszczak ef6a775f90 Fixed print action on message details.
MAILAND-1401
2021-05-11 15:50:24 +02:00
Tomasz Giszczak 6dbe8ac2c3 Added view binding to MessageDetailsActionSheet and some basic actions handling.
MAILAND-1401
2021-05-11 15:50:24 +02:00
Tomasz Giszczak 8454ae538a Linked MessageDetailsViewModel for click actions handling.
MAILAND-1401
2021-05-11 15:50:24 +02:00
Zorica Stojchevska 41986f83e7 Implement getConversation method in conversation repository
- Add method in Conversations Repository that will allow us to get the conversation with it's messages from the Remote or Local source.
- Add a way to save the messages into the Message Table
- Add API call to get conversation with it's messages

MAILAND-1766
2021-05-10 13:38:10 +00:00
Neil Marietta 3528d236c1 Refactored UserManager Current/User getters. 2021-05-07 14:12:20 +02:00
Tomasz Giszczak 2d2865c6a6 Updated Hilt to v2.33 2021-04-27 14:46:11 +00:00
Zorica Stojchevska e8406ee42d Add the location id of the message we are trying to delete as currentLabelID to the endpoint to avoid concurrency issues
MAILAND-1556

Affected: Deleting a message from Mailbox, MessageDetails and Composer
2021-04-06 10:54:42 +00:00
Zorica Stojchevska 2befc5160d fix FileNotFoundException when viewing or downloading attachment 2021-04-05 10:35:36 +00:00
Davide Farella 8d6497491e Fix tests after rebase
MAILAND-1189

# Conflicts:
#	app/src/main/java/ch/protonmail/android/activities/messageDetails/repository/MessageDetailsRepository.kt
#	app/src/main/java/ch/protonmail/android/data/local/MessageDao.kt
#	app/src/test/java/ch/protonmail/android/compose/ComposeMessageViewModelTest.kt
#	app/src/test/java/ch/protonmail/android/usecase/compose/SaveDraftTest.kt
#	app/src/test/java/ch/protonmail/android/worker/CreateDraftWorkerTest.kt

# Conflicts:
#	app/src/main/java/ch/protonmail/android/activities/mailbox/OnParentEventTask.kt
#	app/src/main/java/ch/protonmail/android/activities/messageDetails/repository/MessageDetailsRepository.kt
#	app/src/main/java/ch/protonmail/android/api/services/PostMessageServiceFactory.kt
#	app/src/main/java/ch/protonmail/android/compose/ComposeMessageViewModel.kt
#	app/src/main/java/ch/protonmail/android/jobs/messages/PostMessageJob.java
#	app/src/main/java/ch/protonmail/android/usecase/compose/SaveDraft.kt
#	app/src/main/java/ch/protonmail/android/worker/drafts/CreateDraftWorker.kt
#	app/src/test/java/ch/protonmail/android/attachments/UploadAttachmentsTest.kt
#	app/src/test/java/ch/protonmail/android/compose/ComposeMessageViewModelTest.kt
#	app/src/test/java/ch/protonmail/android/usecase/compose/SaveDraftTest.kt

# Conflicts:
#	app/src/main/java/ch/protonmail/android/fcm/FcmIntentService.java
2021-03-18 10:48:13 +01:00
Davide Farella 9a0fcf7f41 Clean up and fixes after rebase
MAILAND-1189

# Conflicts:
#	app/src/main/java/ch/protonmail/android/activities/messageDetails/repository/MessageDetailsRepository.kt
#	app/src/main/java/ch/protonmail/android/attachments/DownloadEmbeddedAttachmentsWorker.kt
#	app/src/main/java/ch/protonmail/android/attachments/UploadAttachments.kt
#	app/src/main/java/ch/protonmail/android/data/local/model/Message.kt
#	app/src/main/java/ch/protonmail/android/jobs/messages/PostMessageJob.java
#	app/src/main/java/ch/protonmail/android/storage/AttachmentClearingService.java

# Conflicts:
#	app/src/main/java/ch/protonmail/android/activities/multiuser/ConnectAccountActivity.kt
#	app/src/main/java/ch/protonmail/android/jobs/messages/PostMessageJob.java
#	app/src/main/java/ch/protonmail/android/utils/notifier/AndroidErrorNotifier.kt
#	app/src/main/java/ch/protonmail/android/worker/drafts/CreateDraftWorker.kt

# Conflicts:
#	app/src/main/java/ch/protonmail/android/api/models/factories/SendPreferencesFactory.java
#	app/src/main/java/ch/protonmail/android/api/segments/message/MessageApi.kt
#	app/src/main/java/ch/protonmail/android/api/services/PostMessageServiceFactory.kt
#	app/src/main/java/ch/protonmail/android/attachments/UploadAttachments.kt
#	app/src/main/java/ch/protonmail/android/core/ProtonMailApplication.java
#	app/src/main/java/ch/protonmail/android/jobs/messages/PostMessageJob.java
#	app/src/main/java/ch/protonmail/android/servers/notification/NotificationServer.kt
#	app/src/main/java/ch/protonmail/android/usecase/compose/SaveDraft.kt
#	app/src/main/java/ch/protonmail/android/utils/notifier/AndroidUserNotifier.kt
#	app/src/main/java/ch/protonmail/android/worker/drafts/CreateDraftWorker.kt

# Conflicts:
#	app/src/main/java/ch/protonmail/android/di/ApplicationModule.kt
#	app/src/main/java/ch/protonmail/android/servers/notification/NotificationServer.kt
2021-03-18 10:47:58 +01:00
Davide Farella 57eb24854d Replace imports for import ch.protonmail.android.api.models.room..+;
MAILAND-1189

# Conflicts:
#	app/src/androidTest/java/ch/protonmail/android/api/models/room/ContactGroupsDatabaseTest.kt
#	app/src/main/java/ch/protonmail/android/api/segments/contact/ContactEmailsManager.kt
#	app/src/main/java/ch/protonmail/android/api/segments/event/EventHandler.kt
#	app/src/main/java/ch/protonmail/android/contacts/groups/details/ContactGroupDetailsViewModel.kt
#	app/src/main/java/ch/protonmail/android/contacts/groups/list/ContactGroupsFragment.kt
#	app/src/main/java/ch/protonmail/android/contacts/groups/list/ContactGroupsRepository.kt
#	app/src/main/java/ch/protonmail/android/contacts/groups/list/ContactGroupsViewModel.kt
#	app/src/main/java/ch/protonmail/android/contacts/list/listView/ProtonMailContactsLiveData.kt
#	app/src/main/java/ch/protonmail/android/jobs/UpdateContactJob.java
#	app/src/test/java/ch/protonmail/android/contacts/details/ContactDetailsRepositoryTest.kt
#	app/src/test/java/ch/protonmail/android/contacts/details/ContactGroupsRepositoryTest.kt
#	app/src/test/java/ch/protonmail/android/contacts/groups/ContactGroupsViewModelTest.kt
#	app/src/test/java/ch/protonmail/android/contacts/groups/edit/ContactGroupEditCreateRepositoryTest.kt

# Conflicts:
#	app/src/main/java/ch/protonmail/android/activities/messageDetails/viewmodel/MessageDetailsViewModel.kt
#	app/src/main/java/ch/protonmail/android/api/models/messages/receive/ServerAttachment.kt
#	app/src/main/java/ch/protonmail/android/attachments/DownloadEmbeddedAttachmentsWorker.kt
#	app/src/main/java/ch/protonmail/android/jobs/helper/EmbeddedImage.kt
#	app/src/main/java/ch/protonmail/android/jobs/messages/PostMessageJob.java

# Conflicts:
#	app/src/androidTest/java/ch/protonmail/android/api/models/room/contacts/ContactDaoTest.kt

# Conflicts:
#	app/src/main/java/ch/protonmail/android/api/models/factories/PackageFactory.java
#	app/src/main/java/ch/protonmail/android/api/models/factories/SendPreferencesFactory.java
#	app/src/main/java/ch/protonmail/android/attachments/UploadAttachments.kt
#	app/src/main/java/ch/protonmail/android/compose/ComposeMessageViewModel.kt
#	app/src/main/java/ch/protonmail/android/core/ProtonMailApplication.java
#	app/src/main/java/ch/protonmail/android/jobs/messages/PostMessageJob.java
#	app/src/main/java/ch/protonmail/android/usecase/compose/SaveDraft.kt
#	app/src/test/java/ch/protonmail/android/attachments/UploadAttachmentsTest.kt
#	app/src/test/java/ch/protonmail/android/compose/ComposeMessageViewModelTest.kt
#	app/src/test/java/ch/protonmail/android/usecase/compose/SaveDraftTest.kt

# Conflicts:
#	app/src/main/java/ch/protonmail/android/di/ApplicationModule.kt
#	app/src/main/java/ch/protonmail/android/fcm/FcmIntentService.java
2021-03-18 10:46:25 +01:00
Davide Farella 3268e70b06 Refactor AttachmentMetadataDatabase.kt to use User Id
MAILAND-1186

# Conflicts:
#	app/src/androidTest/java/ch/protonmail/android/api/models/room/attachmentMetadata/AttachmentMetadataDaoTest.kt
#	app/src/main/java/ch/protonmail/android/activities/messageDetails/viewmodel/MessageDetailsViewModel.kt
#	app/src/main/java/ch/protonmail/android/api/models/room/attachmentMetadata/AttachmentMetadataDatabase.kt
#	app/src/main/java/ch/protonmail/android/api/models/room/attachmentMetadata/AttachmentMetadataDatabaseFactory.kt
#	app/src/main/java/ch/protonmail/android/attachments/DownloadEmbeddedAttachmentsWorker.kt
#	app/src/main/java/ch/protonmail/android/data/local/model/AttachmentMetadata.kt
#	app/src/main/java/ch/protonmail/android/data/local/model/AttachmentsMetadataTypeConverter.kt
#	app/src/test/java/ch/protonmail/android/activities/messageDetails/viewmodel/MessageDetailsViewModelTest.kt
2021-03-18 10:44:46 +01:00
Davide Farella bc3a267aef Modify ComposeMessageActivity to use userId instead of username.
Affected: ComposeMessageActivity and related classes

MAILAND-1124

# Conflicts:
#	app/src/main/java/ch/protonmail/android/jobs/CreateAndPostDraftJob.java

# Conflicts:
#	app/src/main/java/ch/protonmail/android/activities/composeMessage/ComposeMessageActivity.java
#	app/src/main/java/ch/protonmail/android/api/services/PostMessageServiceFactory.kt
#	app/src/main/java/ch/protonmail/android/compose/ComposeMessageViewModel.kt
#	app/src/main/java/ch/protonmail/android/jobs/CreateAndPostDraftJob.java

# Conflicts:
#	app/src/main/java/ch/protonmail/android/activities/messageDetails/repository/MessageDetailsRepository.kt
#	app/src/main/java/ch/protonmail/android/activities/messageDetails/viewmodel/MessageDetailsViewModel.kt
#	app/src/main/java/ch/protonmail/android/attachments/DownloadEmbeddedAttachmentsWorker.kt

# Conflicts:
#	app/src/main/java/ch/protonmail/android/api/services/PostMessageServiceFactory.kt
2021-03-18 10:39:04 +01:00
Tomasz Giszczak cc622b6615 Reformatted code and added some logs around keys.
MAILAND-1105
2021-03-16 12:36:54 +00:00
Zorica Stojchevska b3bd60ac65 Fixes an issue where if message is received on secondary user it would also get saved in the wrong database.
MAILAND-1223

#comment Affected: Opening a message from notification for a secondary account..
2021-02-15 11:53:47 +00:00
Tomasz Giszczak 311450c124 Fixed handling of delted attachments files for API>=29.
MAILAND-1337
2021-02-11 09:49:40 +01:00
Tomasz Giszczak 10e2a7ffb2 DownloadEmbeddedAttachmentsWorkerTest added.
MAILAND-1337
2021-02-10 11:56:21 +01:00
Tomasz Giszczak 2abf71927a Fixed a problem with one embedded attachment not being downloaded preventing it from being displayed.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak 2688bc1cb4 Moved getAttachmentData method to AttachmentsRepository. Other minor refactoring.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak bd72bf380c Updated AttachmentsHelperTest.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak b7a02081e5 Small refactoring in the attachments handling, saving files.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak 10e72ee6b1 Explicitly copy embeded attachment to downloads before displaying for API>=29.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak b94d4f3f44 Explicitly copy embeded attachment to downloads before displaying for API<29.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak df916afeeb Converted DownloadUtils to a normal kotlin class, removed static methods.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak 728bc386da Added Uri to AttachmentMetadata stored in the DB.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak 15612f4bbb Some reformatting in MessageDetailsViewModel, Attachment, Message and AttachmentApi.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak 6c6d98de4b Extracted embedded attachments downloads to HandleEmbeddedImageAttachments.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak 5c2ba6dee8 Defined some methods in MessagesDatabase and MessageDetailsRepository as suspended.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak 6df695a9a9 Extracted EmbedeedImage mapper to AttachmentsHelper.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Tomasz Giszczak 86a5db059c Extracted DownloadEmbeddedAttachmentsWorker Enquirer and declared it as dependency.
MAILAND-1337
2021-02-09 16:42:51 +01:00
Marino Meneghel 5380a01bc1 Cleanup - Methods renaming and removing unused code
- Removed messageDraftResult LiveData as not used anymore
- Removed setOfflineDraftSaved as value was set but never read
- Rename findMessageByIdBlocking method to change non-blocking method to
  using dispatcher from constructor
2021-01-15 16:12:24 +01:00
Tomasz Giszczak 1a58411ad1 Removed redundant nonBrokenEmail from MessageDetailsViewModel.
MAILAND-1294
2021-01-04 09:41:55 +00:00
Tomasz Giszczak 821b65be1b Moved some decrypted message HTML parsing logic to MessageDetailsViewModel.
MAILAND-1294
2021-01-04 09:41:55 +00:00
Tomasz Giszczak 6169aff334 Revert "Wrapped FetchVerificationKeys invokation parameter into EmailAddress object."
This reverts commit f9763f23eb.
2020-12-28 17:29:53 +01:00
Tomasz Giszczak f9763f23eb Wrapped FetchVerificationKeys invokation parameter into EmailAddress object.
MAILAND-1037
2020-12-03 16:15:38 +00:00
Tomasz Giszczak 7f7ba9ed8a Small refactor in MessageDetailsViewModel.
MAILAND-1037
2020-12-03 16:15:38 +00:00
Tomasz Giszczak 1f882257fb Added DispatcherProvider dependency to MessageDetailsViewModel.
MAILAND-1037
2020-12-03 16:15:38 +00:00
Tomasz Giszczak dbbb068b62 Removed unused FetchMessageDetailsEvent handling from MessageDetailsViewModel.
MAILAND-1037
2020-12-03 16:15:38 +00:00
Tomasz Giszczak aa458244bb FetchVerificationKeys use case added, FetchVerificationKeysJob removed.
MAILAND-1037
2020-12-03 16:15:38 +00:00
Tomasz Giszczak 893496e1ba Fix for already downloaded message details not being shown in offline mode.
MAILAND-1163
2020-11-25 13:39:43 +01:00
Tomasz Giszczak 418429d78e Revert primary base activity context change in MessageDetailsActivity to prevent print manager crash.
MAILAND-1122
2020-11-12 14:52:30 +01:00
Dimitar Solev fddd310cb6 Fix auto downloading of remote images when printing according to the user settings.
Affected: Printing of messages

Ticket: MAILAND-977
2020-11-05 14:10:18 +01:00
Tomasz Giszczak 7d62cc7d66 Moved most of connectivity check required view models to inherit from ConnectivityBaseViewModel.
MAILAND-999
2020-11-04 14:08:12 +01:00
Tomasz Giszczak 553fe33cd6 Linked verify connection with Settings Activities.
MAILAND-999
2020-11-04 14:08:12 +01:00
Tomasz Giszczak 62be28b959 Renamed send ping use case as VerifyConnection
MAILAND-999
2020-11-04 14:08:12 +01:00
Tomasz Giszczak f2fc668f59 Renamed laucnhPing with checkConnectivity in mailbox and mailbox details.
MAILAND-999
2020-11-04 14:08:12 +01:00
Tomasz Giszczak 0237f6764f Removed ping from BaseConnectivityActivity.
MAILAND-999
2020-11-04 14:08:11 +01:00
Tomasz Giszczak 5a365e96f7 Improved ping and connectivity checking on MessageDetailsActivity.
MAILAND-999
2020-11-04 14:08:11 +01:00
Tomasz Giszczak c451105098 Inject MessageDetailsViewModel with hilt instead of custom factory.
MAILAND-999
2020-11-04 14:08:11 +01:00
Tomasz Giszczak 3147c3c383 Updated Ping refernces in MessageDetailsActivity & MessageDetailsViewModel.
MAILAND-999
2020-11-04 14:08:11 +01:00
Tomasz Giszczak 72a552e943 Reformatted BaseConnectivityActivity, MessageDetailsActivity and MessageDetailsViewModel.
MAILAND-999
2020-11-04 14:08:11 +01:00
Tomasz Giszczak 2e14fcec56 Moved DeleteMessage to a dedicated package and added ensureActive to the coroutine running in it.
MAILAND-953
2020-10-15 13:25:58 +02:00
Tomasz Giszczak fc0f01903c Call DeleteMessages use case with invoke.
MAILAND-953
2020-10-15 13:25:58 +02:00
Tomasz Giszczak dd4db7f0bf Removed DeleteMessageDbWorker and replaced it with DeleteMessageInteractor.
Simplified a bit delete message flow as delete from DB operation does not need to be carried by a worker.

MAILAND-953
2020-10-15 13:25:58 +02:00
Tomasz Giszczak def2be8095 Moved WorkManager dependency from MessageDetailsActivity to MessageDetailsViewModel.
MAILAND-953
2020-10-15 13:25:58 +02:00
Davide Farella 04cf9199e3 Setup all the classes for enabled automatic Injection generation
* Replaced member injection with constructor injection
* Setup aimed to let Dagger/Hilt generate dependency graph automatically, where possible
Affected: Dagger dependencies

MAILAND-930
2020-09-22 13:56:55 +02:00
stefanija fb726d9772 Show error messages when trying to open a message
#comment If the API returns an error response, don't retry to fetch the message, just show a toast with the error. The retrying of the fetching should happen only when an exception is thrown.
Affected: Trying to open a message

MAILAND-730
2020-07-20 11:31:46 +00:00
Zorica Stojchevska 5ce164d00a Initial commit 2020-04-16 17:44:53 +02:00