mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show reactions in story viewers list.
This commit is contained in:
parent
13f67d68c4
commit
e6ad367c55
4 changed files with 11 additions and 8 deletions
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "api/api_who_reacted.h" // FormatReadDate.
|
#include "api/api_who_reacted.h" // FormatReadDate.
|
||||||
#include "chat_helpers/compose/compose_show.h"
|
#include "chat_helpers/compose/compose_show.h"
|
||||||
|
#include "data/stickers/data_custom_emoji.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "data/data_stories.h"
|
#include "data/data_stories.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
@ -258,7 +259,7 @@ void RecentViews::updateText() {
|
||||||
const auto text = _data.total
|
const auto text = _data.total
|
||||||
? (tr::lng_stories_views(tr::now, lt_count, _data.total)
|
? (tr::lng_stories_views(tr::now, lt_count, _data.total)
|
||||||
+ (_data.reactions
|
+ (_data.reactions
|
||||||
? (u" "_q + QChar(10084) + QString::number(_data.reactions))
|
? (u" "_q + QChar(10084) + QString::number(_data.reactions))
|
||||||
: QString()))
|
: QString()))
|
||||||
: tr::lng_stories_no_views(tr::now);
|
: tr::lng_stories_no_views(tr::now);
|
||||||
_text.setText(st::defaultTextStyle, text);
|
_text.setText(st::defaultTextStyle, text);
|
||||||
|
@ -281,6 +282,7 @@ void RecentViews::showMenu() {
|
||||||
_widget.get(),
|
_widget.get(),
|
||||||
st::storiesViewsMenu);
|
st::storiesViewsMenu);
|
||||||
auto count = 0;
|
auto count = 0;
|
||||||
|
const auto session = &_controller->story()->session();
|
||||||
const auto added = std::min(int(views.list.size()), kAddPerPage);
|
const auto added = std::min(int(views.list.size()), kAddPerPage);
|
||||||
const auto add = std::min(views.total, kAddPerPage);
|
const auto add = std::min(views.total, kAddPerPage);
|
||||||
const auto now = QDateTime::currentDateTime();
|
const auto now = QDateTime::currentDateTime();
|
||||||
|
@ -291,7 +293,7 @@ void RecentViews::showMenu() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (count++ < add) {
|
while (count++ < add) {
|
||||||
addMenuRowPlaceholder();
|
addMenuRowPlaceholder(session);
|
||||||
}
|
}
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
_controller->moreViewsLoaded(),
|
_controller->moreViewsLoaded(),
|
||||||
|
@ -366,7 +368,7 @@ void RecentViews::addMenuRow(Data::StoryView entry, const QDateTime &now) {
|
||||||
auto customEntityData = data.customEntityData;
|
auto customEntityData = data.customEntityData;
|
||||||
auto action = base::make_unique_q<Ui::WhoReactedEntryAction>(
|
auto action = base::make_unique_q<Ui::WhoReactedEntryAction>(
|
||||||
_menu->menu(),
|
_menu->menu(),
|
||||||
nullptr,
|
Data::ReactedMenuFactory(&entry.peer->session()),
|
||||||
_menu->menu()->st(),
|
_menu->menu()->st(),
|
||||||
prepare(view));
|
prepare(view));
|
||||||
const auto raw = action.get();
|
const auto raw = action.get();
|
||||||
|
@ -390,10 +392,10 @@ void RecentViews::addMenuRow(Data::StoryView entry, const QDateTime &now) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecentViews::addMenuRowPlaceholder() {
|
void RecentViews::addMenuRowPlaceholder(not_null<Main::Session*> session) {
|
||||||
auto action = base::make_unique_q<Ui::WhoReactedEntryAction>(
|
auto action = base::make_unique_q<Ui::WhoReactedEntryAction>(
|
||||||
_menu->menu(),
|
_menu->menu(),
|
||||||
nullptr,
|
Data::ReactedMenuFactory(session),
|
||||||
_menu->menu()->st(),
|
_menu->menu()->st(),
|
||||||
Ui::WhoReactedEntryData{ .preloader = true });
|
Ui::WhoReactedEntryData{ .preloader = true });
|
||||||
const auto raw = action.get();
|
const auto raw = action.get();
|
||||||
|
|
|
@ -70,7 +70,7 @@ private:
|
||||||
void showMenu();
|
void showMenu();
|
||||||
|
|
||||||
void addMenuRow(Data::StoryView entry, const QDateTime &now);
|
void addMenuRow(Data::StoryView entry, const QDateTime &now);
|
||||||
void addMenuRowPlaceholder();
|
void addMenuRowPlaceholder(not_null<Main::Session*> session);
|
||||||
void rebuildMenuTail();
|
void rebuildMenuTail();
|
||||||
void subscribeToMenuUserpicsLoading(not_null<Main::Session*> session);
|
void subscribeToMenuUserpicsLoading(not_null<Main::Session*> session);
|
||||||
void refreshClickHandler();
|
void refreshClickHandler();
|
||||||
|
|
|
@ -778,8 +778,9 @@ storiesViewsMenu: PopupMenu(storiesPopupMenuWithIcons) {
|
||||||
scrollPadding: margins(0px, 6px, 0px, 4px);
|
scrollPadding: margins(0px, 6px, 0px, 4px);
|
||||||
maxHeight: 320px;
|
maxHeight: 320px;
|
||||||
menu: Menu(storiesMenuWithIcons) {
|
menu: Menu(storiesMenuWithIcons) {
|
||||||
|
itemPadding: margins(54px, 8px, 17px, 8px);
|
||||||
widthMin: 215px;
|
widthMin: 215px;
|
||||||
widthMax: 215px;
|
widthMax: 250px;
|
||||||
}
|
}
|
||||||
radius: 7px;
|
radius: 7px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,7 +617,7 @@ void WhoReactedEntryAction::paint(Painter &&p) {
|
||||||
.textColor = (selected ? _st.itemFgOver : _st.itemFg)->c,
|
.textColor = (selected ? _st.itemFgOver : _st.itemFg)->c,
|
||||||
.now = crl::now(),
|
.now = crl::now(),
|
||||||
.position = QPoint(
|
.position = QPoint(
|
||||||
width() - _st.itemPadding.right() - (size / ratio) + skip,
|
width() - _st.itemPadding.right() - size + skip,
|
||||||
(height() - _customSize) / 2),
|
(height() - _customSize) / 2),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue