Commit e46fd0d9 authored by Nicolas Jager's avatar Nicolas Jager

internal : simplification for CallStatus in the UI

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