mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix resetting all sessions.
This commit is contained in:
parent
6b5c422e95
commit
00fac70140
2 changed files with 15 additions and 8 deletions
|
@ -125,13 +125,20 @@ void Authorizations::requestTerminate(
|
||||||
Fn<void(const MTPBool &result)> &&done,
|
Fn<void(const MTPBool &result)> &&done,
|
||||||
Fn<void(const RPCError &error)> &&fail,
|
Fn<void(const RPCError &error)> &&fail,
|
||||||
std::optional<uint64> hash) {
|
std::optional<uint64> hash) {
|
||||||
auto request = hash
|
const auto send = [&](auto request) {
|
||||||
? MTPaccount_ResetAuthorization(MTP_long(*hash))
|
_api.request(
|
||||||
: MTPaccount_ResetAuthorization();
|
std::move(request)
|
||||||
_api.request(std::move(request))
|
).done(
|
||||||
.done(std::move(done))
|
std::move(done)
|
||||||
.fail(std::move(fail))
|
).fail(
|
||||||
.send();
|
std::move(fail)
|
||||||
|
).send();
|
||||||
|
};
|
||||||
|
if (hash) {
|
||||||
|
send(MTPaccount_ResetAuthorization(MTP_long(*hash)));
|
||||||
|
} else {
|
||||||
|
send(MTPauth_ResetAuthorizations());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Authorizations::List Authorizations::list() const {
|
Authorizations::List Authorizations::list() const {
|
||||||
|
|
|
@ -292,7 +292,7 @@ void SessionsContent::terminateAll() {
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
const auto reset = crl::guard(weak, [=] {
|
const auto reset = crl::guard(weak, [=] {
|
||||||
_authorizations->cancelCurrentRequest();
|
_authorizations->cancelCurrentRequest();
|
||||||
shortPollSessions();
|
_authorizations->reload();
|
||||||
});
|
});
|
||||||
_authorizations->requestTerminate(
|
_authorizations->requestTerminate(
|
||||||
[=](const MTPBool &result) { reset(); },
|
[=](const MTPBool &result) { reset(); },
|
||||||
|
|
Loading…
Add table
Reference in a new issue