Skip to content

save drafts during compose or reply - #690

Merged
tomholub merged 8 commits into
masterfrom
feature/issue-514
Oct 28, 2021
Merged

save drafts during compose or reply#690
tomholub merged 8 commits into
masterfrom
feature/issue-514

Conversation

@ekievsky

@ekievskyekievsky commented Oct 17, 2021

Copy link
Copy Markdown
Contributor

This PR is adding feature that saves draft encrypted mail during compose new mail or reply

close#514


Tests(delete all except exactly one):

  • Difficult to test (explain why). there was not tests to this modules ( gmail service etc ). if we need to cover it with tests I would prefer it as separate issue.

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

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Didn't run it yet - comments below.


private var state: State = .main

private weak var timer: Timer?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's call it saveDraftTimer

}
}

private func resolveQueryForDraftAction(raw: String, threadId: String?, draft: GTLRGmail_Draft?) -> GTLRGmailQuery {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be called createQueryForDraftAction ?

@tomholub

Copy link
Copy Markdown
Collaborator
Difficult to test (explain why). there was not tests to this modules ( gmail service etc ). if we need to cover it with tests I would prefer it as separate issue.

This should be covered by ui tests, I'll file an issue.

@tomholub

tomholub commented Oct 17, 2021

Copy link
Copy Markdown
Collaborator

Need to make sure that:

  • the draft is deleted after the message is sent, so unneeded drafts don't accumulate
  • I can go to drafts folder, open a draft and be able to continue editing it

I'll mark the PR as a draft until then. Thanks.

@tomholub
tomholub marked this pull request as draft October 17, 2021 19:53
@ekievsky

Copy link
Copy Markdown
ContributorAuthor

@tomholub I thought that it will be separate task.

I will continue working on this feature then, thank you

@tomholub

Copy link
Copy Markdown
Collaborator

We're getting close to start releasing early versions to customer, so we can no longer merge PRs that cause degradations (eg creating drafts that don't also get cleared) - degradation need to be addressed in the same PR going forward.

That's also the reason I couldn't merge half-finished #657

On the other hand, when new functionality is unfinished in a way that doesn't degrade the app, that may be ok to merge.

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

I understand. I will focus on this both tasks to finish them as soon as possible.
Thank you for bringing clarity.

@ekievsky
ekievskyforce-pushed the feature/issue-514 branch 2 times, most recently from b16618e to 86b3548CompareOctober 20, 2021 18:19
@ekievsky

Copy link
Copy Markdown
ContributorAuthor

Still working on current issue.
There are a lot of things that should be changed/fixed, so it will take more time:

  • change inbox to fetch drafts instead of messages
  • open and fill compose controller with message/draft
  • getting drafts recipients and other properties
    etc

@tomholub

Copy link
Copy Markdown
Collaborator

Understood. It's not a small issue. Actually, I think this could be in a separate PR after all:

change inbox to fetch drafts instead of messages
open and fill compose controller with message/draft
getting drafts recipients and other properties

As long as drafts are not getting created and then left undeleted after the message is sent.

(just thought that the user could theoretically finish their draft on the desktop, so it's not useless - please test that scenario)

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

@tomholub I have done following:

  • all described in issue
  • drafts are saving and deleting if user sent an email
  • inbox view controller now supports fetching drafts for drafts folder instead of fetching messages list ( there is difference with draft_id that is needed )

not finished ( can be scoped as another task )

  • partially done: opening compose view controller from drafts list.
    it is necessary to make it fully working as feature.

there are some things that I should finish, but if we can, I would like to make it right after this PR is merged as a separate task

PS: now I am getting weird crash after "encryptAndSend", I am trying to figure out if my changes caused that or it is known master branch issue. it is only thing that is blocking me of moving this PR from draft status to open.

@tomholub

Copy link
Copy Markdown
Collaborator

Sounds good, I'll start reviewing. Thanks!

@tomholub

Copy link
Copy Markdown
Collaborator

PS: now I am getting weird crash after "encryptAndSend", I am trying to figure out if my changes caused that or it is known master branch issue. it is only thing that is blocking me of moving this PR from draft status to open.

Now after #773 the sending has changed a lot, you should pull the changes from master and see if by any chance the crash is resolved. If not, then you'll have to investigate further.

@ekievsky
ekievskyforce-pushed the feature/issue-514 branch 2 times, most recently from cea9282 to a1726c4CompareOctober 26, 2021 18:11
@ekievsky

Copy link
Copy Markdown
ContributorAuthor

@tomholub crash is fixed, please review.

@tomholub

Copy link
Copy Markdown
Collaborator

I'll review functionality, but have a look at the tests - I can't merge until the tests are fixed.

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

@tomholub there is the issue with target architecture, will be resolving this issue
Screenshot 2021-10-27 at 00 35 15
.

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code looks good. Haven't tested

}
}

