mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-18 17:40:59 +00:00
Fix restoring shared media state.
This commit is contained in:
parent
fc66550a32
commit
3a25313e61
@ -150,13 +150,17 @@ base::optional<int> SparseIdsMergedSlice::distance(
|
||||
}
|
||||
|
||||
auto SparseIdsMergedSlice::nearest(
|
||||
UniversalMsgId id) const -> base::optional<UniversalMsgId> {
|
||||
auto convertFromMigratedNearest = [](MsgId result) {
|
||||
return result - ServerMaxMsgId;
|
||||
UniversalMsgId id) const -> base::optional<FullMsgId> {
|
||||
auto convertFromPartNearest = [&](MsgId result) {
|
||||
return ComputeId(_key.peerId, result);
|
||||
};
|
||||
auto convertFromMigratedNearest = [&](MsgId result) {
|
||||
return ComputeId(_key.migratedPeerId, result);
|
||||
};
|
||||
if (IsServerMsgId(id)) {
|
||||
if (auto partNearestId = _part.nearest(id)) {
|
||||
return partNearestId;
|
||||
return partNearestId
|
||||
| convertFromPartNearest;
|
||||
} else if (isolatedInPart()) {
|
||||
return base::none;
|
||||
}
|
||||
@ -171,7 +175,8 @@ auto SparseIdsMergedSlice::nearest(
|
||||
} else if (isolatedInMigrated()) {
|
||||
return base::none;
|
||||
}
|
||||
return _part.nearest(0);
|
||||
return _part.nearest(0)
|
||||
| convertFromPartNearest;
|
||||
}
|
||||
|
||||
SparseIdsSliceBuilder::SparseIdsSliceBuilder(
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
int size() const;
|
||||
FullMsgId operator[](int index) const;
|
||||
base::optional<int> distance(const Key &a, const Key &b) const;
|
||||
base::optional<UniversalMsgId> nearest(UniversalMsgId id) const;
|
||||
base::optional<FullMsgId> nearest(UniversalMsgId id) const;
|
||||
|
||||
using SimpleViewerFunction = rpl::producer<SparseIdsSlice>(
|
||||
PeerId peerId,
|
||||
|
@ -773,15 +773,16 @@ SparseIdsMergedSlice::Key ListWidget::sliceKey(
|
||||
|
||||
void ListWidget::refreshViewer() {
|
||||
_viewerLifetime.destroy();
|
||||
auto idForViewer = sliceKey(_universalAroundId).universalId;
|
||||
_controller->mediaSource(
|
||||
sliceKey(_universalAroundId).universalId,
|
||||
idForViewer,
|
||||
_idsLimit,
|
||||
_idsLimit)
|
||||
| rpl::start_with_next([this](
|
||||
| rpl::start_with_next([=](
|
||||
SparseIdsMergedSlice &&slice) {
|
||||
_slice = std::move(slice);
|
||||
if (auto nearest = _slice.nearest(_universalAroundId)) {
|
||||
_universalAroundId = *nearest;
|
||||
if (auto nearest = _slice.nearest(idForViewer)) {
|
||||
_universalAroundId = GetUniversalId(*nearest);
|
||||
}
|
||||
refreshRows();
|
||||
}, _viewerLifetime);
|
||||
|
@ -32,7 +32,7 @@ windowShadowShift: 1px;
|
||||
|
||||
columnMinimalWidthLeft: 260px;
|
||||
columnMinimalWidthMain: 380px;
|
||||
columnMinimalWidthThird: 292px;//345px;
|
||||
columnMinimalWidthThird: 345px;//292px;//345px;
|
||||
|
||||
adaptiveChatWideWidth: 880px;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user