zulip-terminal icon indicating copy to clipboard operation
zulip-terminal copied to clipboard

Typing Indicator Animation

Open Rohitth007 opened this issue 4 years ago • 15 comments

This commit animates the typing feedback using an iterable cycle object. This is done using an asynchronous function _show_typing_animation and a boolean is_recipient_typing to start and end the animation.

The corner case of not recieving a stop signal is handled by setting TYPING_STARTED_EXPIRY_PERIOD=15 and checking this condition using datetime.

This has to be handled differently from #915 as footer keep updating every half second so, footer text's duration variable can't be used.

Tests added.

animate_typing

Rohitth007 avatar Apr 09 '21 16:04 Rohitth007

@preetmishra Yes, I am aware of the things specified that I have not added yet. This is just a functional prototype and since it's small enough to understand, I was planning to write a proper commit structure after making those changes. I am in between my exams right now hence the not so perfect PR. Hope you understand :)

Rohitth007 avatar Apr 10 '21 05:04 Rohitth007

@Rohitth007 No worries. Best of luck with the exams!

preetmishra avatar Apr 10 '21 16:04 preetmishra

@preetmishra PR updated for review

Rohitth007 avatar Apr 11 '21 18:04 Rohitth007

@preetmishra I have made a few more changes to handle corner cases better. Even the tests work better now. (I have moved time forward instead of reducing it) It all works but PEP8 tells me that there is a trailing whitespace error on a line I haven't even touched. I even tried using VSCode's Trim Trailing Whitespace command. zulipterminal/model.py:960:68: W291 trailing whitespace

Rohitth007 avatar Apr 19 '21 13:04 Rohitth007

@zulipbot add "PR needs review" @zulipbot remove "PR awaiting update"

Rohitth007 avatar Apr 19 '21 13:04 Rohitth007

It all works but PEP8 tells me that there is a trailing whitespace error on a line I haven't even touched.

You did change that line. You can take a look at the Files changed tab of this PR and notice that line 960 is changed. You may be in a subsequent commit while running the linter and thought that you didn't change that line. :sweat_smile: (That's why it's important to run tests for each commit so that you find your mistakes in that commit itself.)

PRO-TIP: git blame can prove really helpful in finding out who changed a particular line in a repository.

zee-bit avatar Apr 19 '21 14:04 zee-bit

@zee-bit Oh wait I was checking in a different file :sweat_smile: , I mistook model.py for test_model.py cause that was the only file I was editing at that time. :facepalm: Yes, I use something similar to git blame :+1:

Rohitth007 avatar Apr 19 '21 15:04 Rohitth007

@preetmishra This is ready for another review.

Rohitth007 avatar Jun 19 '21 15:06 Rohitth007

@preetmishra This is ready for another review. I have made all the suggested changes except the datetime refactor for test_ui_tools. Hopefully the rest of it is looking good?

Rohitth007 avatar Jun 22 '21 08:06 Rohitth007

@preetmishra I have updated the PR with all the suggestions. Hopefully this is now complete.

Rohitth007 avatar Jun 27 '21 13:06 Rohitth007

@neiljp Thanks for the review. To address some of your points:

  • Yes this also happens to resolve the same edge case as @prah23's #915 , where the basic idea was borrowed from, as it had to be handled differently as this is asynchronous.
  • Moving this whole function into controller makes sense and would simplify work on typing notifications features later.
  • The full recipient was not needed, it was used it the same way before hence I kept it. Maybe just sending the name is better.

Rohitth007 avatar Jul 05 '21 14:07 Rohitth007

I have updated this PR as per suggestions and also have improved the tests.

Rohitth007 avatar Jul 08 '21 07:07 Rohitth007

Updated the PR as per discussions in CZO

Rohitth007 avatar Jul 08 '21 15:07 Rohitth007

@Rohitth007 Thanks for working on this different architecture - the first two commits of this are now merged :tada: (since the tests seem OK that far through)

I split the first commit to make it smaller and easier to read.

neiljp avatar Aug 15 '21 06:08 neiljp

Heads up @Rohitth007, we just merged some commits that conflict with the changes you made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.

zulipbot avatar Feb 24 '23 21:02 zulipbot