mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Update API scheme for phone log clearing.
This commit is contained in:
parent
52000566cf
commit
ce5c19dfe9
4 changed files with 40 additions and 17 deletions
|
@ -1212,6 +1212,8 @@ messages.historyImport#1662af0b id:long = messages.HistoryImport;
|
|||
|
||||
messages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed;
|
||||
|
||||
messages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector<int> = messages.AffectedFoundMessages;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
|
@ -1462,7 +1464,7 @@ messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.Disc
|
|||
messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool;
|
||||
messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;
|
||||
messages.deleteChat#83247d11 chat_id:int = Bool;
|
||||
messages.deletePhoneCallHistory#6cff1b45 flags:# revoke:flags.0?true = messages.AffectedHistory;
|
||||
messages.deletePhoneCallHistory#f9cbe409 flags:# revoke:flags.0?true = messages.AffectedFoundMessages;
|
||||
messages.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed;
|
||||
messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport;
|
||||
messages.uploadImportedMedia#2a862092 peer:InputPeer import_id:long file_name:string media:InputMedia = MessageMedia;
|
||||
|
|
|
@ -375,6 +375,9 @@ public:
|
|||
_delegate = delegate;
|
||||
prepare();
|
||||
}
|
||||
[[nodiscard]] not_null<PeerListDelegate*> delegate() const {
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
void setStyleOverrides(
|
||||
const style::PeerList *listSt,
|
||||
|
@ -453,9 +456,6 @@ public:
|
|||
virtual ~PeerListController() = default;
|
||||
|
||||
protected:
|
||||
not_null<PeerListDelegate*> delegate() const {
|
||||
return _delegate;
|
||||
}
|
||||
PeerListSearchController *searchController() const {
|
||||
return _searchController.get();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_media_types.h"
|
||||
#include "data/data_user.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "api/api_updates.h"
|
||||
#include "app.h"
|
||||
#include "apiwrap.h"
|
||||
#include "styles/style_layers.h" // st::boxLabel.
|
||||
|
@ -504,16 +506,30 @@ void ClearCallsBox(
|
|||
using Flag = MTPmessages_DeletePhoneCallHistory::Flag;
|
||||
api->request(MTPmessages_DeletePhoneCallHistory(
|
||||
MTP_flags(revoke ? Flag::f_revoke : Flag(0))
|
||||
)).done([=](const MTPmessages_AffectedHistory &result) {
|
||||
const auto offset = api->applyAffectedHistory(nullptr, result);
|
||||
if (offset > 0) {
|
||||
self(revoke, self);
|
||||
} else {
|
||||
api->session().data().destroyAllCallItems();
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->closeBox();
|
||||
)).done([=](const MTPmessages_AffectedFoundMessages &result) {
|
||||
result.match([&](
|
||||
const MTPDmessages_affectedFoundMessages &data) {
|
||||
api->applyUpdates(MTP_updates(
|
||||
MTP_vector<MTPUpdate>(
|
||||
1,
|
||||
MTP_updateDeleteMessages(
|
||||
data.vmessages(),
|
||||
data.vpts(),
|
||||
data.vpts_count())),
|
||||
MTP_vector<MTPUser>(),
|
||||
MTP_vector<MTPChat>(),
|
||||
MTP_int(base::unixtime::now()),
|
||||
MTP_int(0)));
|
||||
const auto offset = data.voffset().v;
|
||||
if (offset > 0) {
|
||||
self(revoke, self);
|
||||
} else {
|
||||
api->session().data().destroyAllCallItems();
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}).send();
|
||||
};
|
||||
|
||||
|
|
|
@ -99,7 +99,10 @@ constexpr auto kMinDiffIntensity = 0.25;
|
|||
|
||||
void ShowCallsBox(not_null<Window::SessionController*> window) {
|
||||
auto controller = std::make_unique<Calls::BoxController>(window);
|
||||
const auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
const auto initBox = [
|
||||
window,
|
||||
controller = controller.get()
|
||||
](not_null<PeerListBox*> box) {
|
||||
box->addButton(tr::lng_close(), [=] {
|
||||
box->closeBox();
|
||||
});
|
||||
|
@ -119,9 +122,11 @@ void ShowCallsBox(not_null<Window::SessionController*> window) {
|
|||
(*menu)->addAction(
|
||||
tr::lng_settings_section_call_settings(tr::now),
|
||||
showSettings);
|
||||
(*menu)->addAction(
|
||||
tr::lng_call_box_clear_all(tr::now),
|
||||
clearAll);
|
||||
if (controller->delegate()->peerListFullRowsCount() > 0) {
|
||||
(*menu)->addAction(
|
||||
tr::lng_call_box_clear_all(tr::now),
|
||||
clearAll);
|
||||
}
|
||||
(*menu)->popup(QCursor::pos());
|
||||
return true;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue