Commit 8f805cd5 authored by Nicolas Jager's avatar Nicolas Jager

message text : screen messages sent during a call

Change-Id: Ifb7d8ed39d4cd6359ead1e5ff365fd700e604527
Tuleap: #1209
parent 11e7bafa
......@@ -66,6 +66,7 @@ ContactsViewModel::ContactsViewModel()
saveContactsToFile();
}
});
RingD::instance->incomingMessage += ref new RingClientUWP::IncomingMessage(this, &RingClientUWP::ViewModel::ContactsViewModel::OnincomingMessage);
}
Contact^ // refacto : remove "byName"
......@@ -167,3 +168,27 @@ ContactsViewModel::Destringify(String^ data)
}
}
}
void RingClientUWP::ViewModel::ContactsViewModel::OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload)
{
auto contact = findContactByName(from);
/* the contact HAS TO BE already registered */
if (contact) {
auto item = SmartPanelItemsViewModel::instance->_selectedItem;
contact->_conversation->addMessage(""/* date not yet used*/, MSG_FROM_CONTACT, payload);
/* save contacts conversation to disk */
contact->saveConversationToFile();
auto selectedContact = (item) ? item->_contact : nullptr;
if (contact->ringID_ == from && contact != selectedContact) {
contact->_unreadMessages++;
/* saveContactsToFile used to save the notification */
saveContactsToFile();
}
}
}
......@@ -68,6 +68,7 @@ private:
Contact^ currentItem_;
Contact^ oldItem_;
void OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload);
};
}
}
......@@ -49,6 +49,8 @@ MessageTextPage::MessageTextPage()
String^ fromRingId, String^ payload) {
scrollDown();
});
RingD::instance->incomingMessage += ref new RingClientUWP::IncomingMessage(this, &RingClientUWP::Views::MessageTextPage::OnincomingMessage);
}
void
......@@ -135,3 +137,9 @@ Object ^ RingClientUWP::Views::BubbleHorizontalAlignement::ConvertBack(Object ^
RingClientUWP::Views::BubbleHorizontalAlignement::BubbleHorizontalAlignement()
{}
void RingClientUWP::Views::MessageTextPage::OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload)
{
scrollDown();
}
......@@ -49,6 +49,7 @@ private:
void _sendBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _messageTextBox__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void sendMessage();
void OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload);
};
}
}
......@@ -235,7 +235,6 @@ RingClientUWP::RingD::startDaemon()
auto contact = ContactsViewModel::instance->findContactByName(from2);
auto item = SmartPanelItemsViewModel::instance->findItem(contact);
item->_callId = callId2;
}));
}),
DRing::exportable_callback<DRing::CallSignal::StateChange>([this](
......@@ -315,8 +314,7 @@ RingClientUWP::RingD::startDaemon()
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
CoreDispatcherPriority::High, ref new DispatchedHandler([=]()
{
// DOIT ETRE DIFFEREND.... NE PAS UTILISE accoutId2
//incomingAccountMessage(accountId2, from2, payload);
incomingMessage(callId2, from2, payload);
MSG_("message recu :" + i.second);
}));
}
......
......@@ -31,6 +31,7 @@ delegate void IncomingCall(String^ accountId, String^ callId, String^ from);
delegate void StateChange(String^ callId, CallStatus state, int code);
delegate void IncomingAccountMessage(String^ accountId, String^ from, String^ payload);
delegate void CallPlaced(String^ callId);
delegate void IncomingMessage(String^ callId, String^ from, String^ payload);
public ref class RingD sealed
......@@ -95,6 +96,7 @@ internal:
event IncomingCall^ incomingCall;
event StateChange^ stateChange;
event IncomingAccountMessage^ incomingAccountMessage;
event IncomingMessage^ incomingMessage;
event CallPlaced^ callPlaced;
private:
......
......@@ -125,10 +125,7 @@ VideoPage::VideoPage()
}
});
RingD::instance->incomingAccountMessage += ref new IncomingAccountMessage([&](String^ accountId,
String^ from, String^ payload) {
scrollDown();
});
RingD::instance->incomingMessage += ref new RingClientUWP::IncomingMessage(this, &RingClientUWP::Views::VideoPage::OnincomingMessage);
}
void
......@@ -333,3 +330,9 @@ VideoPage::WriteFrameAsSoftwareBitmapAsync(String^ id, uint8_t* buf, int width,
}
});
}
void RingClientUWP::Views::VideoPage::OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload)
{
scrollDown();
}
......@@ -115,6 +115,7 @@ private:
void _videoControl__PointerMoved(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void btnAny_entered(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void btnAny_exited(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload);
};
}
}
\ No newline at end of file
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