2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Closed beta 1.2.8.5.

This commit is contained in:
John Preston
2018-02-07 19:37:05 +03:00
parent 99c686e3e1
commit f23c23f696
10 changed files with 55 additions and 46 deletions

View File

@@ -3068,6 +3068,10 @@ void ApiWrap::requestFeedMessages(
feedMessagesDone(feed, messageId, slice, result);
}).fail([=](const RPCError &error) {
_feedMessagesRequests.remove(key);
if (error.type() == qstr("SOURCES_HASH_INVALID")) {
_feedMessagesRequestsPending.emplace(key);
requestFeedChannels(feed);
}
}).send();
_feedMessagesRequests.emplace(key);
}

View File

@@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/utils.h"
#define BETA_VERSION_MACRO (1002008004ULL)
#define BETA_VERSION_MACRO (1002008005ULL)
constexpr int AppVersion = 1002008;
constexpr str_const AppVersionStr = "1.2.8";

View File

@@ -165,11 +165,12 @@ const std::vector<not_null<History*>> &Feed::channels() const {
}
int32 Feed::channelsHash() const {
return Api::CountHash(ranges::view::all(
const auto ordered = ranges::view::all(
_channels
) | ranges::view::transform([](not_null<History*> history) {
return history->peer->bareId();
}));
}) | ranges::to_vector | ranges::action::sort;
return Api::CountHash(ordered);
}
bool Feed::channelsLoaded() const {
@@ -177,7 +178,10 @@ bool Feed::channelsLoaded() const {
}
void Feed::setChannelsLoaded(bool loaded) {
_channelsLoaded = loaded;
if (_channelsLoaded != loaded) {
_channelsLoaded = loaded;
_parent->notifyFeedUpdated(this, FeedUpdateFlag::Channels);
}
}
void Feed::setChannels(std::vector<not_null<ChannelData*>> channels) {
@@ -219,9 +223,7 @@ void Feed::setChannels(std::vector<not_null<ChannelData*>> channels) {
_channels.push_back(App::history(channel));
}
_channelsLoaded = true;
_parent->notifyFeedUpdated(this, FeedUpdateFlag::Channels);
setChannelsLoaded(true);
}
bool Feed::justUpdateLastMessage(not_null<HistoryItem*> item) {
@@ -326,6 +328,10 @@ void Feed::applyDialog(const MTPDdialogFeed &data) {
if (data.has_read_max_position()) {
setUnreadPosition(FeedPositionFromMTP(data.vread_max_position));
}
if (channelsHash() != data.vsources_hash.v) {
setChannelsLoaded(false);
}
}
void Feed::setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount) {

View File

@@ -40,26 +40,26 @@ object_ptr<Ui::RpWidget> InnerWidget::setupContent(
_cover = result->add(object_ptr<Cover>(
result,
_controller));
auto details = Profile::SetupFeedDetails(_controller, parent, _feed);
result->add(std::move(details));
result->add(object_ptr<BoxContentDivider>(result));
//auto details = Profile::SetupFeedDetails(_controller, parent, _feed);
//result->add(std::move(details));
//result->add(object_ptr<BoxContentDivider>(result));
_channels = result->add(object_ptr<Channels>(
result,
_controller)
);
_channels->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
auto min = (request.ymin < 0)
? request.ymin
: mapFromGlobal(_channels->mapToGlobal({ 0, request.ymin })).y();
auto max = (request.ymin < 0)
? mapFromGlobal(_channels->mapToGlobal({ 0, 0 })).y()
: (request.ymax < 0)
? request.ymax
: mapFromGlobal(_channels->mapToGlobal({ 0, request.ymax })).y();
_scrollToRequests.fire({ min, max });
}, _channels->lifetime());
//_channels = result->add(object_ptr<Channels>(
// result,
// _controller)
//);
//_channels->scrollToRequests(
//) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
// auto min = (request.ymin < 0)
// ? request.ymin
// : mapFromGlobal(_channels->mapToGlobal({ 0, request.ymin })).y();
// auto max = (request.ymin < 0)
// ? mapFromGlobal(_channels->mapToGlobal({ 0, 0 })).y()
// : (request.ymax < 0)
// ? request.ymax
// : mapFromGlobal(_channels->mapToGlobal({ 0, request.ymax })).y();
// _scrollToRequests.fire({ min, max });
//}, _channels->lifetime());
return std::move(result);
}

View File

@@ -97,4 +97,3 @@ void Widget::restoreState(not_null<Memento*> memento) {
} // namespace Members
} // namespace Info