Commit 2d4a68a9 authored by Nicolas Jager's avatar Nicolas Jager

fix : client crashes in case of empty account list.

- summons the wizard.
- nb : this patch doesn't solve the problem in the daemon

Change-Id: Ice12e43c04a299affa093031e772ee013b801178
Tuleap: #1240
parent bf406b2c
......@@ -19,6 +19,7 @@
#include "LoadingPage.xaml.h"
#include "MainPage.xaml.h"
#include "Wizard.xaml.h"
using namespace Windows::ApplicationModel::Core;
using namespace Windows::Foundation;
......@@ -35,6 +36,9 @@ using namespace RingClientUWP;
App::App()
{
InitializeComponent(); // summon partial class, form generated files trough App.xaml
/* connect to delegate */
RingD::instance->summonWizard += ref new RingClientUWP::SummonWizard(this, &RingClientUWP::App::OnsummonWizard);
}
void
......@@ -59,4 +63,9 @@ App::OnLaunched(LaunchActivatedEventArgs^ e)
ApplicationView::GetForCurrentView()->TitleBar->BackgroundColor = Colors::LightBlue;
ApplicationView::GetForCurrentView()->TitleBar->ForegroundColor = Colors::White;
ApplicationView::GetForCurrentView()->TitleBar->ButtonForegroundColor = Colors::White;
}
\ No newline at end of file
}
void RingClientUWP::App::OnsummonWizard()
{
rootFrame->Navigate(Windows::UI::Xaml::Interop::TypeName(Views::Wizard::typeid));
}
......@@ -33,5 +33,6 @@ internal:
private:
Frame^ rootFrame;
void OnsummonWizard();
};
}
\ No newline at end of file
......@@ -47,6 +47,13 @@ RingClientUWP::RingD::reloadAccountList()
RingClientUWP::ViewModel::AccountsViewModel::instance->clearAccountList();
std::vector<std::string> accountList = DRing::getAccountList();
/* if for any reason there is no account at all, screen the wizard */
if (accountList.size() == 0) {
summonWizard();
return;
}
std::vector<std::string>::reverse_iterator rit = accountList.rbegin();
for (; rit != accountList.rend(); ++rit) {
......@@ -380,7 +387,7 @@ RingClientUWP::RingD::startDaemon()
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
reloadAccountList();
std::vector<std::string> accountList = DRing::getAccountList();
std::vector<std::string> accountList = DRing::getAccountList(); // refacto : there is already a callo to getAccountList in reloadAccountList
auto last_id = accountList.back();
if (!account_id.compare(last_id)) {
auto frame = dynamic_cast<Frame^>(Window::Current->Content);
......
......@@ -34,6 +34,7 @@ delegate void CallPlaced(String^ callId);
delegate void IncomingMessage(String^ callId, String^ payload);
delegate void DevicesListRefreshed(Vector<String^>^ devicesList);
delegate void ExportOnRingEnded(String^ accountId, String^ pin);
delegate void SummonWizard();
public ref class RingD sealed
......@@ -109,6 +110,7 @@ internal:
event CallPlaced^ callPlaced;
event DevicesListRefreshed^ devicesListRefreshed;
event ExportOnRingEnded^ exportOnRingEnded;
event SummonWizard^ summonWizard;
private:
/* sub classes */
......
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