Commit 5c395ea7 authored by atraczyk's avatar atraczyk

calls: adds optional messaging frame to the call page

- adds the ability to split the call page into a video area and a
  messaging area

Change-Id: I6fd25b7256f3b14b9da1f5de175b606def928712
Tuleap: #1052
parent 21e55dd5
......@@ -242,6 +242,45 @@ RingClientUWP::RingD::startDaemon()
}));
}
}),
DRing::exportable_callback<DRing::CallSignal::IncomingMessage>([&](
const std::string& callId,
const std::string& from,
const std::map<std::string, std::string>& payloads)
{
MSG_("<IncomingMessage>");
MSG_("callId = " + callId);
MSG_("from = " + from);
auto callId2 = toPlatformString(callId);
auto from2 = toPlatformString(from);
from2 = Utils::TrimRingId2(from2);
Call^ call = CallsViewModel::instance->findCall(callId2);
if (!call)
return;
String^ accountId2 = call->accountId;
const std::string PROFILE_VCF = "x-ring/ring.profile.vcard";
static const unsigned int profileSize = PROFILE_VCF.size();
for (auto i : payloads) {
if (i.first.compare(0, profileSize, PROFILE_VCF) == 0) {
MSG_("VCARD");
return;
}
MSG_("payload.first = " + i.first);
MSG_("payload.second = " + i.second);
auto payload = Utils::toPlatformString(i.second);
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
CoreDispatcherPriority::Low, ref new DispatchedHandler([=]()
{
incomingAccountMessage(accountId2, from2, payload);
}));
}
}),
DRing::exportable_callback<DRing::ConfigurationSignal::RegistrationStateChanged>([this](
const std::string& account_id, const std::string& state,
int detailsCode, const std::string& detailsStr)
......
......@@ -291,7 +291,7 @@
<StackPanel Grid.Column="1"
VerticalAlignment="Bottom">
<TextBlock x:Name="_selectedAccountName_"
Text="default name"
Text="[TEXT MISSING]"
Margin="10"
Style="{StaticResource TextStyle2}"/>
<StackPanel Orientation="Horizontal">
......
......@@ -124,6 +124,20 @@ Platform::String^ TrimRingId(Platform::String^ s)
return ref new Platform::String(first, static_cast<unsigned int>(last - first));
}
/* fix some issue in the daemon --> remove "@..." */
Platform::String^ TrimRingId2(Platform::String^ s)
{
const WCHAR* first = s->Begin();
const WCHAR* last = s->End();
while (first != last && last[-1] != '@')
--last;
last--;
return ref new Platform::String(first, static_cast<unsigned int>(last - first));
}
Platform::String^ GetNewGUID()
{
GUID result;
......
This diff is collapsed.
......@@ -46,6 +46,11 @@ VideoPage::VideoPage()
void
RingClientUWP::Views::VideoPage::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e)
{
RingD::instance->incomingAccountMessage += ref new IncomingAccountMessage([&](String^ accountId,
String^ from, String^ payload) {
scrollDown();
});
updatePageContent();
}
......@@ -59,6 +64,46 @@ void RingClientUWP::Views::VideoPage::updatePageContent()
return;
_callee_->Text = contact->name_;
_messagesList_->ItemsSource = contact->_conversation->_messages;
scrollDown();
}
void RingClientUWP::Views::VideoPage::scrollDown()
{
_scrollView_->UpdateLayout();
_scrollView_->ScrollToVerticalOffset(_scrollView_->ScrollableHeight);
}
void
RingClientUWP::Views::VideoPage::_sendBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
sendMessage();
}
void
RingClientUWP::Views::VideoPage::_messageTextBox__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)
{
if (e->Key == Windows::System::VirtualKey::Enter) {
sendMessage();
}
}
void
RingClientUWP::Views::VideoPage::sendMessage()
{
auto contact = ViewModel::ContactsViewModel::instance->selectedContact;
auto txt = _messageTextBox_->Text;
/* empty the textbox */
_messageTextBox_->Text = "";
if (!contact || txt->IsEmpty())
return;
RingD::instance->sendAccountTextMessage(txt);
scrollDown();
}
void RingClientUWP::Views::VideoPage::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
......@@ -91,7 +136,14 @@ void RingClientUWP::Views::VideoPage::_btnPause__Tapped(Platform::Object^ sender
void RingClientUWP::Views::VideoPage::_btnChat__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e)
{
chatOpen = !chatOpen;
if (chatOpen) {
_rowChatBx_->Height = 200;
chatPanelCall();
}
else {
_rowChatBx_->Height = 0;
}
}
......
......@@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "VideoPage.g.h"
#include "MessageTextPage.xaml.h"
using namespace Windows::Media::Capture;
using namespace Windows::UI::Xaml::Navigation;
......@@ -56,6 +57,20 @@ public:
}
}
property bool chatOpen
{
bool get()
{
return chatOpen_;
}
void set(bool value)
{
chatOpen_ = value;
}
}
void scrollDown();
protected:
virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
......@@ -73,6 +88,11 @@ internal:
private:
bool barFading_;
bool chatOpen_;
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 Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _btnCancel__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
......
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