mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 16:03:03 +02:00
Better entry point for Direct Messages.
This commit is contained in:
parent
cd05586d51
commit
6c80d443b9
4 changed files with 22 additions and 37 deletions
|
@ -1491,6 +1491,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_profile_hide_participants_about" = "Switch this on to hide the list of members in this group. Admins will remain visible.";
|
"lng_profile_hide_participants_about" = "Switch this on to hide the list of members in this group. Admins will remain visible.";
|
||||||
"lng_profile_view_channel" = "View Channel";
|
"lng_profile_view_channel" = "View Channel";
|
||||||
"lng_profile_view_discussion" = "View discussion";
|
"lng_profile_view_discussion" = "View discussion";
|
||||||
|
"lng_profile_direct_messages" = "Direct messages";
|
||||||
"lng_profile_join_channel" = "Join Channel";
|
"lng_profile_join_channel" = "Join Channel";
|
||||||
"lng_profile_join_group" = "Join Group";
|
"lng_profile_join_group" = "Join Group";
|
||||||
"lng_profile_apply_to_join_group" = "Apply to Join Group";
|
"lng_profile_apply_to_join_group" = "Apply to Join Group";
|
||||||
|
|
|
@ -445,7 +445,6 @@ void SavedSublist::setInboxReadTill(
|
||||||
&& _inboxReadTillId >= _list.front()) {
|
&& _inboxReadTillId >= _list.front()) {
|
||||||
unreadCount = 0;
|
unreadCount = 0;
|
||||||
}
|
}
|
||||||
const auto wasUnreadCount = _unreadCount;
|
|
||||||
if (_unreadCount.current() != unreadCount
|
if (_unreadCount.current() != unreadCount
|
||||||
&& (changed || unreadCount.has_value())) {
|
&& (changed || unreadCount.has_value())) {
|
||||||
setUnreadCount(unreadCount);
|
setUnreadCount(unreadCount);
|
||||||
|
@ -593,24 +592,7 @@ std::optional<int> SavedSublist::computeUnreadCountLocally(
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavedSublist::requestUnreadCount() {
|
void SavedSublist::requestUnreadCount() {
|
||||||
if (_reloadUnreadCountRequestId) {
|
parent()->requestSublist(sublistPeer());
|
||||||
return;
|
|
||||||
}
|
|
||||||
//const auto weak = base::make_weak(this); // #TODO monoforum
|
|
||||||
//const auto session = &_parent->session();
|
|
||||||
//const auto apply = [weak](MsgId readTill, int unreadCount) {
|
|
||||||
// if (const auto strong = weak.get()) {
|
|
||||||
// strong->setInboxReadTill(readTill, unreadCount);
|
|
||||||
// }
|
|
||||||
//};
|
|
||||||
//_reloadUnreadCountRequestId = session->api().request(
|
|
||||||
// ...
|
|
||||||
//).done([=](const ... &result) {
|
|
||||||
// if (weak) {
|
|
||||||
// _reloadUnreadCountRequestId = 0;
|
|
||||||
// }
|
|
||||||
// ...
|
|
||||||
//}).send();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavedSublist::readTill(not_null<HistoryItem*> item) {
|
void SavedSublist::readTill(not_null<HistoryItem*> item) {
|
||||||
|
|
|
@ -2188,24 +2188,6 @@ Ui::MultiSlideTracker DetailsFiller::fillChannelButtons(
|
||||||
std::move(viewChannel),
|
std::move(viewChannel),
|
||||||
tracker);
|
tracker);
|
||||||
|
|
||||||
auto viewDirectVisible = channel->flagsValue() | rpl::map([=] {
|
|
||||||
return channel->monoforumLink() != nullptr;
|
|
||||||
}) | rpl::distinct_until_changed();
|
|
||||||
auto viewDirect = [=] {
|
|
||||||
if (const auto linked = channel->monoforumLink()) {
|
|
||||||
window->showPeerHistory(linked);
|
|
||||||
//if (const auto monoforum = linked->monoforum()) {
|
|
||||||
// window->showMonoforum(monoforum);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
AddMainButton( // #TODO monoforum
|
|
||||||
_wrap,
|
|
||||||
rpl::single(u"View Direct Messages"_q),
|
|
||||||
std::move(viewDirectVisible),
|
|
||||||
std::move(viewDirect),
|
|
||||||
tracker);
|
|
||||||
|
|
||||||
return tracker;
|
return tracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,6 +293,7 @@ private:
|
||||||
void addThemeEdit();
|
void addThemeEdit();
|
||||||
void addBlockUser();
|
void addBlockUser();
|
||||||
void addViewDiscussion();
|
void addViewDiscussion();
|
||||||
|
void addDirectMessages();
|
||||||
void addToggleTopicClosed();
|
void addToggleTopicClosed();
|
||||||
void addExportChat();
|
void addExportChat();
|
||||||
void addTranslate();
|
void addTranslate();
|
||||||
|
@ -872,6 +873,23 @@ void Filler::addViewDiscussion() {
|
||||||
}, &st::menuIconDiscussion);
|
}, &st::menuIconDiscussion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Filler::addDirectMessages() {
|
||||||
|
const auto channel = _peer->asBroadcast();
|
||||||
|
if (!channel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto monoforum = channel->broadcastMonoforum();
|
||||||
|
if (!monoforum || !monoforum->amMonoforumAdmin()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto navigation = _controller;
|
||||||
|
_addAction(tr::lng_profile_direct_messages(tr::now), [=] {
|
||||||
|
navigation->showPeerHistory(
|
||||||
|
monoforum,
|
||||||
|
Window::SectionShow::Way::Forward);
|
||||||
|
}, &st::menuIconChatDiscuss);
|
||||||
|
}
|
||||||
|
|
||||||
void Filler::addExportChat() {
|
void Filler::addExportChat() {
|
||||||
if (_thread->asTopic() || !_peer->canExportChatHistory()) {
|
if (_thread->asTopic() || !_peer->canExportChatHistory()) {
|
||||||
return;
|
return;
|
||||||
|
@ -1461,6 +1479,7 @@ void Filler::fillHistoryActions() {
|
||||||
addCreatePoll();
|
addCreatePoll();
|
||||||
addThemeEdit();
|
addThemeEdit();
|
||||||
addViewDiscussion();
|
addViewDiscussion();
|
||||||
|
addDirectMessages();
|
||||||
addExportChat();
|
addExportChat();
|
||||||
addTranslate();
|
addTranslate();
|
||||||
addReport();
|
addReport();
|
||||||
|
@ -1485,6 +1504,7 @@ void Filler::fillProfileActions() {
|
||||||
addManageTopic();
|
addManageTopic();
|
||||||
addToggleTopicClosed();
|
addToggleTopicClosed();
|
||||||
addViewDiscussion();
|
addViewDiscussion();
|
||||||
|
addDirectMessages();
|
||||||
addExportChat();
|
addExportChat();
|
||||||
addToggleFolder();
|
addToggleFolder();
|
||||||
addBlockUser();
|
addBlockUser();
|
||||||
|
|
Loading…
Add table
Reference in a new issue