-
Notifications
You must be signed in to change notification settings - Fork 11
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
add realtime typing #493
base: develop
Are you sure you want to change the base?
add realtime typing #493
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, few minor comments and suggestions
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.
Consider creating separate real time group for every chat, this group is responsible for "is typing ..." notification.
@@ -545,6 +588,22 @@ export class ChatsComponent implements OnInit { | |||
} | |||
} | |||
|
|||
onTypingHandler(event: KeyboardEvent) { |
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.
Bind this handler to message text input value changed, see example https://github.com/MangoInstantMessenger/MangoMessengerAPI/blob/develop/MangoAPI.Client/src/app/components/contacts/contacts.component.html#L38
const userData = this._tokensService.getTokens(); | ||
if (!userData) return; | ||
|
||
if (event.key.match(/^[a-zA-Zа-яА-ЯёЁ0-9+\-[\]{}(),./'"]$/) || event.key === 'Backspace') { |
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.
this if (event.key.match(/^[a-zA-Zа-яА-ЯёЁ0-9+\-[\]{}(),./'"]$/) || event.key === 'Backspace')
is redundant if we handle text input value changed event
@@ -545,6 +588,22 @@ export class ChatsComponent implements OnInit { | |||
} | |||
} | |||
|
|||
onTypingHandler(event: KeyboardEvent) { | |||
const userData = this._tokensService.getTokens(); | |||
if (!userData) return; |
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.
Please throw some exception here so we know that tokens are null or empty
Implements #491