Update API scheme for phone log clearing.
This commit is contained in:
parent
52000566cf
commit
ce5c19dfe9
|
@ -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.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---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
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.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool;
|
||||||
messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;
|
messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;
|
||||||
messages.deleteChat#83247d11 chat_id:int = Bool;
|
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.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed;
|
||||||
messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport;
|
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;
|
messages.uploadImportedMedia#2a862092 peer:InputPeer import_id:long file_name:string media:InputMedia = MessageMedia;
|
||||||
|
|
|
@ -375,6 +375,9 @@ public:
|
||||||
_delegate = delegate;
|
_delegate = delegate;
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] not_null<PeerListDelegate*> delegate() const {
|
||||||
|
return _delegate;
|
||||||
|
}
|
||||||
|
|
||||||
void setStyleOverrides(
|
void setStyleOverrides(
|
||||||
const style::PeerList *listSt,
|
const style::PeerList *listSt,
|
||||||
|
@ -453,9 +456,6 @@ public:
|
||||||
virtual ~PeerListController() = default;
|
virtual ~PeerListController() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
not_null<PeerListDelegate*> delegate() const {
|
|
||||||
return _delegate;
|
|
||||||
}
|
|
||||||
PeerListSearchController *searchController() const {
|
PeerListSearchController *searchController() const {
|
||||||
return _searchController.get();
|
return _searchController.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_media_types.h"
|
#include "data/data_media_types.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
|
#include "base/unixtime.h"
|
||||||
|
#include "api/api_updates.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "styles/style_layers.h" // st::boxLabel.
|
#include "styles/style_layers.h" // st::boxLabel.
|
||||||
|
@ -504,8 +506,21 @@ void ClearCallsBox(
|
||||||
using Flag = MTPmessages_DeletePhoneCallHistory::Flag;
|
using Flag = MTPmessages_DeletePhoneCallHistory::Flag;
|
||||||
api->request(MTPmessages_DeletePhoneCallHistory(
|
api->request(MTPmessages_DeletePhoneCallHistory(
|
||||||
MTP_flags(revoke ? Flag::f_revoke : Flag(0))
|
MTP_flags(revoke ? Flag::f_revoke : Flag(0))
|
||||||
)).done([=](const MTPmessages_AffectedHistory &result) {
|
)).done([=](const MTPmessages_AffectedFoundMessages &result) {
|
||||||
const auto offset = api->applyAffectedHistory(nullptr, 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) {
|
if (offset > 0) {
|
||||||
self(revoke, self);
|
self(revoke, self);
|
||||||
} else {
|
} else {
|
||||||
|
@ -514,6 +529,7 @@ void ClearCallsBox(
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,10 @@ constexpr auto kMinDiffIntensity = 0.25;
|
||||||
|
|
||||||
void ShowCallsBox(not_null<Window::SessionController*> window) {
|
void ShowCallsBox(not_null<Window::SessionController*> window) {
|
||||||
auto controller = std::make_unique<Calls::BoxController>(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->addButton(tr::lng_close(), [=] {
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
});
|
});
|
||||||
|
@ -119,9 +122,11 @@ void ShowCallsBox(not_null<Window::SessionController*> window) {
|
||||||
(*menu)->addAction(
|
(*menu)->addAction(
|
||||||
tr::lng_settings_section_call_settings(tr::now),
|
tr::lng_settings_section_call_settings(tr::now),
|
||||||
showSettings);
|
showSettings);
|
||||||
|
if (controller->delegate()->peerListFullRowsCount() > 0) {
|
||||||
(*menu)->addAction(
|
(*menu)->addAction(
|
||||||
tr::lng_call_box_clear_all(tr::now),
|
tr::lng_call_box_clear_all(tr::now),
|
||||||
clearAll);
|
clearAll);
|
||||||
|
}
|
||||||
(*menu)->popup(QCursor::pos());
|
(*menu)->popup(QCursor::pos());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue