Commit c680e4f0 authored by Nicolas Jager's avatar Nicolas Jager

fix : various fixes

- fix : upon creation of 2+ accounts, the blockchain name appears
  as registerable regardless of check.
- fix : after having already created account without registering
  a blockchain name, editing the account to add a blockchain name
  succeeds but does not return to user to the UI from the loading
  page.
- fix : editing account details more than once, does not return
  the user to the UI.
- fix : click to accept modification for an account without any
  data changed result to wrong behaviour.

Change-Id: I08f19e6c902070b6260c466670badf3eab606934
Tuleap: #790
parent aef68d02
......@@ -358,6 +358,11 @@ void RingClientUWP::MainPage::OnregistrationStateErrorGeneric(const std::string&
void RingClientUWP::MainPage::OnregistrationStateRegistered()
{
showLoadingOverlay(false, false);
/* do not connect those delegates before initial registration on dht is fine.
Otherwise your going to mess with the wizard */
RingD::instance->nameRegistred += ref new RingClientUWP::NameRegistred(this, &RingClientUWP::MainPage::OnnameRegistred);
RingD::instance->volatileDetailsChanged += ref new RingClientUWP::VolatileDetailsChanged(this, &RingClientUWP::MainPage::OnvolatileDetailsChanged);
}
......@@ -365,3 +370,15 @@ void RingClientUWP::MainPage::OncallPlaced(Platform::String ^callId)
{
showFrame(_welcomeFrame_);
}
void RingClientUWP::MainPage::OnnameRegistred(bool status)
{
showLoadingOverlay(false, false);
}
void RingClientUWP::MainPage::OnvolatileDetailsChanged(const std::string &accountId, const std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string>>> &details)
{
showLoadingOverlay(false, false);
}
......@@ -59,6 +59,7 @@ private:
void DisplayProperties_DpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
EventRegistrationToken dpiChangedtoken;
Rect bounds;
bool editionMode = false;
void _toggleSmartBoxButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void showFrame(Windows::UI::Xaml::Controls::Frame^ frame);
......@@ -73,5 +74,7 @@ private:
void OnregistrationStateErrorGeneric(const std::string& accountId);
void OnregistrationStateRegistered();
void OncallPlaced(Platform::String ^callId);
void OnnameRegistred(bool status);
void OnvolatileDetailsChanged(const std::string &accountId, const std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string>>> &details);
};
}
......@@ -544,7 +544,7 @@ RingD::registerCallbacks()
}
else if (state == DRing::Account::States::TRYING) {
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
ref new DispatchedHandler([=]() {
setLoadingStatusText("Attempting to register account...", "#ff00f0f0");
}));
}
......@@ -584,7 +584,7 @@ RingD::registerCallbacks()
{
if (debugModeOn_) {
dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
ref new DispatchedHandler([=]() {
std::string displayMsg = msg.substr(56);
setLoadingStatusText(Utils::toPlatformString(displayMsg.substr(0,40) + "..."), "#ff000000");
DMSG_(msg);
......@@ -744,6 +744,12 @@ RingD::registerCallbacks()
break;
}
}));
}),
DRing::exportable_callback<DRing::ConfigurationSignal::VolatileDetailsChanged>(
[this](const std::string& accountId, const std::map<std::string, std::string>& details) {
ref new DispatchedHandler([=]() {
volatileDetailsChanged(accountId, details);
});
})
};
registerConfHandlers(nameRegistrationHandlers);
......@@ -1007,16 +1013,28 @@ RingD::dequeueTasks()
{
auto account = AccountListItemsViewModel::instance->findItem(Utils::toPlatformString(task->_accountId_new))->_account;
std::map<std::string, std::string> accountDetails = DRing::getAccountDetails(task->_accountId_new);
accountDetails[DRing::Account::ConfProperties::UPNP_ENABLED] = (account->_upnpState) ? ring::TRUE_STR : ring::FALSE_STR;
std::map<std::string, std::string> accountDetailsOld(accountDetails);
accountDetails[DRing::Account::ConfProperties::ALIAS] = Utils::toString(account->name_);
if (accountDetails[DRing::Account::ConfProperties::TYPE] == "RING")
if (accountDetails[DRing::Account::ConfProperties::TYPE] == "RING") {
if (accountDetails == accountDetailsOld)
break;
accountDetails[DRing::Account::ConfProperties::UPNP_ENABLED] = (account->_upnpState) ? ring::TRUE_STR : ring::FALSE_STR;
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
auto frame = dynamic_cast<Frame^>(Window::Current->Content);
dynamic_cast<RingClientUWP::MainPage^>(frame->Content)->showLoadingOverlay(true, true);
}));
auto frame = dynamic_cast<Frame^>(Window::Current->Content);
dynamic_cast<RingClientUWP::MainPage^>(frame->Content)->showLoadingOverlay(true, true);
}));
}
else {
accountDetails[DRing::Account::ConfProperties::HOSTNAME] = Utils::toString(account->_sipHostname);
accountDetails[DRing::Account::ConfProperties::PASSWORD] = Utils::toString(account->_sipPassword);
accountDetails[DRing::Account::ConfProperties::USERNAME] = Utils::toString(account->_sipUsername);
}
DRing::setAccountDetails(Utils::toString(account->accountID_), accountDetails);
break;
......@@ -1091,11 +1109,18 @@ RingD::dequeueTasks()
case Request::RegisterName:
{
auto accountDetails = DRing::getAccountDetails(task->_accountId_new);
bool result;
if (accountDetails[DRing::Account::ConfProperties::USERNAME].empty())
registerName_new(task->_accountId_new, task->_password_new, task->_publicUsername_new);
else
DRing::registerName(task->_accountId_new, task->_password_new, task->_publicUsername_new);
result = DRing::registerName(task->_accountId_new, task->_password_new, task->_publicUsername_new);
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
nameRegistred(result);
}));
//const wchar_t* toto = task->_accountId->Data();
//auto accountId = ref new String(toto);// Utils::toString(task->_accountId);
......
......@@ -45,6 +45,8 @@ delegate void RegistrationStateRegistered();
delegate void SetLoadingStatusText(String^ statusText, String^ color);
delegate void CallsListRecieved(const std::vector<std::string>& callsList);
delegate void AudioMuted(const std::string& callId, bool state);
delegate void NameRegistred(bool status);
delegate void VolatileDetailsChanged(const std::string& accountId, const std::map<std::string, std::string>& details);
using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;
using namespace std::placeholders;
......@@ -160,6 +162,8 @@ internal:
event SetLoadingStatusText^ setLoadingStatusText;
event CallsListRecieved^ callsListRecieved; // est implemente a la base pour regler le probleme du boutton d'appel qui est present lorsqu'un appel est en cours, mais il n'est pas utilise. Voir si ca peut servir a autre chose
event AudioMuted^ audioMuted;
event NameRegistred^ nameRegistred;
event VolatileDetailsChanged^ volatileDetailsChanged;
private:
/* sub classes */
......
......@@ -532,7 +532,7 @@
<TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}"
Margin="0,0,10,0"
Text="&#xE8D7;"/>
<TextBlock Text="Archive password"/>
<TextBlock Text="Password"/>
</StackPanel>
<Grid Margin="10">
<Grid.ColumnDefinitions>
......
......@@ -365,6 +365,8 @@ void RingClientUWP::Views::SmartPanel::_addAccountBtn__Click(Platform::Object^ s
_RegisterStateEdition_->IsOn = true;
_accountAliasTextBox_->Text = "";
_usernameTextBox_->Text = "";
checkStateAddAccountMenu();
}
void RingClientUWP::Views::SmartPanel::_createAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
......@@ -696,7 +698,8 @@ void RingClientUWP::Views::SmartPanel::checkStateAddAccountMenu()
if (isRingAccountType) {
bool isPublic = _RegisterState_->IsOn;
bool isUsernameValid = (_usernameValid_->Visibility == Windows::UI::Xaml::Visibility::Visible) ? true : false;
bool isUsernameValid = (_usernameValid_->Visibility == Windows::UI::Xaml::Visibility::Visible
&& !_usernameTextBox_->Text->IsEmpty()) ? true : false;
bool isPasswordValid = (_ringPasswordBoxAccountCreation_->Password->IsEmpty()) ? false : true;
......@@ -723,6 +726,13 @@ void RingClientUWP::Views::SmartPanel::checkStateAddAccountMenu()
_passwordCheckInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
if (isUsernameValid) {
_usernameValid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_usernameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
} else {
_usernameValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_usernameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
if (isPublic)
if (isUsernameValid && isAccountAlias && isRingPasswordCheck && isPasswordValid)
......@@ -1119,7 +1129,14 @@ void RingClientUWP::Views::SmartPanel::_acceptAccountModification__Click(Platfor
account->name_ = _accountAliasTextBoxEdition_->Text;
account->_upnpState = _upnpState_->IsOn;
if (account->accountType_ == "RING") {
account->_upnpState = _upnpState_->IsOn;
}
else {
account->_sipHostname = _sipHostnameEdition_->Text;
account->_sipUsername = _sipUsernameEditionTextBox_->Text;
account->_sipPassword = _sipPasswordEdition_->Password;
}
RingD::instance->updateAccount(accountId);
}
......
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