Added framework for audio notification when public/private messages are received
This commit is contained in:
parent
b0e8bb7900
commit
324e100d32
@ -56,6 +56,7 @@
|
||||
private var scrollTimer:Timer;
|
||||
private var scrollBarWorkaround:Boolean = false;
|
||||
private var currentMessage:int;
|
||||
private var latestMessage:int;
|
||||
//private var chatHistorySpacer:Boolean = false;
|
||||
|
||||
private var reachedLatest:String = "You have reached the latest message. ";
|
||||
@ -77,6 +78,7 @@
|
||||
|
||||
// Initialize the indicator for the position in the message history, and add the listener for message history navigation
|
||||
currentMessage = 0;
|
||||
latestMessage = 0;
|
||||
this.addEventListener(KeyboardEvent.KEY_DOWN, navigateMessages);
|
||||
// Initialize the chatMessagesList tooltip as the Welcome message
|
||||
chatMessagesList.accessibilityProperties.description = messages[0].toString();
|
||||
@ -231,6 +233,14 @@
|
||||
return chatHistorySpacer;
|
||||
}
|
||||
|
||||
public function getLatestMessage():int{
|
||||
return latestMessage;
|
||||
}
|
||||
|
||||
public function getCurrentMessage():int{
|
||||
return currentMessage;
|
||||
}
|
||||
|
||||
public function navigateMessages(e:KeyboardEvent) :void{
|
||||
var navToFirst:Boolean = false;
|
||||
var navToLatest:Boolean = false;
|
||||
@ -278,6 +288,12 @@
|
||||
Accessibility.updateProperties();
|
||||
}
|
||||
|
||||
// Update the latestMessage counter for new message notifications
|
||||
if (currentMessage > latestMessage)
|
||||
latestMessage = currentMessage;
|
||||
LogUtil.debug("Current place in message history: " + currentMessage);
|
||||
LogUtil.debug("-------------Latest message read: " + latestMessage);
|
||||
|
||||
if (!repeat){
|
||||
// Make it clear to the user that they have either navigated to or reached one end of the message history or the other.
|
||||
if (currentMessage == 0){
|
||||
|
@ -362,25 +362,42 @@
|
||||
return tabBox;
|
||||
}
|
||||
|
||||
// Receive public chat messages
|
||||
private function handlePublicChatMessageEvent(event:PublicChatMessageEvent):void {
|
||||
LogUtil.debug("Got PublicChatMessageEvent from userid [ " + event.chatobj.userid + " ]");
|
||||
showMessage(PUBLIC_CHAT_USERID, event.chatobj, autoTranslation);
|
||||
if ((!this.focus) &&
|
||||
(! UserManager.getInstance().getConference().amIThisUser(new Number(event.chatobj.userid))) &&
|
||||
(event.chatobj.userid != "")) {
|
||||
ExternalInterface.call("startblink", ResourceUtil.getInstance().getString('bbb.chat.publicMsgAwaiting'), ResourceUtil.getInstance().getString('bbb.chat.publicMsgAwaiting2'));
|
||||
if ((! UserManager.getInstance().getConference().amIThisUser(new Number(event.chatobj.userid))) && (event.chatobj.userid != "")){
|
||||
publicNotification();
|
||||
if (!this.focus){
|
||||
ExternalInterface.call("startblink", ResourceUtil.getInstance().getString('bbb.chat.publicMsgAwaiting'), ResourceUtil.getInstance().getString('bbb.chat.publicMsgAwaiting2'));
|
||||
}
|
||||
}
|
||||
globalDispatcher.dispatchEvent(new BBBEvent(BBBEvent.RECEIVED_PUBLIC_CHAT_MESSAGE_EVENT, event.chatobj.message));
|
||||
}
|
||||
|
||||
// Receive private chat messages
|
||||
private function handlePrivateChatMessageEvent(event:PrivateChatMessageEvent):void {
|
||||
LogUtil.debug("Got PrivateChatMessageEvent");
|
||||
if ((!this.focus) && (! UserManager.getInstance().getConference().amIThisUser(new Number(event.message.sender)))) {
|
||||
ExternalInterface.call("startblink", ResourceUtil.getInstance().getString('bbb.chat.privateMsgAwaiting'), ResourceUtil.getInstance().getString('bbb.chat.privateMsgAwaiting2'));
|
||||
|
||||
if ((! UserManager.getInstance().getConference().amIThisUser(new Number(event.message.chatobj.userid)))) {
|
||||
privateNotification();
|
||||
if (!this.focus){
|
||||
ExternalInterface.call("startblink", ResourceUtil.getInstance().getString('bbb.chat.privateMsgAwaiting'), ResourceUtil.getInstance().getString('bbb.chat.privateMsgAwaiting2'));
|
||||
}
|
||||
}
|
||||
showMessage(event.message.sender, event.message.chatobj, autoTranslation);
|
||||
}
|
||||
|
||||
// Activates an audio alert for screen-reader users on public message reception
|
||||
private function publicNotification():void{
|
||||
LogUtil.debug("Public message received! Activating notification.");
|
||||
}
|
||||
|
||||
// Activates an audio alert for screen-reader users on private message reception
|
||||
private function privateNotification():void{
|
||||
LogUtil.debug("Private message received! Activating notification.");
|
||||
}
|
||||
|
||||
private function participantHasChatBox(id:String):Boolean {
|
||||
var chatBox:ChatBox = chatTabs.getChildByName(id) as ChatBox;
|
||||
if (chatBox != null) return true;
|
||||
|
Loading…
Reference in New Issue
Block a user