Merge branch 'ritzalam-fix-chat-auto-reconnect'

This commit is contained in:
Richard Alam 2017-12-18 08:27:49 -08:00
commit 7ea7991705
6 changed files with 21 additions and 15 deletions

View File

@ -117,7 +117,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</EventHandlers>
<EventHandlers type="{BBBEvent.RECONNECT_BIGBLUEBUTTON_SUCCEEDED_EVENT}" >
<EventAnnouncer generator="{ChatHistoryEvent}" type="{ChatHistoryEvent.REQUEST_HISTORY}"/>
<MethodInvoker generator="{ChatMessageService}" method="getGroupChats" />
</EventHandlers>
<EventHandlers type="{ChatSaveEvent.SAVE_CHAT_EVENT}">

View File

@ -153,21 +153,25 @@ package org.bigbluebutton.modules.chat.maps {
}
}
public function handleOpenChatBoxEvent(event:OpenChatBoxEvent):void {
var gc:GroupChat = LiveMeeting.inst().chats.getGroupChat(event.chatId);
private function openOrCreateGroupChat(chatId: String):void {
var gc:GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
if (gc != null) {
var gboxMapper:GroupChatBoxMapper = findChatBoxMapper(event.chatId);
var gboxMapper:GroupChatBoxMapper = findChatBoxMapper(chatId);
if (gboxMapper != null) {
if (gboxMapper.isChatBoxOpen()) {
globalDispatcher.dispatchEvent(new FocusOnChatBoxEvent(event.chatId));
globalDispatcher.dispatchEvent(new FocusOnChatBoxEvent(chatId));
} else if (gc.access == GroupChat.PRIVATE) {
openChatBoxForPrivateChat(event.chatId, gc);
openChatBoxForPrivateChat(chatId, gc);
}
} else {
createNewGroupChat(event.chatId);
createNewGroupChat(chatId);
}
}
}
public function handleOpenChatBoxEvent(event:OpenChatBoxEvent):void {
openOrCreateGroupChat(event.chatId);
}
private function getChatOptions():void {
chatOptions = Options.getOptions(ChatOptions) as ChatOptions;
@ -177,7 +181,7 @@ package org.bigbluebutton.modules.chat.maps {
var gcIds:Array = LiveMeeting.inst().chats.getGroupChatIds();
for (var i:int = 0; i < gcIds.length; i++) {
var cid:String = gcIds[i];
createNewGroupChat(cid);
openOrCreateGroupChat(cid);
}
}

View File

@ -73,6 +73,7 @@ package org.bigbluebutton.modules.chat.model
public function processChatHistory(messageVOs:Array):void {
if (messageVOs.length > 0) {
messages = new ArrayCollection();
var previousCM:ChatMessage = convertChatMessage(messageVOs[0] as ChatMessageVO);;
var newCM:ChatMessage;
messages.addItemAt(previousCM, 0);

View File

@ -1,9 +1,7 @@
package org.bigbluebutton.modules.chat.model
{
import com.asfusion.mate.events.Dispatcher;
import mx.collections.ArrayCollection;
import com.asfusion.mate.events.Dispatcher;
import mx.collections.ArrayCollection;
import org.bigbluebutton.modules.chat.events.GroupChatCreatedEvent;
import org.bigbluebutton.modules.chat.events.ReceivedGroupChatsEvent;
@ -36,6 +34,7 @@ package org.bigbluebutton.modules.chat.model
}
public function addGroupChatsList(gcs: Array):void {
groupChats = new ArrayCollection();
for (var i: int = 0; i < gcs.length; i++) {
var gc: GroupChat = gcs[i] as GroupChat;
groupChats.addItem(gc);

View File

@ -97,7 +97,8 @@ package org.bigbluebutton.modules.chat.model
}
public function addMessageHistory(messageVOs:Array):void {
if (messageVOs.length > 0) {
if (messageVOs.length > 0) {
_messages = new ArrayCollection();
for (var i:int = 0; i < messageVOs.length; i++) {
var newCM: ChatMessageVO = messageVOs[i] as ChatMessageVO
_messages.addItemAt(newCM, i);

View File

@ -34,7 +34,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mate:Listener type="{ChatOptionsEvent.CHANGE_FONT_SIZE}" method="changeFontSize" />
<mate:Listener type="{PrivateChatMessageEvent.PRIVATE_CHAT_MESSAGE_EVENT}" method="handlePrivateChatMessageEvent"/>
<mate:Listener type="{PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT}" method="handlePublicChatMessageEvent"/>
<!--mate:Listener type="{ChatHistoryEvent.RECEIVED_HISTORY}" method="handleRecievedChatHistoryEvent" /-->
<mate:Listener type="{ChatHistoryEvent.RECEIVED_HISTORY}" method="handleReceivedChatHistoryEvent" />
<mate:Listener type="{ClearPublicChatEvent.CLEAR_PUBLIC_CHAT_EVENT}" method="handleClearPublicChatBoxMessages"/>
<mate:Listener type="{ShortcutEvent.FOCUS_CHAT_INPUT}" method="focusChatInput" />
<mate:Listener type="{UserLeftEvent.LEFT}" method="handleUserLeftEvent"/>
@ -336,11 +336,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
}
private function handleRecievedChatHistoryEvent(event:ChatHistoryEvent):void {
private function handleReceivedChatHistoryEvent(event:ChatHistoryEvent):void {
if (chatId == event.chatId) {
var chat: GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
if (chat != null) {
chatMessages.processChatHistory(chat.messages.source);
getWelcomeMessage();
scrollToEndOfMessage();
}
}