mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Correct stories count in the Info title.
This commit is contained in:
parent
5179d9a03f
commit
547a5a14df
3 changed files with 6 additions and 3 deletions
|
@ -330,8 +330,8 @@ State::State(not_null<Data::Stories*> data, Data::StorySourcesList list)
|
||||||
}
|
}
|
||||||
|
|
||||||
Content State::next() {
|
Content State::next() {
|
||||||
auto result = Content();
|
|
||||||
const auto &sources = _data->sources(_list);
|
const auto &sources = _data->sources(_list);
|
||||||
|
auto result = Content{ .total = int(sources.size()) };
|
||||||
result.elements.reserve(sources.size());
|
result.elements.reserve(sources.size());
|
||||||
for (const auto &info : sources) {
|
for (const auto &info : sources) {
|
||||||
const auto source = _data->source(info.id);
|
const auto source = _data->source(info.id);
|
||||||
|
@ -390,8 +390,10 @@ rpl::producer<Content> LastForPeer(not_null<PeerData*> peer) {
|
||||||
) | rpl::map([=] {
|
) | rpl::map([=] {
|
||||||
auto ids = std::vector<StoryId>();
|
auto ids = std::vector<StoryId>();
|
||||||
auto readTill = StoryId();
|
auto readTill = StoryId();
|
||||||
|
auto total = 0;
|
||||||
if (const auto source = stories->source(peerId)) {
|
if (const auto source = stories->source(peerId)) {
|
||||||
readTill = source->readTill;
|
readTill = source->readTill;
|
||||||
|
total = int(source->ids.size());
|
||||||
ids = ranges::views::all(source->ids)
|
ids = ranges::views::all(source->ids)
|
||||||
| ranges::views::reverse
|
| ranges::views::reverse
|
||||||
| ranges::views::take(kShownLastCount)
|
| ranges::views::take(kShownLastCount)
|
||||||
|
@ -420,7 +422,7 @@ rpl::producer<Content> LastForPeer(not_null<PeerData*> peer) {
|
||||||
}
|
}
|
||||||
auto done = true;
|
auto done = true;
|
||||||
auto resolving = false;
|
auto resolving = false;
|
||||||
auto result = Content{};
|
auto result = Content{ .total = total };
|
||||||
for (const auto id : ids) {
|
for (const auto id : ids) {
|
||||||
const auto storyId = FullStoryId{ peerId, id };
|
const auto storyId = FullStoryId{ peerId, id };
|
||||||
const auto maybe = stories->lookup(storyId);
|
const auto maybe = stories->lookup(storyId);
|
||||||
|
|
|
@ -49,6 +49,7 @@ struct Element {
|
||||||
|
|
||||||
struct Content {
|
struct Content {
|
||||||
std::vector<Element> elements;
|
std::vector<Element> elements;
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
friend inline bool operator==(
|
friend inline bool operator==(
|
||||||
const Content &a,
|
const Content &a,
|
||||||
|
|
|
@ -514,7 +514,7 @@ void TopBar::setStories(rpl::producer<Dialogs::Stories::Content> content) {
|
||||||
rpl::duplicate(
|
rpl::duplicate(
|
||||||
last
|
last
|
||||||
) | rpl::start_with_next([=](const Content &content) {
|
) | rpl::start_with_next([=](const Content &content) {
|
||||||
const auto count = int(content.elements.size());
|
const auto count = content.total;
|
||||||
if (_storiesCount != count) {
|
if (_storiesCount != count) {
|
||||||
const auto was = (_storiesCount > 0);
|
const auto was = (_storiesCount > 0);
|
||||||
_storiesCount = count;
|
_storiesCount = count;
|
||||||
|
|
Loading…
Add table
Reference in a new issue