mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 20:08:28 +00:00
improve ui/ux when FAM send 422 on register with phone number #LINQT-2458
This commit is contained in:
parent
19dc968113
commit
fae55c0e09
5 changed files with 32 additions and 2 deletions
|
|
@ -86,6 +86,14 @@ void RegisterPage::registerNewAccount(const QString &username,
|
|||
accountManager = nullptr;
|
||||
}
|
||||
});
|
||||
connect(accountManager, &AccountManager::phoneNumberValidationNotAvailable, this,
|
||||
[this, accountManager]() mutable {
|
||||
App::postCoreAsync([this]() { emit phoneNumberValidationNotAvailable(); });
|
||||
if (accountManager) {
|
||||
accountManager->deleteLater();
|
||||
accountManager = nullptr;
|
||||
}
|
||||
});
|
||||
connect(accountManager, &AccountManager::tokenConversionSucceed, this,
|
||||
[this, accountManager, address](QString convertedToken) {
|
||||
App::postCoreAsync([this, convertedToken, address]() {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ signals:
|
|||
const QString &sipIdentityAddress);
|
||||
void registerNewAccountFailed(const QString &error);
|
||||
void errorInField(const QString &field, const QString &error);
|
||||
void phoneNumberValidationNotAvailable();
|
||||
void tokenConversionSucceed();
|
||||
void linkingNewAccountWithCodeSucceed();
|
||||
void linkingNewAccountWithCodeFailed(const QString &error);
|
||||
|
|
|
|||
|
|
@ -311,7 +311,9 @@ void AccountManager::registerNewAccount(const QString &username,
|
|||
} else if (request->getType() ==
|
||||
linphone::AccountManagerServicesRequest::Type::SendPhoneNumberLinkingCodeBySms) {
|
||||
lInfo() << "[AccountManager] error sending code to phone number" << errorMessage;
|
||||
if (parameterErrors) {
|
||||
if (statusCode == 422) {
|
||||
emit phoneNumberValidationNotAvailable();
|
||||
} else if (parameterErrors) {
|
||||
for (const std::string &key : parameterErrors->getKeys()) {
|
||||
emit errorInField(Utils::coreStringToAppString(key),
|
||||
Utils::coreStringToAppString(errorMessage));
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ signals:
|
|||
void errorInField(const QString &field, const QString &error);
|
||||
void linkingNewAccountWithCodeSucceed();
|
||||
void linkingNewAccountWithCodeFailed(const QString &error);
|
||||
void phoneNumberValidationNotAvailable();
|
||||
|
||||
private:
|
||||
std::shared_ptr<AccountModel> mAccountModel;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,21 @@ LoginLayout {
|
|||
readonly property string phoneNumber: phoneNumberInput.phoneNumber
|
||||
readonly property string email: emailInput.text
|
||||
|
||||
Dialog {
|
||||
id: phoneNumberNotAvailableDialog
|
||||
//: Phone number validation not available
|
||||
title: qsTr("phone_number_validation_not_available_title")
|
||||
//: Phone number validation is not available, please use email account creation process
|
||||
text: qsTr("phone_number_validation_not_available_text")
|
||||
//: Register with an email
|
||||
firstButtonText: qsTr("register_with_email_button")
|
||||
onAccepted: {
|
||||
bar.setCurrentIndex(1)
|
||||
close()
|
||||
}
|
||||
onRejected: close()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: RegisterPageCpp
|
||||
function onErrorInField(field, errorMessage) {
|
||||
|
|
@ -29,6 +44,9 @@ LoginLayout {
|
|||
console.log("register failed", errorMessage)
|
||||
otherErrorText.setText(errorMessage)
|
||||
}
|
||||
function onPhoneNumberValidationNotAvailable() {
|
||||
phoneNumberNotAvailableDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
titleContent: [
|
||||
|
|
@ -99,8 +117,8 @@ LoginLayout {
|
|||
spacing: Utils.getSizeWithScreenRatio(50)
|
||||
|
||||
TabBar {
|
||||
Layout.fillWidth: true
|
||||
id: bar
|
||||
Layout.fillWidth: true
|
||||
spacing: Utils.getSizeWithScreenRatio(40)
|
||||
Layout.rightMargin: Math.max(Utils.getSizeWithScreenRatio(5), Utils.getSizeWithScreenRatio(127 - ((127/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))))
|
||||
// "S'inscrire avec un numéro de téléphone"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue