Commit 72be7463 authored by atraczyk's avatar atraczyk Committed by Adrien Béraud
Browse files

account edition: fix username registration post account creation

Change-Id: Id48e9a72b3f67c353b237fc506a9a1e3eea09cae
parent 0d1dcc9f
...@@ -653,9 +653,7 @@ RingD::registerName(String^ accountId, String^ password, String^ username) ...@@ -653,9 +653,7 @@ RingD::registerName(String^ accountId, String^ password, String^ username)
auto _password = Utils::toString(password); auto _password = Utils::toString(password);
auto _username = Utils::toString(username); auto _username = Utils::toString(username);
bool result; DRing::registerName(_accountId, _password, _username);
result = DRing::registerName(_accountId, _password, _username);
}); });
} }
...@@ -1109,6 +1107,7 @@ RingD::registerCallbacks() ...@@ -1109,6 +1107,7 @@ RingD::registerCallbacks()
bool res = state == 0; bool res = state == 0;
Utils::runOnUIThread([this, res, account_id]() { Utils::runOnUIThread([this, res, account_id]() {
nameRegistered(res, Utils::toPlatformString(account_id)); nameRegistered(res, Utils::toPlatformString(account_id));
mainPage->showLoadingOverlay(false, false);
}); });
if (!res) if (!res)
return; return;
......
...@@ -937,9 +937,6 @@ void RingClientUWP::Views::SmartPanel::_acceptAccountModification__Click(Platfor ...@@ -937,9 +937,6 @@ void RingClientUWP::Views::SmartPanel::_acceptAccountModification__Click(Platfor
selectMenu(MenuOpen::ACCOUNTS_LIST); selectMenu(MenuOpen::ACCOUNTS_LIST);
updatePageContent(); updatePageContent();
if (_usernameValidEdition_->Visibility == Windows::UI::Xaml::Visibility::Visible && _usernameTextBoxEdition_->Text->Length() > 2)
RingD::instance->registerName(account->accountID_, "", _usernameTextBoxEdition_->Text);
} }
......
...@@ -615,23 +615,29 @@ public: ...@@ -615,23 +615,29 @@ public:
task_queue(task_queue const& other) {} task_queue(task_queue const& other) {}
void add_task(std::function<void()> const& task) { void add_task(std::function<void()> const& task) {
std::lock_guard<std::mutex> lk(taskMutex_); runOnWorkerThread([this, task]() {
tasks_.push(task); std::lock_guard<std::mutex> lk(taskMutex_);
tasks_.push(task);
});
} }
void dequeue_tasks() { void dequeue_tasks() {
std::lock_guard<std::mutex> lk(taskMutex_); runOnWorkerThread([this]() {
while (!tasks_.empty()) { std::lock_guard<std::mutex> lk(taskMutex_);
auto f = tasks_.front(); while (!tasks_.empty()) {
f(); auto f = tasks_.front();
tasks_.pop(); f();
} tasks_.pop();
}
});
} }
void clear() { void clear() {
std::lock_guard<std::mutex> lk(taskMutex_); runOnWorkerThread([this]() {
std::queue<std::function<void()>> empty; std::lock_guard<std::mutex> lk(taskMutex_);
std::swap(tasks_, empty); std::queue<std::function<void()>> empty;
std::swap(tasks_, empty);
});
} }
private: private:
......
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