Commit e46fd0d9 authored by Nicolas Jager's avatar Nicolas Jager
Browse files

internal : simplification for CallStatus in the UI

Change-Id: I00bc4c6b774818a4cd52baaa92433a80fb060b69
Tuleap: #1282
parent d8e22fd1
...@@ -3,12 +3,10 @@ namespace RingClientUWP ...@@ -3,12 +3,10 @@ namespace RingClientUWP
/* public enumerations. */ /* public enumerations. */
public enum class CallStatus { public enum class CallStatus {
NONE, NONE,
INCOMING_RINGING, RINGING,
OUTGOING_RINGING, CONNECTING,
SEARCHING,
IN_PROGRESS, IN_PROGRESS,
PAUSED, PAUSED,
ENDED,
TERMINATING TERMINATING
}; };
......
...@@ -76,11 +76,11 @@ MainPage::MainPage() ...@@ -76,11 +76,11 @@ MainPage::MainPage()
Platform::Object^>(this, &MainPage::DisplayProperties_DpiChanged)); Platform::Object^>(this, &MainPage::DisplayProperties_DpiChanged));
visibilityChangedEventToken = Window::Current->VisibilityChanged += visibilityChangedEventToken = Window::Current->VisibilityChanged +=
ref new WindowVisibilityChangedEventHandler(this, &MainPage::Application_VisibilityChanged); ref new WindowVisibilityChangedEventHandler(this, &MainPage::Application_VisibilityChanged);
applicationSuspendingEventToken = Application::Current->Suspending += applicationSuspendingEventToken = Application::Current->Suspending +=
ref new SuspendingEventHandler(this, &MainPage::Application_Suspending); ref new SuspendingEventHandler(this, &MainPage::Application_Suspending);
applicationResumingEventToken = Application::Current->Resuming += applicationResumingEventToken = Application::Current->Resuming +=
ref new EventHandler<Object^>(this, &MainPage::Application_Resuming); ref new EventHandler<Object^>(this, &MainPage::Application_Resuming);
} }
void void
...@@ -250,7 +250,7 @@ void RingClientUWP::MainPage::OnstateChange(Platform::String ^callId, RingClient ...@@ -250,7 +250,7 @@ void RingClientUWP::MainPage::OnstateChange(Platform::String ^callId, RingClient
switch (state) { switch (state) {
/* send the user to the peer's message text page */ /* send the user to the peer's message text page */
case CallStatus::ENDED: case CallStatus::NONE:
{ {
if (item) if (item)
OnsummonMessageTextPage(); OnsummonMessageTextPage();
...@@ -370,9 +370,9 @@ MainPage::BeginExtendedExecution() ...@@ -370,9 +370,9 @@ MainPage::BeginExtendedExecution()
newSession->Reason = ExtendedExecutionReason::SavingData; newSession->Reason = ExtendedExecutionReason::SavingData;
newSession->Description = "Extended Execution"; newSession->Description = "Extended Execution";
sessionRevokedToken = (newSession->Revoked += ref new TypedEventHandler<Object^, sessionRevokedToken = (newSession->Revoked += ref new TypedEventHandler<Object^,
ExtendedExecutionRevokedEventArgs^>(this, &MainPage::SessionRevoked)); ExtendedExecutionRevokedEventArgs^>(this, &MainPage::SessionRevoked));
return create_task(newSession->RequestExtensionAsync()) return create_task(newSession->RequestExtensionAsync())
.then([=](ExtendedExecutionResult result){ .then([=](ExtendedExecutionResult result) {
try { try {
switch (result) switch (result)
{ {
......
...@@ -391,7 +391,7 @@ RingClientUWP::RingD::startDaemon() ...@@ -391,7 +391,7 @@ RingClientUWP::RingD::startDaemon()
CoreDispatcherPriority::High, ref new DispatchedHandler([=]() CoreDispatcherPriority::High, ref new DispatchedHandler([=]()
{ {
incomingCall(accountId2, callId2, from2); incomingCall(accountId2, callId2, from2);
stateChange(callId2, CallStatus::INCOMING_RINGING, 0); stateChange(callId2, CallStatus::RINGING, 0);
auto contact = ContactsViewModel::instance->findContactByName(from2); auto contact = ContactsViewModel::instance->findContactByName(from2);
auto item = SmartPanelItemsViewModel::instance->findItem(contact); auto item = SmartPanelItemsViewModel::instance->findItem(contact);
...@@ -413,7 +413,7 @@ RingClientUWP::RingD::startDaemon() ...@@ -413,7 +413,7 @@ RingClientUWP::RingD::startDaemon()
auto state3 = translateCallStatus(state2); auto state3 = translateCallStatus(state2);
if (state3 == CallStatus::ENDED) if (state3 == CallStatus::NONE)
DRing::hangUp(callId); // solve a bug in the daemon API. DRing::hangUp(callId); // solve a bug in the daemon API.
...@@ -840,19 +840,13 @@ RingD::dequeueTasks() ...@@ -840,19 +840,13 @@ RingD::dequeueTasks()
RingClientUWP::CallStatus RingClientUWP::RingD::translateCallStatus(String^ state) RingClientUWP::CallStatus RingClientUWP::RingD::translateCallStatus(String^ state)
{ {
if (state == "INCOMING") if (state == "INCOMING")
return CallStatus::INCOMING_RINGING; return CallStatus::RINGING;
if (state == "CURRENT") if (state == "CURRENT")
return CallStatus::IN_PROGRESS; return CallStatus::IN_PROGRESS;
if (state == "OVER") if (state == "CONNECTING" || state == "RINGING")
return CallStatus::ENDED; return CallStatus::CONNECTING;
if (state == "RINGING")
return CallStatus::OUTGOING_RINGING;
if (state == "CONNECTING")
return CallStatus::SEARCHING;
return CallStatus::NONE; return CallStatus::NONE;
......
...@@ -113,7 +113,6 @@ SmartPanel::SmartPanel() ...@@ -113,7 +113,6 @@ SmartPanel::SmartPanel()
switch (state) { switch (state) {
case CallStatus::NONE: case CallStatus::NONE:
case CallStatus::ENDED:
{ {
item->_callId = ""; item->_callId = "";
break; break;
...@@ -532,7 +531,7 @@ Object ^ RingClientUWP::Views::IncomingVisibility::Convert(Object ^ value, Windo ...@@ -532,7 +531,7 @@ Object ^ RingClientUWP::Views::IncomingVisibility::Convert(Object ^ value, Windo
{ {
auto state = static_cast<CallStatus>(value); auto state = static_cast<CallStatus>(value);
if (state == CallStatus::INCOMING_RINGING) if (state == CallStatus::RINGING)
return Windows::UI::Xaml::Visibility::Visible; return Windows::UI::Xaml::Visibility::Visible;
else else
return Windows::UI::Xaml::Visibility::Collapsed; return Windows::UI::Xaml::Visibility::Collapsed;
...@@ -551,7 +550,7 @@ Object ^ RingClientUWP::Views::OutGoingVisibility::Convert(Object ^ value, Windo ...@@ -551,7 +550,7 @@ Object ^ RingClientUWP::Views::OutGoingVisibility::Convert(Object ^ value, Windo
{ {
auto state = static_cast<CallStatus>(value); auto state = static_cast<CallStatus>(value);
if (state == CallStatus::SEARCHING || state == CallStatus::OUTGOING_RINGING) if (state == CallStatus::CONNECTING || state == CallStatus::RINGING)
return Windows::UI::Xaml::Visibility::Visible; return Windows::UI::Xaml::Visibility::Visible;
else else
return Windows::UI::Xaml::Visibility::Collapsed; return Windows::UI::Xaml::Visibility::Collapsed;
...@@ -569,7 +568,7 @@ Object ^ RingClientUWP::Views::HasAnActiveCall::Convert(Object ^ value, Windows: ...@@ -569,7 +568,7 @@ Object ^ RingClientUWP::Views::HasAnActiveCall::Convert(Object ^ value, Windows:
{ {
auto state = static_cast<CallStatus>(value); auto state = static_cast<CallStatus>(value);
if (state == CallStatus::NONE || state == CallStatus::ENDED) if (state == CallStatus::NONE)
return Windows::UI::Xaml::Visibility::Collapsed; return Windows::UI::Xaml::Visibility::Collapsed;
else else
return Windows::UI::Xaml::Visibility::Visible; return Windows::UI::Xaml::Visibility::Visible;
......
...@@ -51,6 +51,6 @@ SmartPanelItem::NotifyPropertyChanged(String^ propertyName) ...@@ -51,6 +51,6 @@ SmartPanelItem::NotifyPropertyChanged(String^ propertyName)
void RingClientUWP::Controls::SmartPanelItem::OncallPlaced(Platform::String ^callId) void RingClientUWP::Controls::SmartPanelItem::OncallPlaced(Platform::String ^callId)
{ {
if (_callId == callId) { if (_callId == callId) {
_callStatus = CallStatus::SEARCHING; _callStatus = CallStatus::CONNECTING;
} }
} }
...@@ -120,7 +120,7 @@ VideoPage::VideoPage() ...@@ -120,7 +120,7 @@ VideoPage::VideoPage()
RingD::instance->stateChange += RingD::instance->stateChange +=
ref new StateChange([&](String^ callId, CallStatus state, int code) ref new StateChange([&](String^ callId, CallStatus state, int code)
{ {
if (state == CallStatus::ENDED) { if (state == CallStatus::NONE) {
Video::VideoManager::instance->rendererManager()->raiseClearRenderTarget(); Video::VideoManager::instance->rendererManager()->raiseClearRenderTarget();
} }
}); });
......
Supports Markdown
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