!!!! Scheduled maintenance from 6:00 PM (UTC) to 7:00 PM (UTC) - Maintenance plannifiée de 6:00 PM (UTC) à 7:00 PM (UTC) !!!!

Commit b65c0270 authored by Alexandre Lision's avatar Alexandre Lision

chat: open panel on incoming text messages

Refs #78021

Change-Id: Ic190618cd68b02d16b80fe699350ca6f00d22d20
parent 21d20636
......@@ -133,12 +133,10 @@
mediaHolder.newMessage = QObject::connect(model,
&QAbstractItemModel::rowsInserted,
[self, model] (const QModelIndex &parent, int first, int last) {
for (int row = first; row <= last; ++row) {
QModelIndex idx = model->index(row, 0, parent);
[self appendNewMessage:idx];
}
}
);
for (int row = first; row <= last; ++row) {
[self appendNewMessage:model->index(row, 0, parent)];
}
});
}
- (void) appendNewMessage:(const QModelIndex&) msgIdx
......
......@@ -88,6 +88,8 @@
@property RendererConnectionsHolder* previewHolder;
@property RendererConnectionsHolder* videoHolder;
@property QMetaObject::Connection videoStarted;
@property QMetaObject::Connection messageConnection;
@property QMetaObject::Connection mediaAddedConnection;
@end
......@@ -268,6 +270,18 @@
});
}
- (void) monitorIncomingTextMessages:(Media::Text*) media
{
/* connect to incoming chat messages to open the chat view */
QObject::disconnect(self.messageConnection);
self.messageConnection = QObject::connect(media,
&Media::Text::messageReceived,
[self] (const QMap<QString,QString>& m) {
if([[self splitView] isSubviewCollapsed:[[[self splitView] subviews] objectAtIndex: 1]])
[self uncollapseRightView];
});
}
-(void) connectVideoSignals
{
QModelIndex idx = CallModel::instance()->selectionModel()->currentIndex();
......@@ -404,6 +418,23 @@
[animation setTimingFunction:[CAMediaTimingFunction functionWithControlPoints:.7 :0.9 :1 :1]];
[CATransaction setCompletionBlock:^{
[self connectVideoSignals];
/* check if text media is already present */
if (CallModel::instance()->selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::IN)) {
Media::Text *text = CallModel::instance()->selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::IN);
[self monitorIncomingTextMessages:text];
} else if (CallModel::instance()->selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::OUT)) {
Media::Text *text = CallModel::instance()->selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::OUT);
[self monitorIncomingTextMessages:text];
} else {
/* monitor media for messaging text messaging */
self.mediaAddedConnection = QObject::connect(CallModel::instance()->selectedCall(),
&Call::mediaAdded,
[self] (Media::Media* media) {
if (media->type() == Media::Media::Type::TEXT) { [self monitorIncomingTextMessages:(Media::Text*)media];
QObject::disconnect(self.mediaAddedConnection);
}
});
}
}];
[self.view.layer addAnimation:animation forKey:animation.keyPath];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment