Skip to content
Snippets Groups Projects
Commit c680e4f0 authored by Nicolas Jager's avatar Nicolas Jager
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -358,6 +358,11 @@ void RingClientUWP::MainPage::OnregistrationStateErrorGeneric(const std::string& ...@@ -358,6 +358,11 @@ void RingClientUWP::MainPage::OnregistrationStateErrorGeneric(const std::string&
void RingClientUWP::MainPage::OnregistrationStateRegistered() void RingClientUWP::MainPage::OnregistrationStateRegistered()
{ {
showLoadingOverlay(false, false); 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) ...@@ -365,3 +370,15 @@ void RingClientUWP::MainPage::OncallPlaced(Platform::String ^callId)
{ {
showFrame(_welcomeFrame_); 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: ...@@ -59,6 +59,7 @@ private:
void DisplayProperties_DpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); void DisplayProperties_DpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
EventRegistrationToken dpiChangedtoken; EventRegistrationToken dpiChangedtoken;
Rect bounds; Rect bounds;
bool editionMode = false;
void _toggleSmartBoxButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void _toggleSmartBoxButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void showFrame(Windows::UI::Xaml::Controls::Frame^ frame); void showFrame(Windows::UI::Xaml::Controls::Frame^ frame);
...@@ -73,5 +74,7 @@ private: ...@@ -73,5 +74,7 @@ private:
void OnregistrationStateErrorGeneric(const std::string& accountId); void OnregistrationStateErrorGeneric(const std::string& accountId);
void OnregistrationStateRegistered(); void OnregistrationStateRegistered();
void OncallPlaced(Platform::String ^callId); 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);
}; };
} }
...@@ -744,6 +744,12 @@ RingD::registerCallbacks() ...@@ -744,6 +744,12 @@ RingD::registerCallbacks()
break; 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); registerConfHandlers(nameRegistrationHandlers);
...@@ -1007,16 +1013,28 @@ RingD::dequeueTasks() ...@@ -1007,16 +1013,28 @@ RingD::dequeueTasks()
{ {
auto account = AccountListItemsViewModel::instance->findItem(Utils::toPlatformString(task->_accountId_new))->_account; auto account = AccountListItemsViewModel::instance->findItem(Utils::toPlatformString(task->_accountId_new))->_account;
std::map<std::string, std::string> accountDetails = DRing::getAccountDetails(task->_accountId_new); 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_); 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, CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() { ref new DispatchedHandler([=]() {
auto frame = dynamic_cast<Frame^>(Window::Current->Content); auto frame = dynamic_cast<Frame^>(Window::Current->Content);
dynamic_cast<RingClientUWP::MainPage^>(frame->Content)->showLoadingOverlay(true, true); 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); DRing::setAccountDetails(Utils::toString(account->accountID_), accountDetails);
break; break;
...@@ -1091,11 +1109,18 @@ RingD::dequeueTasks() ...@@ -1091,11 +1109,18 @@ RingD::dequeueTasks()
case Request::RegisterName: case Request::RegisterName:
{ {
auto accountDetails = DRing::getAccountDetails(task->_accountId_new); auto accountDetails = DRing::getAccountDetails(task->_accountId_new);
bool result;
if (accountDetails[DRing::Account::ConfProperties::USERNAME].empty()) if (accountDetails[DRing::Account::ConfProperties::USERNAME].empty())
registerName_new(task->_accountId_new, task->_password_new, task->_publicUsername_new); registerName_new(task->_accountId_new, task->_password_new, task->_publicUsername_new);
else 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(); //const wchar_t* toto = task->_accountId->Data();
//auto accountId = ref new String(toto);// Utils::toString(task->_accountId); //auto accountId = ref new String(toto);// Utils::toString(task->_accountId);
......
...@@ -45,6 +45,8 @@ delegate void RegistrationStateRegistered(); ...@@ -45,6 +45,8 @@ delegate void RegistrationStateRegistered();
delegate void SetLoadingStatusText(String^ statusText, String^ color); delegate void SetLoadingStatusText(String^ statusText, String^ color);
delegate void CallsListRecieved(const std::vector<std::string>& callsList); delegate void CallsListRecieved(const std::vector<std::string>& callsList);
delegate void AudioMuted(const std::string& callId, bool state); 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 SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;
using namespace std::placeholders; using namespace std::placeholders;
...@@ -160,6 +162,8 @@ internal: ...@@ -160,6 +162,8 @@ internal:
event SetLoadingStatusText^ setLoadingStatusText; 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 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 AudioMuted^ audioMuted;
event NameRegistred^ nameRegistred;
event VolatileDetailsChanged^ volatileDetailsChanged;
private: private:
/* sub classes */ /* sub classes */
......
...@@ -532,7 +532,7 @@ ...@@ -532,7 +532,7 @@
<TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}"
Margin="0,0,10,0" Margin="0,0,10,0"
Text="&#xE8D7;"/> Text="&#xE8D7;"/>
<TextBlock Text="Archive password"/> <TextBlock Text="Password"/>
</StackPanel> </StackPanel>
<Grid Margin="10"> <Grid Margin="10">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
......
...@@ -365,6 +365,8 @@ void RingClientUWP::Views::SmartPanel::_addAccountBtn__Click(Platform::Object^ s ...@@ -365,6 +365,8 @@ void RingClientUWP::Views::SmartPanel::_addAccountBtn__Click(Platform::Object^ s
_RegisterStateEdition_->IsOn = true; _RegisterStateEdition_->IsOn = true;
_accountAliasTextBox_->Text = ""; _accountAliasTextBox_->Text = "";
_usernameTextBox_->Text = ""; _usernameTextBox_->Text = "";
checkStateAddAccountMenu();
} }
void RingClientUWP::Views::SmartPanel::_createAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) void RingClientUWP::Views::SmartPanel::_createAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
...@@ -696,7 +698,8 @@ void RingClientUWP::Views::SmartPanel::checkStateAddAccountMenu() ...@@ -696,7 +698,8 @@ void RingClientUWP::Views::SmartPanel::checkStateAddAccountMenu()
if (isRingAccountType) { if (isRingAccountType) {
bool isPublic = _RegisterState_->IsOn; 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; bool isPasswordValid = (_ringPasswordBoxAccountCreation_->Password->IsEmpty()) ? false : true;
...@@ -723,6 +726,13 @@ void RingClientUWP::Views::SmartPanel::checkStateAddAccountMenu() ...@@ -723,6 +726,13 @@ void RingClientUWP::Views::SmartPanel::checkStateAddAccountMenu()
_passwordCheckInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible; _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 (isPublic)
if (isUsernameValid && isAccountAlias && isRingPasswordCheck && isPasswordValid) if (isUsernameValid && isAccountAlias && isRingPasswordCheck && isPasswordValid)
...@@ -1119,7 +1129,14 @@ void RingClientUWP::Views::SmartPanel::_acceptAccountModification__Click(Platfor ...@@ -1119,7 +1129,14 @@ void RingClientUWP::Views::SmartPanel::_acceptAccountModification__Click(Platfor
account->name_ = _accountAliasTextBoxEdition_->Text; account->name_ = _accountAliasTextBoxEdition_->Text;
if (account->accountType_ == "RING") {
account->_upnpState = _upnpState_->IsOn; account->_upnpState = _upnpState_->IsOn;
}
else {
account->_sipHostname = _sipHostnameEdition_->Text;
account->_sipUsername = _sipUsernameEditionTextBox_->Text;
account->_sipPassword = _sipPasswordEdition_->Password;
}
RingD::instance->updateAccount(accountId); RingD::instance->updateAccount(accountId);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment