mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
feat: User Messages
Co-authored-by: RadRussianRus <radrussianrus@gmail.com>
This commit is contained in:
parent
dc94f02345
commit
e4e6fb14c7
11 changed files with 56 additions and 12 deletions
|
@ -4596,7 +4596,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_SpyEssentialsHeader" = "Spy essentials";
|
||||
"ayu_SaveDeletedMessages" = "Save deleted messages";
|
||||
"ayu_SaveMessagesHistory" = "Save edits history";
|
||||
"ayu_MessageSavingBtn" = "Message Saving Preferences";
|
||||
"ayu_MessageSavingActionBarHeader" = "Message Saving Preferences";
|
||||
"ayu_MessageSavingBtn" = "Preferences";
|
||||
"ayu_MessageSavingSubTitle" = "Configure media & per dialog saving";
|
||||
"ayu_MessageSavingMediaHeader" = "Media";
|
||||
"ayu_MessageSavingSaveMedia" = "Save media";
|
||||
"ayu_MessageSavingSaveMediaHint" = "Click for more";
|
||||
|
@ -4611,6 +4613,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_MessageSavingSaveFormatting" = "Save formatting";
|
||||
"ayu_MessageSavingSaveReactions" = "Save reactions";
|
||||
"ayu_MessageSavingSaveForBots" = "Save in bot dialogs";
|
||||
"ayu_SpyAllToggle" = "Spy on people";
|
||||
"ayu_SpySaveReadMarks" = "Save read date";
|
||||
"ayu_SpySaveLastActivity" = "Save last activity";
|
||||
"ayu_QoLTogglesHeader" = "Useful features";
|
||||
"ayu_KeepAliveService" = "AyuGram Push Service";
|
||||
"ayu_DisableAds" = "Disable ads";
|
||||
|
@ -4644,6 +4649,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_CaseInsensitiveExpression" = "Case insensitive expression";
|
||||
"ayu_RegexFiltersAddError" = "Regex syntax error";
|
||||
"ayu_RegexFilterQuickAdd" = "Add filter";
|
||||
"ayu_RegexFilterBulletinText" = "Filter added to the **Shared filters**.";
|
||||
"ayu_RegexFilterBulletinAction" = "Move to current chat";
|
||||
"ayu_AyuSyncHeader" = "AyuSync";
|
||||
"ayu_AyuSyncStatusTitle" = "Sync status";
|
||||
"ayu_AyuSyncStatusOk" = "connected";
|
||||
|
@ -4703,6 +4710,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_ViewFiltersMenuText" = "View Filters";
|
||||
"ayu_PeekOnlineSuccess" = "Peeked via";
|
||||
"ayu_OneViewTTL" = "one view";
|
||||
"ayu_UserMessagesMenuText" = "User Messages";
|
||||
"ayu_ReadUntilMenuText" = "Read Message";
|
||||
"ayu_DeleteKeepLocally" = "Keep locally";
|
||||
"ayu_BoxActionReset" = "Reset";
|
||||
|
@ -4731,6 +4739,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_AyuForwardForwardingDescription" = "Please keep this window open while AyuGram is forwarding your messages.";
|
||||
"ayu_AyuForwardLoadingMediaDescription" = "Please keep this window open while AyuGram is downloading media from your messages.";
|
||||
"ayu_DeleteDateMenuText" = "Delete Date";
|
||||
"ayu_ReadDateMenuText" = "Read Date";
|
||||
"ayu_ContentsReadDateMenuText" = "Contents Read Date";
|
||||
"ayu_ForwardableMenuText" = "Forwardable";
|
||||
"ayu_ForwardableMenuTextNo" = "No";
|
||||
"ayu_LikelyOfflineStatus" = "offline ?";
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "ayu/messages/ayu_messages_controller.h"
|
||||
#include "ayu/ui/boxes/message_history_box.h"
|
||||
|
||||
#include "mainwidget.h"
|
||||
#include "styles/style_ayu_icons.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
|
||||
|
@ -27,7 +28,7 @@ void AddHistoryAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item)
|
|||
{
|
||||
item->history()->session().tryResolveWindow()
|
||||
->showSection(std::make_shared<EditedLog::SectionMemento>(item->history()->peer, item));
|
||||
}, &st::ayuEditsHistoryIcon);
|
||||
}, &st::ayuEditsHistoryIcon);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,6 +47,26 @@ void AddHideMessageAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item)
|
|||
// }, &st::menuIconClear);
|
||||
}
|
||||
|
||||
void AddUserMessagesAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item)
|
||||
{
|
||||
if (item->history()->peer->isChat() || item->history()->peer->isMegagroup()) {
|
||||
menu->addAction(tr::ayu_UserMessagesMenuText(tr::now), [=]
|
||||
{
|
||||
if (const auto window = item->history()->session().tryResolveWindow()) {
|
||||
if (const auto mainWidget = window->widget()->sessionController()) {
|
||||
const auto peer = item->history()->peer;
|
||||
const auto key = (peer && !peer->isUser())
|
||||
? item->topic()
|
||||
? Dialogs::Key{item->topic()}
|
||||
: Dialogs::Key{item->history()}
|
||||
: Dialogs::Key();
|
||||
mainWidget->content()->searchMessages("", key, item->from()->asUser());
|
||||
}
|
||||
}
|
||||
}, &st::menuIconInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void AddReadUntilAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item)
|
||||
{
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
|
|
|
@ -87,6 +87,8 @@ void AddHistoryAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
|||
|
||||
void AddHideMessageAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
||||
|
||||
void AddUserMessagesAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
||||
|
||||
void AddReadUntilAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
||||
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ bool accountExists(ID userId)
|
|||
return userId == 0 || getSession(userId) != nullptr;
|
||||
}
|
||||
|
||||
void dispatchToMainThread(std::function<void()> callback)
|
||||
void dispatchToMainThread(std::function<void()> callback, int delay)
|
||||
{
|
||||
auto timer = new QTimer();
|
||||
timer->moveToThread(qApp->thread());
|
||||
|
@ -100,7 +100,7 @@ void dispatchToMainThread(std::function<void()> callback)
|
|||
callback();
|
||||
timer->deleteLater();
|
||||
});
|
||||
QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, 0));
|
||||
QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, delay));
|
||||
}
|
||||
|
||||
not_null<History *> getHistoryFromDialogId(ID dialogId, Main::Session *session)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
Main::Session *getSession(ID userId);
|
||||
bool accountExists(ID userId);
|
||||
void dispatchToMainThread(std::function<void()> callback);
|
||||
void dispatchToMainThread(std::function<void()> callback, int delay = 0);
|
||||
not_null<History *> getHistoryFromDialogId(ID dialogId, Main::Session *session);
|
||||
ID getDialogIdFromPeer(not_null<PeerData *> peer);
|
||||
std::pair<std::string, std::string> serializeTextWithEntities(not_null<HistoryItem *> item);
|
||||
|
|
|
@ -1901,13 +1901,13 @@ void Widget::showMainMenu() {
|
|||
controller()->widget()->showMainMenu();
|
||||
}
|
||||
|
||||
void Widget::searchMessages(const QString &query, Key inChat) {
|
||||
void Widget::searchMessages(const QString &query, Key inChat, UserData *from) {
|
||||
if (_childList) {
|
||||
const auto forum = controller()->shownForum().current();
|
||||
const auto topic = inChat.topic();
|
||||
if ((forum && forum->channel() == inChat.peer())
|
||||
|| (topic && topic->forum() == forum)) {
|
||||
_childList->searchMessages(query, inChat);
|
||||
_childList->searchMessages(query, inChat, from);
|
||||
return;
|
||||
}
|
||||
hideChildList();
|
||||
|
@ -1949,6 +1949,11 @@ void Widget::searchMessages(const QString &query, Key inChat) {
|
|||
|
||||
session().local().saveRecentSearchHashtags(query);
|
||||
}
|
||||
|
||||
if (inChat && from) {
|
||||
setSearchInChat(inChat, from);
|
||||
applyFilterUpdate(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::searchTopics() {
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
void scrollToEntry(const RowDescriptor &entry);
|
||||
|
||||
void searchMessages(const QString &query, Key inChat = {});
|
||||
void searchMessages(const QString &query, Key inChat = {}, UserData *from = nullptr);
|
||||
void searchTopics();
|
||||
void searchMore();
|
||||
|
||||
|
|
|
@ -2262,6 +2262,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
|
||||
AyuUi::AddHistoryAction(_menu, item);
|
||||
AyuUi::AddHideMessageAction(_menu, item);
|
||||
AyuUi::AddUserMessagesAction(_menu, item);
|
||||
};
|
||||
const auto addPhotoActions = [&](not_null<PhotoData*> photo, HistoryItem *item) {
|
||||
const auto media = photo->activeMediaView();
|
||||
|
|
|
@ -960,6 +960,7 @@ void AddMessageActions(
|
|||
if (request.item) {
|
||||
AyuUi::AddHistoryAction(menu, request.item);
|
||||
AyuUi::AddHideMessageAction(menu, request.item);
|
||||
AyuUi::AddUserMessagesAction(menu, request.item);
|
||||
}
|
||||
|
||||
AddPostLinkAction(menu, request);
|
||||
|
|
|
@ -88,6 +88,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/utils/telegram_helpers.h"
|
||||
|
||||
|
||||
enum StackItemType {
|
||||
HistoryStackItem,
|
||||
SectionStackItem,
|
||||
|
@ -718,9 +722,9 @@ void MainWidget::hideSingleUseKeyboard(FullMsgId replyToId) {
|
|||
_history->hideSingleUseKeyboard(replyToId);
|
||||
}
|
||||
|
||||
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
|
||||
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat, UserData *from) {
|
||||
if (controller()->isPrimary()) {
|
||||
_dialogs->searchMessages(query, inChat);
|
||||
_dialogs->searchMessages(query, inChat, from);
|
||||
if (isOneColumn()) {
|
||||
_controller->clearSectionStack();
|
||||
} else {
|
||||
|
@ -729,7 +733,7 @@ void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
|
|||
} else {
|
||||
const auto searchIn = [&](not_null<Window::Controller*> window) {
|
||||
if (const auto controller = window->sessionController()) {
|
||||
controller->content()->searchMessages(query, inChat);
|
||||
controller->content()->searchMessages(query, inChat, from);
|
||||
controller->widget()->activate();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -186,7 +186,7 @@ public:
|
|||
void sendBotCommand(Bot::SendCommandRequest request);
|
||||
void hideSingleUseKeyboard(FullMsgId replyToId);
|
||||
|
||||
void searchMessages(const QString &query, Dialogs::Key inChat);
|
||||
void searchMessages(const QString &query, Dialogs::Key inChat, UserData *from = nullptr);
|
||||
|
||||
void setChatBackground(
|
||||
const Data::WallPaper &background,
|
||||
|
|
Loading…
Add table
Reference in a new issue