Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alex13sh
Copy link
Member

@alex13sh alex13sh commented Aug 4, 2020

Рефакторинг Messenger и Requester. И добавил get запрос.

@alex13sh
Copy link
Member Author

alex13sh commented Aug 4, 2020

не дождался мерджа моего PR. Потом rebase сделаю

@atatarov
Copy link
Member

atatarov commented Aug 5, 2020

не дождался мерджа моего PR. Потом rebase сделаю

смерджил

@alex13sh alex13sh changed the title Messenger 100 [messenger] Refactoring Messenger and Requester Aug 5, 2020
application/src/requester.h Outdated Show resolved Hide resolved
application/src/requester.cpp Outdated Show resolved Hide resolved
application/src/requester.cpp Outdated Show resolved Hide resolved
application/src/requester.cpp Show resolved Hide resolved
application/src/requester.h Outdated Show resolved Hide resolved
application/src/requester.h Outdated Show resolved Hide resolved
application/src/requester.h Outdated Show resolved Hide resolved
application/src/messenger.h Show resolved Hide resolved
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));
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поищи пожалуйста все места где используется NoNetworkConnect чтобы избежать того, что его использование где-то поломалось

Copy link
Member

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); // Общий для всех ответов
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можешь пожалуйста комментарий перевести на англ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants