-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:RocketChat/Rocket.Chat into flow-…
…router # Conflicts: # client/views/app/room.coffee
- Loading branch information
Showing
19 changed files
with
178 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@MsgTyping = do -> | ||
stream = new Meteor.Stream 'typing' | ||
timeout = 15000 | ||
timeouts = {} | ||
renew = true | ||
renewTimeout = 10000 | ||
selfTyping = new ReactiveVar false | ||
usersTyping = {} | ||
|
||
addStream = (room) -> | ||
unless usersTyping[room]? | ||
usersTyping[room] = { users: new ReactiveVar {} } | ||
stream.on room, (typing) -> | ||
unless typing.username is Meteor.user()?.username | ||
if typing.start | ||
users = usersTyping[room].users.get() | ||
users[typing.username] = Meteor.setTimeout -> | ||
delete users[typing.username] | ||
usersTyping[room].users.set users | ||
, timeout | ||
usersTyping[room].users.set users | ||
else if typing.stop | ||
users = usersTyping[room].users.get() | ||
delete users[typing.username] | ||
usersTyping[room].users.set users | ||
|
||
Tracker.autorun -> | ||
addStream Session.get 'openedRoom' | ||
|
||
start = (room) -> | ||
return unless renew | ||
|
||
setTimeout -> | ||
renew = true | ||
, renewTimeout | ||
|
||
renew = false | ||
selfTyping.set true | ||
stream.emit 'typing', { room: room, username: Meteor.user().username, start: true } | ||
clearTimeout timeouts[room] | ||
timeouts[room] = Meteor.setTimeout -> | ||
stop(room) | ||
, timeout | ||
|
||
stop = (room) -> | ||
renew = true | ||
selfTyping.set false | ||
if timeouts?[room]? | ||
clearTimeout(timeouts[room]) | ||
timeouts[room] = null | ||
stream.emit 'typing', { room: room, username: Meteor.user().username, stop: true } | ||
|
||
get = (room) -> | ||
users = usersTyping[room].users.get() | ||
return _.keys(users) or [] | ||
|
||
return { | ||
start: start | ||
stop: stop | ||
get: get | ||
selfTyping: selfTyping | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Meteor.startup -> | ||
if Meteor.isCordova | ||
StatusBar.hide() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.