Skip to content

Conversation

@csmith14
Copy link
Collaborator

@csmith14 csmith14 commented Sep 1, 2022

This PR adds logic to the OnRoomUserTypingHandler class to accomplish the following:

When user typing handler is called:

  • Reset app timeout
  • Use setTimeout to create a 10-second Node timer during which the app timeout will not be reset

This means that when the user first starts typing, the app timer be reset immediately. If the user typing handler is called within 10 seconds of that initial handler call, the app timer will not be reset. Once the user has stopped typing for at least 10 seconds, if they begin typing again the app timer will be reset and the process repeats.

Please see related PR in apps-engine, as the executeOnRoomUserTyping handler must now be provided a modifier as one of the arguments: WideChat/Rocket.Chat.Apps-engine#54

This PR relies on the IRoomUserTyping type definition changes included in the Apps-Engine PR

Copy link
Collaborator

@AlexanderKanakis AlexanderKanakis left a comment

Choose a reason for hiding this comment

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

Looks good.

@ear-dev
Copy link

ear-dev commented Sep 2, 2022

@csmith14 I'll test it out. Can you take a look at the build failures? Thanks.
@bhardwajaditya if you could also review I would appreciate it.

@AlexanderKanakis
Copy link
Collaborator

@csmith14 I'll test it out. Can you take a look at the build failures? Thanks.

They are fixed with the Apps-engine PR mentioned in the description, I missed it too.

@ear-dev
Copy link

ear-dev commented Sep 2, 2022

@csmith14 I'll test it out. Can you take a look at the build failures? Thanks.

They are fixed with the Apps-engine PR mentioned in the description, I missed it too.

OK, lets do this for now please.... can you edit package.json in this PR to use your feature branch of apps-engine? Then we'll test it all out before merging. Thanks.

app.json Outdated
"commitHash": "29fb3e0d0ff0e996e4770fd1d7a44f4cfb65d938"
"id": "0d3ac5b3-dd0b-43d3-924a-5a7433902589",
"version": "1.0.0",
"requiredApiVersion": "WideChat/Rocket.Chat.Apps-engine.git#9a89addfacd4600f4e49d8dc7ce96a0ef88669ea",
Copy link

Choose a reason for hiding this comment

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

good catch! Assuming this passes..... let's just remember to revert before we eventually merge. Thanks!

Comment on lines 12 to 14
let allowTimeoutReset = true;

let userStoppedTypingTimeout: NodeJS.Timeout | null = null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@csmith14 Were you able to test these changes?

As far as I know, setTimeout does not work in the RC Apps.

And also using allowTimeoutReset, and userStoppedTypingTimeout as a condition won't work here because in the real world this function will be called for multiple chat/user. So callback for one chat will override the flag for other chats.

@csmith14 csmith14 closed this Sep 26, 2022
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.

4 participants