Commit Graph

28 Commits (d219e989ac3f4addaa68e922de5026548bbd64bb)

Author SHA1 Message Date
David Baker 374be0b3b4 Rename more things 2019-03-12 10:28:47 +00:00
David Baker 08e21ff5d4 Fix comment 2019-03-12 09:40:17 +00:00
David Baker 63d19a899b Rest of the naming changes 2019-03-12 09:37:00 +00:00
David Baker ce9f3d8a57 Rename 2019-03-11 11:38:54 +00:00
David Baker 999ebe6a19 Missed the removes
also fix more indenting
2019-03-08 21:51:14 +00:00
David Baker b404d21bba PR feedback 2019-03-08 17:41:04 +00:00
David Baker ce1623691e Fix instantly sending RRs
Splits UserActivity into a tristate of 'active' (last < 1s), 'passive' (lasts a
couple of mins) and neither. Read receipts are sent when 'active', read markers
are sent while 'passive'.

Also fixed a document / window mix-up on the 'blur' handler.

Also adds a unit test for UserActivity because it's quite complex now
(and changes UserActivity to make it testable by accessing the singleton
via sharedInstance() rather than exporting it directly).

Fixes https://github.com/vector-im/riot-web/issues/9023
2019-03-08 12:46:38 +00:00
David Baker de1ec06110 oops, didn't mean to leave this in 2019-03-08 10:44:48 +00:00
David Baker 89eb321ace copyright 2019-03-08 10:31:30 +00:00
David Baker 1cb6c3f3cf Fix erroneously sending RRs, pt1.
Firefox fires the blur event on both document and window. Chrome
only fires it on window, so on chrome we were not seeing the window
being un-focused. window seems to be the standard so just use that.

This isn't the end of the story though since wer can get mousemove
events without the window ever having gained focus, in which case
we'll continue to think the user is active for another 2 mins when
in fact all they did was pass their cursor over the window.

https://github.com/vector-im/riot-web/issues/9023
2019-03-08 10:23:18 +00:00
Bruno Windels 56726ba8e5 fix lint 2019-01-08 12:10:42 +01:00
Bruno Windels 408eba7915 Fix: Presence only comes online when UserActivity interrupted activity 2018-12-11 16:25:48 +01:00
Bruno Windels 6a248c2e72 Timer in UserActivity, change semantics to "user probably looks at app"
Before, UserActivitity emitting actions meant that the user had very recently interaction with their hardware.
Now it means they are likely looking at the app.

You can attach a timer that is aborted when we think the user
stops looking at the page
(or hasn't touched their hardware for 2 minutes).

This works better than the previous approach for larger timeouts,
like the 30s we're about to implement for out-of-view RMs
2018-12-11 15:45:11 +01:00
Aaron Raimist 49ce4ef117
eslint --fix src/
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2018-10-26 22:50:38 -05:00
Michael Telatynski 661a0f3956
de-lint Resend, RoomListSorter, UserActivity
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-01 14:50:22 +01:00
Luke Barnard 8291b36b3e Use document.onkeydown instead of onkeypress 2017-04-27 10:16:24 +01:00
Matthew Hodgson c2f2fb3816 use passive event listener for mousewheel 2016-09-07 22:54:37 +01:00
Richard van der Hoff 2ac88a3d89 Make the read-marker less annoying
We considered the user active if there had been a user_activity event within
the last 500ms, but those events were only raised every 500ms, so it was
possible that we would be considered inactive immediately. Use
UserActivity.userCurrentlyActive() instead, which fixes this.

Also increase CURRENTLY_ACTIVE_THRESHOLD_MS to 2 seconds.
2016-03-22 12:15:17 +00:00
Richard van der Hoff 3e8cb47abe Consider mouse-clicking as user activity
It's a bit non-sensical that moving the mouse constitutes user activity, but
clicking it does not. Fix it.
2016-02-12 10:19:45 +00:00
David Baker 740c22238e Better date syntax 2016-01-14 16:15:07 +00:00
David Baker 4f21e2beb3 Suffix with units 2016-01-14 16:13:50 +00:00
David Baker 7e5d4b8ce8 Send an event at the end of user activity too and use this to send RRs. 2016-01-14 16:01:31 +00:00
David Baker 581111e1a7 Use wheel, not scroll as we get scroll events from auto scroll down. Also only do the cursor move check for mouse move events. 2016-01-09 00:06:54 +00:00
David Baker 1c4d1d2507 Make scrolling count as user activity. 2016-01-08 22:19:31 +00:00
Matthew Hodgson 0772f50fab update copyright for 2016 2016-01-07 04:06:52 +00:00
Matthew Hodgson ba090a6ad5 only dispatch user_activity event if the mouse actually moves (rather than the DOM moving under the mouse) 2015-11-29 15:39:10 +00:00
David Baker 31b083d93e new Date() syntax & units on var name 2015-11-18 14:51:06 +00:00
David Baker a850f19cd4 Separate out the activity watcher from presence code so I can hook read receipts into it without tangling it into the presence code. 2015-10-26 13:54:54 +00:00