Commit a9607f6a authored by Ronan's avatar Ronan

feat(ui/views/App/Main/Assistant): supports activation on phone number

parent d301a906
......@@ -23,6 +23,21 @@
<translation>To activate your account: Follow the instructions that we sent you at %1, then click on the button below.</translation>
</message>
</context>
<context>
<name>ActivateLinphoneSipAccountWithPhoneNumber</name>
<message>
<source>activateLinphoneSipAccount</source>
<translation>CREATE A LINPHONE ACCOUNT</translation>
</message>
<message>
<source>confirmAction</source>
<translation>ACTIVATE</translation>
</message>
<message>
<source>activationSteps</source>
<translation>We have sent a SMS with a validation code to %1. To complete your phone number verification, please enter the 4-digits code below.</translation>
</message>
</context>
<context>
<name>App</name>
<message>
......@@ -592,7 +607,7 @@ Server url not configured.</translation>
</message>
<message>
<source>quitWarning</source>
<translation>Your account has been created but is not yet validated. If you quit this view, you should add manually your account and validate it within 24 hours.</translation>
<translation>Your account has been created but is not yet validated. Are you sure you want to quit this view?</translation>
</message>
<message>
<source>displayNameLabel</source>
......
......@@ -23,6 +23,21 @@
<translation>Pour activer votre compte : Suivez les instructions que vous avez reçues à %1, puis cliquez sur le bouton plus bas.</translation>
</message>
</context>
<context>
<name>ActivateLinphoneSipAccountWithPhoneNumber</name>
<message>
<source>activateLinphoneSipAccount</source>
<translation>CRÉER UN COMPTE LINPHONE</translation>
</message>
<message>
<source>confirmAction</source>
<translation>ACTIVER</translation>
</message>
<message>
<source>activationSteps</source>
<translation>Nous vous avons envoyé un SMS avec un code de validation au %1. Pour compléter la vérification de votre tél., merci d&apos;entrer le code à 4 chiffres ci-dessous.</translation>
</message>
</context>
<context>
<name>App</name>
<message>
......@@ -592,7 +607,7 @@ Url du serveur non configurée.</translation>
</message>
<message>
<source>quitWarning</source>
<translation>Votre compte a été crée mais il n&apos;a pas été validé. Si vous quittez cette vue, vous devrez ajouter manuellement votre compte et le valider dans les 24 heures.</translation>
<translation>Votre compte a été crée mais il n&apos;a pas été validé. Êtes-vous sûr de vouloir quitter cette vue ?</translation>
</message>
<message>
<source>displayNameLabel</source>
......
......@@ -377,6 +377,7 @@
<file>ui/views/App/Calls/OutgoingCall.qml</file>
<file>ui/views/App/Calls/ZrtpTokenAuthentication.qml</file>
<file>ui/views/App/Main/Assistant/ActivateLinphoneSipAccountWithEmail.qml</file>
<file>ui/views/App/Main/Assistant/ActivateLinphoneSipAccountWithPhoneNumber.qml</file>
<file>ui/views/App/Main/Assistant/AssistantAbstractView.qml</file>
<file>ui/views/App/Main/Assistant/AssistantHome.qml</file>
<file>ui/views/App/Main/Assistant/CreateLinphoneSipAccount.qml</file>
......@@ -422,6 +423,7 @@
<file>ui/views/App/Styles/Calls/Dialogs/CallTransferStyle.qml</file>
<file>ui/views/App/Styles/Calls/Dialogs/ConferenceManagerStyle.qml</file>
<file>ui/views/App/Styles/Main/Assistant/ActivateLinphoneSipAccountWithEmailStyle.qml</file>
<file>ui/views/App/Styles/Main/Assistant/ActivateLinphoneSipAccountWithPhoneNumberStyle.qml</file>
<file>ui/views/App/Styles/Main/Assistant/AssistantAbstractViewStyle.qml</file>
<file>ui/views/App/Styles/Main/Assistant/AssistantHomeStyle.qml</file>
<file>ui/views/App/Styles/Main/Assistant/CreateLinphoneSipAccountStyle.qml</file>
......
......@@ -110,42 +110,6 @@ private:
}
}
// void onLinkAccount (
// const shared_ptr<linphone::AccountCreator> &creator,
// linphone::AccountCreatorStatus status,
// const string &resp
// ) override {}
//
// void onActivateAlias (
// const shared_ptr<linphone::AccountCreator> &creator,
// linphone::AccountCreatorStatus status,
// const string &resp
// ) override {}
//
// void onIsAliasUsed (
// const shared_ptr<linphone::AccountCreator> &creator,
// linphone::AccountCreatorStatus status,
// const string &resp
// ) override {}
//
// void onIsAccountLinked (
// const shared_ptr<linphone::AccountCreator> &creator,
// linphone::AccountCreatorStatus status,
// const string &resp
// ) override {}
//
// void onRecoverAccount (
// const shared_ptr<linphone::AccountCreator> &creator,
// linphone::AccountCreatorStatus status,
// const string &resp
// ) override {}
//
// void onUpdateAccount (
// const shared_ptr<linphone::AccountCreator> &creator,
// linphone::AccountCreatorStatus status,
// const string &resp
// ) override {}
private:
AssistantModel *mAssistant;
};
......@@ -320,6 +284,17 @@ void AssistantModel::setDisplayName (const QString &displayName) {
// -----------------------------------------------------------------------------
QString AssistantModel::getActivationCode () const {
return ::Utils::coreStringToAppString(mAccountCreator->getActivationCode());
}
void AssistantModel::setActivationCode (const QString &activationCode) {
mAccountCreator->setActivationCode(::Utils::appStringToCoreString(activationCode));
emit activationCodeChanged(activationCode);
}
// -----------------------------------------------------------------------------
QString AssistantModel::getConfigFilename () const {
return mConfigFilename;
}
......
......@@ -39,6 +39,7 @@ class AssistantModel : public QObject {
Q_PROPERTY(QString phoneNumber READ getPhoneNumber WRITE setPhoneNumber NOTIFY phoneNumberChanged);
Q_PROPERTY(QString username READ getUsername WRITE setUsername NOTIFY usernameChanged);
Q_PROPERTY(QString displayName READ getDisplayName WRITE setDisplayName NOTIFY displayNameChanged);
Q_PROPERTY(QString activationCode READ getActivationCode WRITE setActivationCode NOTIFY activationCodeChanged);
Q_PROPERTY(QString configFilename READ getConfigFilename WRITE setConfigFilename NOTIFY configFilenameChanged);
public:
......@@ -57,6 +58,7 @@ signals:
void phoneNumberChanged (const QString &phoneNumber, const QString &error);
void usernameChanged (const QString &username, const QString &error);
void displayNameChanged (const QString &displayName, const QString &error);
void activationCodeChanged (const QString &activationCode);
void activateStatusChanged (const QString &error);
void createStatusChanged (const QString &error);
......@@ -83,6 +85,9 @@ private:
QString getDisplayName () const;
void setDisplayName (const QString &displayName);
QString getActivationCode () const;
void setActivationCode (const QString &activationCode);
QString getConfigFilename () const;
void setConfigFilename (const QString &configFilename);
......
import QtQuick 2.7
import Common 1.0
import Linphone 1.0
import App.Styles 1.0
// =============================================================================
AssistantAbstractView {
property var assistantModel
backEnabled: false
title: qsTr('activateLinphoneSipAccount')
mainAction: requestBlock.execute
mainActionEnabled: activationCode.length === 4 && !requestBlock.loading
mainActionLabel: qsTr('confirmAction')
Column {
anchors.centerIn: parent
spacing: ActivateLinphoneSipAccountWithPhoneNumberStyle.spacing
width: parent.width
Text {
color: ActivateLinphoneSipAccountWithPhoneNumberStyle.activationSteps.color
font.pointSize: ActivateLinphoneSipAccountWithPhoneNumberStyle.activationSteps.fontSize
horizontalAlignment: Text.AlignHCenter
text: qsTr('activationSteps').replace('%1', assistantModel.phoneNumber)
width: parent.width
wrapMode: Text.WordWrap
}
TextField {
id: activationCode
anchors.horizontalCenter: parent.horizontalCenter
validator: IntValidator {
bottom: 0
top: 9999
}
onTextChanged: assistantModel.activationCode = text
}
RequestBlock {
id: requestBlock
action: assistantModel.activate
width: parent.width
}
}
// ---------------------------------------------------------------------------
// Assistant.
// ---------------------------------------------------------------------------
Connections {
target: assistantModel
onActivateStatusChanged: {
requestBlock.stop(error)
if (!error.length) {
window.unlockView()
window.setView('Home')
}
}
}
}
pragma Singleton
import QtQuick 2.7
import Common 1.0
// =============================================================================
QtObject {
property int spacing: 20
property QtObject activationSteps: QtObject {
property color color: Colors.g
property int fontSize: 10
}
}
......@@ -4,34 +4,35 @@ module App.Styles
# Views styles -----------------------------------------------------------------
singleton CallStyle 1.0 Calls/CallStyle.qml
singleton CallsWindowStyle 1.0 Calls/CallsWindowStyle.qml
singleton ConferenceStyle 1.0 Calls/ConferenceStyle.qml
singleton CallTransferStyle 1.0 Calls/Dialogs/CallTransferStyle.qml
singleton ConferenceManagerStyle 1.0 Calls/Dialogs/ConferenceManagerStyle.qml
singleton ActivateLinphoneSipAccountWithEmailStyle 1.0 Main/Assistant/ActivateLinphoneSipAccountWithEmailStyle.qml
singleton AssistantAbstractViewStyle 1.0 Main/Assistant/AssistantAbstractViewStyle.qml
singleton AssistantHomeStyle 1.0 Main/Assistant/AssistantHomeStyle.qml
singleton CreateLinphoneSipAccountStyle 1.0 Main/Assistant/CreateLinphoneSipAccountStyle.qml
singleton UseLinphoneSipAccountStyle 1.0 Main/Assistant/UseLinphoneSipAccountStyle.qml
singleton AssistantStyle 1.0 Main/AssistantStyle.qml
singleton ContactEditStyle 1.0 Main/ContactEditStyle.qml
singleton ContactsStyle 1.0 Main/ContactsStyle.qml
singleton ConversationStyle 1.0 Main/ConversationStyle.qml
singleton HomeStyle 1.0 Main/HomeStyle.qml
singleton InviteFriendsStyle 1.0 Main/InviteFriendsStyle.qml
singleton MainWindowStyle 1.0 Main/MainWindowStyle.qml
singleton AboutStyle 1.0 Main/Dialogs/AboutStyle.qml
singleton AuthenticationRequestStyle 1.0 Main/Dialogs/AuthenticationRequestStyle.qml
singleton ManageAccountsStyle 1.0 Main/Dialogs/ManageAccountsStyle.qml
singleton SettingsAudioStyle 1.0 Settings/SettingsAudioStyle.qml
singleton SettingsSipAccountsEditStyle 1.0 Settings/SettingsSipAccountsEditStyle.qml
singleton SettingsVideoPreviewStyle 1.0 Settings/SettingsVideoPreviewStyle.qml
singleton SettingsWindowStyle 1.0 Settings/SettingsWindowStyle.qml
singleton SplashScreenStyle 1.0 SplashScreen/SplashScreenStyle.qml
singleton CallStyle 1.0 Calls/CallStyle.qml
singleton CallsWindowStyle 1.0 Calls/CallsWindowStyle.qml
singleton ConferenceStyle 1.0 Calls/ConferenceStyle.qml
singleton CallTransferStyle 1.0 Calls/Dialogs/CallTransferStyle.qml
singleton ConferenceManagerStyle 1.0 Calls/Dialogs/ConferenceManagerStyle.qml
singleton ActivateLinphoneSipAccountWithEmailStyle 1.0 Main/Assistant/ActivateLinphoneSipAccountWithEmailStyle.qml
singleton ActivateLinphoneSipAccountWithPhoneNumberStyle 1.0 Main/Assistant/ActivateLinphoneSipAccountWithPhoneNumberStyle.qml
singleton AssistantAbstractViewStyle 1.0 Main/Assistant/AssistantAbstractViewStyle.qml
singleton AssistantHomeStyle 1.0 Main/Assistant/AssistantHomeStyle.qml
singleton CreateLinphoneSipAccountStyle 1.0 Main/Assistant/CreateLinphoneSipAccountStyle.qml
singleton UseLinphoneSipAccountStyle 1.0 Main/Assistant/UseLinphoneSipAccountStyle.qml
singleton AssistantStyle 1.0 Main/AssistantStyle.qml
singleton ContactEditStyle 1.0 Main/ContactEditStyle.qml
singleton ContactsStyle 1.0 Main/ContactsStyle.qml
singleton ConversationStyle 1.0 Main/ConversationStyle.qml
singleton HomeStyle 1.0 Main/HomeStyle.qml
singleton InviteFriendsStyle 1.0 Main/InviteFriendsStyle.qml
singleton MainWindowStyle 1.0 Main/MainWindowStyle.qml
singleton AboutStyle 1.0 Main/Dialogs/AboutStyle.qml
singleton AuthenticationRequestStyle 1.0 Main/Dialogs/AuthenticationRequestStyle.qml
singleton ManageAccountsStyle 1.0 Main/Dialogs/ManageAccountsStyle.qml
singleton SettingsAudioStyle 1.0 Settings/SettingsAudioStyle.qml
singleton SettingsSipAccountsEditStyle 1.0 Settings/SettingsSipAccountsEditStyle.qml
singleton SettingsVideoPreviewStyle 1.0 Settings/SettingsVideoPreviewStyle.qml
singleton SettingsWindowStyle 1.0 Settings/SettingsWindowStyle.qml
singleton SplashScreenStyle 1.0 SplashScreen/SplashScreenStyle.qml
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