-
Notifications
You must be signed in to change notification settings - Fork 1
Cws 1256 reset app timer #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
|
@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", |
There was a problem hiding this comment.
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!
lib/OnUserTypingHandler.ts
Outdated
| let allowTimeoutReset = true; | ||
|
|
||
| let userStoppedTypingTimeout: NodeJS.Timeout | null = null; |
There was a problem hiding this comment.
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.
This PR adds logic to the OnRoomUserTypingHandler class to accomplish the following:
When user typing handler is called:
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
executeOnRoomUserTypinghandler must now be provided a modifier as one of the arguments: WideChat/Rocket.Chat.Apps-engine#54This PR relies on the IRoomUserTyping type definition changes included in the Apps-Engine PR