Skip to content

ability to send encrypted attachments#505

Merged
tomholub merged 11 commits intomasterfrom
feature/issue-196-ability-to-send-attachment
Sep 27, 2021
Merged

ability to send encrypted attachments#505
tomholub merged 11 commits intomasterfrom
feature/issue-196-ability-to-send-attachment

Conversation

@ekievsky
Copy link
Contributor

@ekievsky ekievsky commented Sep 17, 2021

This PR adds the ability to send encrypted attachments

close #196


Tests (delete all except exactly one):

  • Tests will be added later

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • is documented clearly and usefully, or doesn't need documentation

@ekievsky ekievsky marked this pull request as draft September 17, 2021 17:12
@tomholub tomholub changed the title Added ability to size textview to its content ability to send encrypted attachments Sep 20, 2021
ykyivskyi-gd and others added 3 commits September 24, 2021 13:58
…ny file from Files app)t;

Making Core.composeMail api call in background not to block UI for spinner;
Refactored from Promises to Combine;
@ekievsky ekievsky marked this pull request as ready for review September 24, 2021 11:03
ykyivskyi-gd added 2 commits September 24, 2021 14:12
….com:FlowCrypt/flowcrypt-ios into feature/issue-196-ability-to-send-attachment
Copy link
Collaborator

@tomholub tomholub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminarly this is is - In particular the encryption/sending looks correct. Adding some comments.

case .text: return self.textNode(with: nodeHeight)
case .subjectDivider: return DividerCellNode()
}
case (.main, 2):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the whole tableNode should be in some sort of decorator class? It looks very UI-heavy with not much business logic. What do you think @Kharchevskyi ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, then that would apply to the whole extension ComposeViewController: ASTableDelegate, ASTableDataSource { section

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we may create DataSource entity for this screen, @Kharchevskyi let's discuss that when it's convenient

let type: String
}

extension ComposeMessageAttachment {
Copy link
Collaborator

@tomholub tomholub Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm misunderstanding this whole class, but is it really necessary to handle it with different methods type by type? There may be many different file types. I know you mentioned something about using a "simpler method for file picking" so I suppose maybe this is the side effect of that.

In the future, will we will have to handle file types individually like this?

As an example, on browser extension, the browser picks up a file and it doesn't care what type of file it is. The name, data, and mime type string is all it cares.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that ImagePickerDelegate returns different dictionaries with data. E.g. a photo taken from camera doesn't have a name, path and asset but photo that taken from library has all those fields.

@tomholub tomholub marked this pull request as draft September 24, 2021 11:41
@tomholub
Copy link
Collaborator

Converting to draft while this is being discussed & until adjustments done.

Otherwise this is ready for me to start testing I suppose?

@ekievsky
Copy link
Contributor Author

ekievsky commented Sep 24, 2021

yes, you may test it, I will answer on comments asap and apply fixes tomorrow. Thanks!

Copy link
Collaborator

@tomholub tomholub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done as far as user test - I was able to send other types of files (video in my case). The sent file worked, I'm able to read it on the other end (browser extension).

There are a few things we'll later have to improve in the future, other than what I've mentioned above. All of these 4 are for followup issues for the future, since at this stage we're just focusing on the basics.

  1. if it's a bigger file, it takes a while: there should be a progress bar. We've done something similar on Android. The first 30% of the progress bar are taken up by encryption (which we have no way to track progress of) and the last 70% is upload of the message to Gmail servers, which you should be able to track progress of.
  2. on dark theme, the attachment names are barely readable (also when receiving)
  3. the .pgp filename should not be visible in that list. So you don't have to alter the filename, after all (the encryption method should be already transparently renaming them)
  4. later I should have a way to remove attachment from compose screen if I changed my mind before sending

That's functionality-wise. I cannot comment too much on code, maybe @sosnovsky do you want to have a look?

@ekievsky ekievsky marked this pull request as ready for review September 26, 2021 10:24

private func appendAttachmentIfAllowed(_ attachment: ComposeMessageAttachment) {
let totalSize = contextToSend.attachments.reduce(0, { $0 + $1.size })
if totalSize > GeneralConstants.Global.attachmentSizeLimit {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be totalSize + attachment.size > GeneralConstants.Global.attachmentSizeLimit ?

@sosnovsky
Copy link
Collaborator

That's functionality-wise. I cannot comment too much on code, maybe @sosnovsky do you want to have a look?

I checked code - looks great, it helped me to better understand app structure 👍
But I noticed small bug when adding multiple attachments, created issue for it #547

@tomholub tomholub merged commit c9788ca into master Sep 27, 2021
@tomholub tomholub deleted the feature/issue-196-ability-to-send-attachment branch September 27, 2021 12:00
@tomholub
Copy link
Collaborator

Since remaining improvements are filed as separate issues, I've merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ability to send encrypted attachments

4 participants