2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Implement information settings section.

This commit is contained in:
John Preston
2018-09-09 20:38:08 +03:00
parent 633ff4b60e
commit bbe6d2d13b
26 changed files with 459 additions and 25 deletions

View File

@@ -4946,6 +4946,37 @@ auto ApiWrap::passwordStateCurrent() const
: base::none;
}
void ApiWrap::saveSelfBio(const QString &text, FnMut<void()> done) {
if (_saveBioRequestId) {
if (text != _saveBioText) {
request(_saveBioRequestId).cancel();
} else {
if (done) {
_saveBioDone = std::move(done);
}
return;
}
}
_saveBioText = text;
_saveBioDone = std::move(done);
_saveBioRequestId = request(MTPaccount_UpdateProfile(
MTP_flags(MTPaccount_UpdateProfile::Flag::f_about),
MTPstring(),
MTPstring(),
MTP_string(text)
)).done([=](const MTPUser &result) {
_saveBioRequestId = 0;
App::feedUsers(MTP_vector<MTPUser>(1, result));
App::self()->setAbout(_saveBioText);
if (_saveBioDone) {
_saveBioDone();
}
}).fail([=](const RPCError &error) {
_saveBioRequestId = 0;
}).send();
}
void ApiWrap::readServerHistory(not_null<History*> history) {
if (history->unreadCount()) {
readServerHistoryForce(history);