-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[messenger] Refactoring Messenger and Requester #101
base: master
Are you sure you want to change the base?
Conversation
не дождался мерджа моего PR. Потом rebase сделаю |
смерджил |
Messenger::Messenger() | ||
: m_requester{new Requester(this)} | ||
{ | ||
connect(m_requester, &Requester::replied, this, &Messenger::handleResponse); | ||
connect(m_requester, &Requester::error, this, [this](int code) { | ||
emit error(fromErrorCode(code)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можешь обосновать чем такая конструкция fromErrorCode лучше той что была?
@@ -25,17 +25,26 @@ class Requester : public QObject | |||
PUT, | |||
DELETE | |||
}; | |||
enum MessengerError { | |||
OtherError, | |||
NoNetworkConnect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поищи пожалуйста все места где используется NoNetworkConnect чтобы избежать того, что его использование где-то поломалось
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да и это я про enum в messenger.h написал, не заметил сразу что у тебя в двух местах перечисление обхявляется
signals: | ||
void error(MessengerError errorType); | ||
void userIdChanged(QString userId); | ||
|
||
private slots: | ||
void handleResponse(QNetworkReply *reply); // Общий для всех ответов | ||
void handleResponse(Requester::ApiType api, const QByteArray &data); // Общий для всех ответов |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можешь пожалуйста комментарий перевести на англ
Рефакторинг Messenger и Requester. И добавил get запрос.