func getFraft(with identifier: String) async throws -> GTLRGmail_Draft {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Typo

@tomholub

Copy link
Copy Markdown
Collaborator

@tomholub there is the issue with target architecture, will be resolving this issue Screenshot 2021-10-27 at 00 35 15 .

First make sure to log in under new account #755

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

@tomholub didn't work for me.
also - I am facing the same problem on master branch.

@sosnovsky do you have this problem, can you check please?
also - if not, can you share your Xcode version?

@sosnovsky

Copy link
Copy Markdown
Collaborator

@ekievsky tests run well for me after changing Build Configuration to Debug (instead of Release). You can change it by going to Product -> Scheme -> Edit Scheme... menu in Xcode. I'm using the latest 13.1 version

Screenshot 2021-10-27 at 23 29 41

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

oh. @sosnovsky
I believe I worked with realease one all the way.
was debug added recently?

also, I am wondering, about Xcode version. It looks like you are always updating to latest one, I think we should commit some specific one and work with it. and migrate to new one together, when we need it.

what do you think about it?

@sosnovsky

Copy link
Copy Markdown
Collaborator

@ekievsky I think Xcode version doesn't affect running tests, as it doesn't change our project code, this configuration can be changed on any Xcode version.
Also Semaphore is using the latest Xcode version too and unit tests pass there without any issues.

@tomholub

Copy link
Copy Markdown
Collaborator

I also support generally updating to latest xcode except if we run into a particular issue that can be traced to some particular new version of xcode. Then we'll let everybody know that some other version is recommended for the time being. But normally, let's all update - it doesn't seem to break stuff.

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

@sosnovsky I am not saying that tests failure are connected to Xcode version. its 2 separate points in my message, but thank you for that tips.

I just had not very pleasant experience when developers in big team having different Xcode version, that's why my proposal was to commit some specific version in general.
if you both with @tomholub thinks that you want always update to latest version, let it be.

@sosnovsky

Copy link
Copy Markdown
Collaborator

@ekievsky yeah, I got some issues with different Xcode versions too. But it happened in projects which used storyboards for UI, as some Xcodes make unnecessary code updates even when you just open storyboard file, without changing anything. This lead to some merge conflicts.
But as we're not using storyboards in Flowcrypt there shouldn't be any issues between different Xcode versions.
Just let me know if you'll notice any problems with some specific Xcode version.

@tomholub

Copy link
Copy Markdown
Collaborator

I also heard of problems between xcode versions before, and good to know that they may have been related to storyboards. Hopefully that could mean we won't run into any for a while 👍

@tomholub

Copy link
Copy Markdown
Collaborator

@ekievsky is the PR ready to potentially merge from your point of view? If yes please mark it as ready.

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

code good

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As implemented, it makes it impossible to type - every other second the phone gets stuck and I can't continue typing for a few hundred ms.

What is it getting stuck on? Seems like some work being done on main thread that should not be done there.

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

hmm, I am not getting this kind of problem @tomholub
is it happened when you just typing email?

@ekievsky
ekievsky marked this pull request as ready for review October 28, 2021 17:55
@tomholub

Copy link
Copy Markdown
Collaborator

hmm, I am not getting this kind of problem @tomholub is it happened when you just typing email?

Yes, I'm just typing the message and the keyboard keeps getting frozen for a bit here and there after every few key presses, making it nearly unusable. It's on a 12mini, iOS 15.0.2, Debug FlowCrypt installed directly from Xcode.

@tomholub

Copy link
Copy Markdown
Collaborator

@ivan-ushakov could you see if you can reproduce my issue on this PR?

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

@tomholub issue is fixed, it was issue of thread as you mentioned above.
please take a look

@ekievsky

Copy link
Copy Markdown
ContributorAuthor

@tomholub I am fixing conflicts, but it should not block you to try latest commit

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

code change looks good. will test

@tomholubtomholub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This fixed it, thanks!

@tomholub
tomholub merged commit 5830bb3 into masterOct 28, 2021
@tomholub
tomholub deleted the feature/issue-514 branch October 28, 2021 21:19
Sign up for freeto 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.

save drafts during compose or reply

3 participants

@ekievsky@tomholub@sosnovsky