mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Remove some more Auth() calls.
This commit is contained in:
parent
bede709f6b
commit
3878a1b212
67 changed files with 380 additions and 299 deletions
|
@ -1060,7 +1060,7 @@ void ApiWrap::requestWallPaper(
|
|||
)).done([=](const MTPWallPaper &result) {
|
||||
_wallPaperRequestId = 0;
|
||||
_wallPaperSlug = QString();
|
||||
if (const auto paper = Data::WallPaper::Create(result)) {
|
||||
if (const auto paper = Data::WallPaper::Create(&session(), result)) {
|
||||
if (const auto done = base::take(_wallPaperDone)) {
|
||||
done(*paper);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,9 @@ int Style::minButtonWidth(HistoryMessageMarkupButton::Type type) const {
|
|||
|
||||
} // namespace
|
||||
|
||||
BotKeyboard::BotKeyboard(QWidget *parent) : TWidget(parent)
|
||||
BotKeyboard::BotKeyboard(not_null<Main::Session*> session, QWidget *parent)
|
||||
: TWidget(parent)
|
||||
, _session(session)
|
||||
, _st(&st::botKbButton) {
|
||||
setGeometry(0, 0, _st->margin, st::botKbScroll.deltat);
|
||||
_height = st::botKbScroll.deltat;
|
||||
|
@ -149,7 +151,7 @@ void BotKeyboard::leaveEventHook(QEvent *e) {
|
|||
}
|
||||
|
||||
bool BotKeyboard::moderateKeyActivate(int key) {
|
||||
if (const auto item = Auth().data().message(_wasForMsgId)) {
|
||||
if (const auto item = _session->data().message(_wasForMsgId)) {
|
||||
if (const auto markup = item->Get<HistoryMessageReplyMarkup>()) {
|
||||
if (key >= Qt::Key_1 && key <= Qt::Key_9) {
|
||||
const auto index = int(key - Qt::Key_1);
|
||||
|
|
|
@ -9,18 +9,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "ui/widgets/tooltip.h"
|
||||
|
||||
class ReplyKeyboard;
|
||||
|
||||
namespace style {
|
||||
struct BotKeyboardButton;
|
||||
} // namespace style
|
||||
|
||||
class ReplyKeyboard;
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class BotKeyboard
|
||||
: public TWidget
|
||||
, public Ui::AbstractTooltipShower
|
||||
, public ClickHandlerHost {
|
||||
public:
|
||||
BotKeyboard(QWidget *parent);
|
||||
BotKeyboard(not_null<Main::Session*> session, QWidget *parent);
|
||||
|
||||
bool moderateKeyActivate(int index);
|
||||
|
||||
|
@ -70,6 +74,7 @@ private:
|
|||
void updateStyle(int newWidth);
|
||||
void clearSelection();
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
FullMsgId _wasForMsgId;
|
||||
int _height = 0;
|
||||
int _maxOuterHeight = 0;
|
||||
|
|
|
@ -527,7 +527,7 @@ void EmojiKeywords::handleSessionChanges() {
|
|||
void EmojiKeywords::apiChanged(ApiWrap *api) {
|
||||
_api = api;
|
||||
if (_api) {
|
||||
crl::on_main(&Auth(), crl::guard(&_guard, [=] {
|
||||
crl::on_main(&_api->session(), crl::guard(&_guard, [=] {
|
||||
base::ObservableViewer(
|
||||
Lang::CurrentCloudManager().firstLanguageSuggestion()
|
||||
) | rpl::filter([=] {
|
||||
|
|
|
@ -698,7 +698,7 @@ void EmojiListWidget::colorChosen(EmojiPtr emoji) {
|
|||
cRefEmojiVariants().insert(
|
||||
emoji->nonColoredId(),
|
||||
emoji->variantIndex(emoji));
|
||||
Auth().saveSettingsDelayed();
|
||||
controller()->session().saveSettingsDelayed();
|
||||
}
|
||||
if (_pickerSel >= 0) {
|
||||
auto section = (_pickerSel / MatrixRowShift);
|
||||
|
|
|
@ -254,7 +254,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
};
|
||||
mrows.reserve(mrows.size() + (_chat->participants.empty() ? _chat->lastAuthors.size() : _chat->participants.size()));
|
||||
if (_chat->noParticipantInfo()) {
|
||||
Auth().api().requestFullPeer(_chat);
|
||||
_chat->session().api().requestFullPeer(_chat);
|
||||
} else if (!_chat->participants.empty()) {
|
||||
for (const auto user : _chat->participants) {
|
||||
if (user->isInaccessible()) continue;
|
||||
|
@ -277,7 +277,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
} else if (_channel && _channel->isMegagroup()) {
|
||||
QMultiMap<int32, UserData*> ordered;
|
||||
if (_channel->lastParticipantsRequestNeeded()) {
|
||||
Auth().api().requestLastParticipants(_channel);
|
||||
_channel->session().api().requestLastParticipants(_channel);
|
||||
} else {
|
||||
mrows.reserve(mrows.size() + _channel->mgInfo->lastParticipants.size());
|
||||
for (const auto user : _channel->mgInfo->lastParticipants) {
|
||||
|
@ -600,7 +600,9 @@ FieldAutocompleteInner::FieldAutocompleteInner(
|
|||
, _brows(brows)
|
||||
, _srows(srows)
|
||||
, _previewTimer([=] { showPreview(); }) {
|
||||
subscribe(Auth().downloaderTaskFinished(), [this] { update(); });
|
||||
subscribe(
|
||||
controller->session().downloaderTaskFinished(),
|
||||
[=] { update(); });
|
||||
}
|
||||
|
||||
void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
||||
|
|
|
@ -48,17 +48,13 @@ constexpr auto kParseLinksTimeout = crl::time(1000);
|
|||
// For mention tags save and validate userId, ignore tags for different userId.
|
||||
class FieldTagMimeProcessor : public Ui::InputField::TagMimeProcessor {
|
||||
public:
|
||||
QString tagFromMimeTag(const QString &mimeTag) override {
|
||||
if (TextUtilities::IsMentionLink(mimeTag)) {
|
||||
auto match = QRegularExpression(":(\\d+)$").match(mimeTag);
|
||||
if (!match.hasMatch()
|
||||
|| match.capturedRef(1).toInt() != Auth().userId()) {
|
||||
return QString();
|
||||
}
|
||||
return mimeTag.mid(0, mimeTag.size() - match.capturedLength());
|
||||
}
|
||||
return mimeTag;
|
||||
}
|
||||
explicit FieldTagMimeProcessor(
|
||||
not_null<Window::SessionController*> controller);
|
||||
|
||||
QString tagFromMimeTag(const QString &mimeTag) override;
|
||||
|
||||
private:
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
|
||||
};
|
||||
|
||||
|
@ -85,6 +81,24 @@ private:
|
|||
|
||||
};
|
||||
|
||||
FieldTagMimeProcessor::FieldTagMimeProcessor(
|
||||
not_null<Window::SessionController*> controller)
|
||||
: _controller(controller) {
|
||||
}
|
||||
|
||||
QString FieldTagMimeProcessor::tagFromMimeTag(const QString &mimeTag) {
|
||||
if (TextUtilities::IsMentionLink(mimeTag)) {
|
||||
const auto userId = _controller->session().userId();
|
||||
auto match = QRegularExpression(":(\\d+)$").match(mimeTag);
|
||||
if (!match.hasMatch()
|
||||
|| match.capturedRef(1).toInt() != userId) {
|
||||
return QString();
|
||||
}
|
||||
return mimeTag.mid(0, mimeTag.size() - match.capturedLength());
|
||||
}
|
||||
return mimeTag;
|
||||
}
|
||||
|
||||
//bool ValidateUrl(const QString &value) {
|
||||
// const auto match = qthelp::RegExpDomain().match(value);
|
||||
// if (!match.hasMatch() || match.capturedStart() != 0) {
|
||||
|
@ -264,7 +278,8 @@ void InitMessageField(
|
|||
field->setMinHeight(st::historySendSize.height() - 2 * st::historySendPadding);
|
||||
field->setMaxHeight(st::historyComposeFieldMaxHeight);
|
||||
|
||||
field->setTagMimeProcessor(std::make_unique<FieldTagMimeProcessor>());
|
||||
field->setTagMimeProcessor(
|
||||
std::make_unique<FieldTagMimeProcessor>(controller));
|
||||
|
||||
field->document()->setDocumentMargin(4.);
|
||||
field->setAdditionalMargin(style::ConvertScale(4) - 4);
|
||||
|
@ -307,7 +322,9 @@ bool HasSendText(not_null<const Ui::InputField*> field) {
|
|||
return false;
|
||||
}
|
||||
|
||||
InlineBotQuery ParseInlineBotQuery(not_null<const Ui::InputField*> field) {
|
||||
InlineBotQuery ParseInlineBotQuery(
|
||||
not_null<Main::Session*> session,
|
||||
not_null<const Ui::InputField*> field) {
|
||||
auto result = InlineBotQuery();
|
||||
|
||||
const auto &full = field->getTextWithTags();
|
||||
|
@ -345,7 +362,7 @@ InlineBotQuery ParseInlineBotQuery(not_null<const Ui::InputField*> field) {
|
|||
auto username = text.midRef(inlineUsernameStart, inlineUsernameLength);
|
||||
if (username != result.username) {
|
||||
result.username = username.toString();
|
||||
if (const auto peer = Auth().data().peerByUsername(result.username)) {
|
||||
if (const auto peer = session->data().peerByUsername(result.username)) {
|
||||
if (const auto user = peer->asUser()) {
|
||||
result.bot = peer->asUser();
|
||||
} else {
|
||||
|
|
|
@ -52,7 +52,9 @@ struct InlineBotQuery {
|
|||
UserData *bot = nullptr;
|
||||
bool lookingUpBot = false;
|
||||
};
|
||||
InlineBotQuery ParseInlineBotQuery(not_null<const Ui::InputField*> field);
|
||||
InlineBotQuery ParseInlineBotQuery(
|
||||
not_null<Main::Session*> session,
|
||||
not_null<const Ui::InputField*> field);
|
||||
|
||||
struct AutocompleteQuery {
|
||||
QString query;
|
||||
|
|
|
@ -73,9 +73,9 @@ private:
|
|||
class MentionNameClickHandler : public ClickHandler {
|
||||
public:
|
||||
MentionNameClickHandler(QString text, UserId userId, uint64 accessHash)
|
||||
: _text(text)
|
||||
, _userId(userId)
|
||||
, _accessHash(accessHash) {
|
||||
: _text(text)
|
||||
, _userId(userId)
|
||||
, _accessHash(accessHash) {
|
||||
}
|
||||
|
||||
void onClick(ClickContext context) const override;
|
||||
|
|
|
@ -1579,7 +1579,7 @@ void UpdateApplication() {
|
|||
if (const auto controller = window->sessionController()) {
|
||||
controller->showSection(
|
||||
Info::Memento(
|
||||
Info::Settings::Tag{ Auth().user() },
|
||||
Info::Settings::Tag{ controller->session().user() },
|
||||
Info::Section::SettingsType::Advanced),
|
||||
Window::SectionShow());
|
||||
} else {
|
||||
|
|
|
@ -65,11 +65,14 @@ QString JoinStringList(const QStringList &list, const QString &separator) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void LaunchWithWarning(const QString &name, HistoryItem *item) {
|
||||
void LaunchWithWarning(
|
||||
not_null<Main::Session*> session,
|
||||
const QString &name,
|
||||
HistoryItem *item) {
|
||||
const auto warn = [&] {
|
||||
if (!Data::IsExecutableName(name)) {
|
||||
return false;
|
||||
} else if (!Auth().settings().exeLaunchWarning()) {
|
||||
} else if (!session->settings().exeLaunchWarning()) {
|
||||
return false;
|
||||
} else if (item && item->history()->peer->isVerified()) {
|
||||
return false;
|
||||
|
@ -81,13 +84,13 @@ void LaunchWithWarning(const QString &name, HistoryItem *item) {
|
|||
return;
|
||||
}
|
||||
const auto extension = '.' + Data::FileExtension(name);
|
||||
const auto callback = [=](bool checked) {
|
||||
const auto callback = crl::guard(session, [=](bool checked) {
|
||||
if (checked) {
|
||||
Auth().settings().setExeLaunchWarning(false);
|
||||
Auth().saveSettingsDelayed();
|
||||
session->settings().setExeLaunchWarning(false);
|
||||
session->saveSettingsDelayed();
|
||||
}
|
||||
File::Launch(name);
|
||||
};
|
||||
});
|
||||
Ui::show(Box<ConfirmDontWarnBox>(
|
||||
tr::lng_launch_exe_warning(
|
||||
lt_extension,
|
||||
|
@ -313,7 +316,7 @@ void DocumentOpenClickHandler::Open(
|
|||
return;
|
||||
}
|
||||
}
|
||||
LaunchWithWarning(location.name(), context);
|
||||
LaunchWithWarning(&data->session(), location.name(), context);
|
||||
};
|
||||
const auto media = data->createMediaView();
|
||||
const auto &location = data->location(true);
|
||||
|
|
|
@ -186,10 +186,12 @@ SearchResult ParseSearchResult(
|
|||
return result;
|
||||
}
|
||||
|
||||
SearchController::CacheEntry::CacheEntry(const Query &query)
|
||||
: peerData(Auth().data().peer(query.peerId))
|
||||
SearchController::CacheEntry::CacheEntry(
|
||||
not_null<Main::Session*> session,
|
||||
const Query &query)
|
||||
: peerData(session->data().peer(query.peerId))
|
||||
, migratedData(query.migratedPeerId
|
||||
? base::make_optional(Data(Auth().data().peer(query.migratedPeerId)))
|
||||
? base::make_optional(Data(session->data().peer(query.migratedPeerId)))
|
||||
: std::nullopt) {
|
||||
}
|
||||
|
||||
|
@ -211,7 +213,7 @@ void SearchController::setQuery(const Query &query) {
|
|||
if (_current == _cache.end()) {
|
||||
_current = _cache.emplace(
|
||||
query,
|
||||
std::make_unique<CacheEntry>(query)).first;
|
||||
std::make_unique<CacheEntry>(_session, query)).first;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,14 +288,14 @@ rpl::producer<SparseIdsSlice> SearchController::simpleIdsSlice(
|
|||
return builder->applyUpdate(update);
|
||||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
Auth().data().itemRemoved(
|
||||
_session->data().itemRemoved(
|
||||
) | rpl::filter([=](not_null<const HistoryItem*> item) {
|
||||
return (item->history()->peer->id == peerId);
|
||||
}) | rpl::filter([=](not_null<const HistoryItem*> item) {
|
||||
return builder->removeOne(item->id);
|
||||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
Auth().data().historyCleared(
|
||||
_session->data().historyCleared(
|
||||
) | rpl::filter([=](not_null<const History*> history) {
|
||||
return (history->peer->id == peerId);
|
||||
}) | rpl::filter([=] {
|
||||
|
@ -337,7 +339,7 @@ void SearchController::restoreState(SavedState &&state) {
|
|||
if (it == _cache.end()) {
|
||||
it = _cache.emplace(
|
||||
state.query,
|
||||
std::make_unique<CacheEntry>(state.query)).first;
|
||||
std::make_unique<CacheEntry>(_session, state.query)).first;
|
||||
}
|
||||
auto replace = Data(it->second->peerData.peer);
|
||||
replace.list = std::move(state.peerList);
|
||||
|
|
|
@ -102,7 +102,7 @@ private:
|
|||
using SliceUpdate = Storage::SparseIdsSliceUpdate;
|
||||
|
||||
struct CacheEntry {
|
||||
CacheEntry(const Query &query);
|
||||
CacheEntry(not_null<Main::Session*> session, const Query &query);
|
||||
|
||||
Data peerData;
|
||||
std::optional<Data> migratedData;
|
||||
|
|
|
@ -2616,7 +2616,9 @@ void Session::documentApplyFields(
|
|||
not_null<WebPageData*> Session::webpage(WebPageId id) {
|
||||
auto i = _webpages.find(id);
|
||||
if (i == _webpages.cend()) {
|
||||
i = _webpages.emplace(id, std::make_unique<WebPageData>(id)).first;
|
||||
i = _webpages.emplace(
|
||||
id,
|
||||
std::make_unique<WebPageData>(this, id)).first;
|
||||
}
|
||||
return i->second.get();
|
||||
}
|
||||
|
@ -2773,7 +2775,7 @@ void Session::webpageApplyFields(
|
|||
description,
|
||||
photo ? processPhoto(*photo).get() : nullptr,
|
||||
document ? processDocument(*document).get() : lookupThemeDocument(),
|
||||
WebPageCollage(data),
|
||||
WebPageCollage(this, data),
|
||||
data.vduration().value_or_empty(),
|
||||
qs(data.vauthor().value_or_empty()),
|
||||
pendingTill);
|
||||
|
@ -3800,7 +3802,7 @@ void Session::setWallpapers(const QVector<MTPWallPaper> &data, int32 hash) {
|
|||
_wallpapers.back().setLocalImageAsThumbnail(std::make_shared<Image>(
|
||||
u":/gui/art/bg_initial.jpg"_q));
|
||||
for (const auto &paper : data) {
|
||||
if (const auto parsed = Data::WallPaper::Create(paper)) {
|
||||
if (const auto parsed = Data::WallPaper::Create(&session(), paper)) {
|
||||
_wallpapers.push_back(*parsed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void SharedMediaShowOverview(
|
|||
not_null<History*> history) {
|
||||
if (SharedMediaOverviewType(type)) {
|
||||
App::wnd()->sessionController()->showSection(Info::Memento(
|
||||
history->peer->id,
|
||||
history->peer,
|
||||
Info::Section(type)));
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ bool SharedMediaAllowSearch(Storage::SharedMediaType type) {
|
|||
}
|
||||
|
||||
rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
||||
not_null<Main::Session*> session,
|
||||
Storage::SharedMediaKey key,
|
||||
int limitBefore,
|
||||
int limitAfter) {
|
||||
|
@ -76,10 +77,10 @@ rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
|||
limitBefore,
|
||||
limitAfter);
|
||||
auto requestMediaAround = [
|
||||
peer = Auth().data().peer(key.peerId),
|
||||
peer = session->data().peer(key.peerId),
|
||||
type = key.type
|
||||
](const SparseIdsSliceBuilder::AroundData &data) {
|
||||
Auth().api().requestSharedMedia(
|
||||
peer->session().api().requestSharedMedia(
|
||||
peer,
|
||||
type,
|
||||
data.aroundId,
|
||||
|
@ -93,7 +94,7 @@ rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
|||
};
|
||||
|
||||
using SliceUpdate = Storage::SharedMediaSliceUpdate;
|
||||
Auth().storage().sharedMediaSliceUpdated(
|
||||
session->storage().sharedMediaSliceUpdated(
|
||||
) | rpl::filter([=](const SliceUpdate &update) {
|
||||
return (update.peerId == key.peerId)
|
||||
&& (update.type == key.type);
|
||||
|
@ -102,7 +103,7 @@ rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
|||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using OneRemoved = Storage::SharedMediaRemoveOne;
|
||||
Auth().storage().sharedMediaOneRemoved(
|
||||
session->storage().sharedMediaOneRemoved(
|
||||
) | rpl::filter([=](const OneRemoved &update) {
|
||||
return (update.peerId == key.peerId)
|
||||
&& update.types.test(key.type);
|
||||
|
@ -111,7 +112,7 @@ rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
|||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using AllRemoved = Storage::SharedMediaRemoveAll;
|
||||
Auth().storage().sharedMediaAllRemoved(
|
||||
session->storage().sharedMediaAllRemoved(
|
||||
) | rpl::filter([=](const AllRemoved &update) {
|
||||
return (update.peerId == key.peerId);
|
||||
}) | rpl::filter([=] {
|
||||
|
@ -119,7 +120,7 @@ rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
|||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using InvalidateBottom = Storage::SharedMediaInvalidateBottom;
|
||||
Auth().storage().sharedMediaBottomInvalidated(
|
||||
session->storage().sharedMediaBottomInvalidated(
|
||||
) | rpl::filter([=](const InvalidateBottom &update) {
|
||||
return (update.peerId == key.peerId);
|
||||
}) | rpl::filter([=] {
|
||||
|
@ -127,7 +128,7 @@ rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
|||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using Result = Storage::SharedMediaResult;
|
||||
Auth().storage().query(Storage::SharedMediaQuery(
|
||||
session->storage().query(Storage::SharedMediaQuery(
|
||||
key,
|
||||
limitBefore,
|
||||
limitAfter
|
||||
|
@ -143,6 +144,7 @@ rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
|||
}
|
||||
|
||||
rpl::producer<SparseIdsMergedSlice> SharedMediaMergedViewer(
|
||||
not_null<Main::Session*> session,
|
||||
SharedMediaMergedKey key,
|
||||
int limitBefore,
|
||||
int limitAfter) {
|
||||
|
@ -152,6 +154,7 @@ rpl::producer<SparseIdsMergedSlice> SharedMediaMergedViewer(
|
|||
int limitBefore,
|
||||
int limitAfter) {
|
||||
return SharedMediaViewer(
|
||||
session,
|
||||
Storage::SharedMediaKey(
|
||||
peerId,
|
||||
key.type,
|
||||
|
@ -349,12 +352,14 @@ std::optional<FullMsgId> SharedMediaWithLastSlice::LastFullMsgId(
|
|||
}
|
||||
|
||||
rpl::producer<SharedMediaWithLastSlice> SharedMediaWithLastViewer(
|
||||
not_null<Main::Session*> session,
|
||||
SharedMediaWithLastSlice::Key key,
|
||||
int limitBefore,
|
||||
int limitAfter) {
|
||||
return [=](auto consumer) {
|
||||
if (base::get_if<not_null<PhotoData*>>(&key.universalId)) {
|
||||
return SharedMediaMergedViewer(
|
||||
session,
|
||||
SharedMediaMergedKey(
|
||||
SharedMediaWithLastSlice::ViewerKey(key),
|
||||
key.type),
|
||||
|
@ -369,12 +374,14 @@ rpl::producer<SharedMediaWithLastSlice> SharedMediaWithLastViewer(
|
|||
}
|
||||
return rpl::combine(
|
||||
SharedMediaMergedViewer(
|
||||
session,
|
||||
SharedMediaMergedKey(
|
||||
SharedMediaWithLastSlice::ViewerKey(key),
|
||||
key.type),
|
||||
limitBefore,
|
||||
limitAfter),
|
||||
SharedMediaMergedViewer(
|
||||
session,
|
||||
SharedMediaMergedKey(
|
||||
SharedMediaWithLastSlice::EndingKey(key),
|
||||
key.type),
|
||||
|
@ -392,10 +399,12 @@ rpl::producer<SharedMediaWithLastSlice> SharedMediaWithLastViewer(
|
|||
}
|
||||
|
||||
rpl::producer<SharedMediaWithLastSlice> SharedMediaWithLastReversedViewer(
|
||||
not_null<Main::Session*> session,
|
||||
SharedMediaWithLastSlice::Key key,
|
||||
int limitBefore,
|
||||
int limitAfter) {
|
||||
return SharedMediaWithLastViewer(
|
||||
session,
|
||||
key,
|
||||
limitBefore,
|
||||
limitAfter
|
||||
|
|
|
@ -13,6 +13,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
class History;
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
std::optional<Storage::SharedMediaType> SharedMediaOverviewType(
|
||||
Storage::SharedMediaType type);
|
||||
void SharedMediaShowOverview(
|
||||
|
@ -21,6 +25,7 @@ void SharedMediaShowOverview(
|
|||
bool SharedMediaAllowSearch(Storage::SharedMediaType type);
|
||||
|
||||
rpl::producer<SparseIdsSlice> SharedMediaViewer(
|
||||
not_null<Main::Session*> session,
|
||||
Storage::SharedMediaKey key,
|
||||
int limitBefore,
|
||||
int limitAfter);
|
||||
|
@ -46,6 +51,7 @@ struct SharedMediaMergedKey {
|
|||
};
|
||||
|
||||
rpl::producer<SparseIdsMergedSlice> SharedMediaMergedViewer(
|
||||
not_null<Main::Session*> session,
|
||||
SharedMediaMergedKey key,
|
||||
int limitBefore,
|
||||
int limitAfter);
|
||||
|
@ -179,11 +185,13 @@ private:
|
|||
};
|
||||
|
||||
rpl::producer<SharedMediaWithLastSlice> SharedMediaWithLastViewer(
|
||||
not_null<Main::Session*> session,
|
||||
SharedMediaWithLastSlice::Key key,
|
||||
int limitBefore,
|
||||
int limitAfter);
|
||||
|
||||
rpl::producer<SharedMediaWithLastSlice> SharedMediaWithLastReversedViewer(
|
||||
not_null<Main::Session*> session,
|
||||
SharedMediaWithLastSlice::Key key,
|
||||
int limitBefore,
|
||||
int limitAfter);
|
||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "storage/storage_facade.h"
|
||||
#include "storage/storage_user_photos.h"
|
||||
|
||||
|
@ -194,10 +195,11 @@ UserPhotosSlice UserPhotosSliceBuilder::snapshot() const {
|
|||
}
|
||||
|
||||
rpl::producer<UserPhotosSlice> UserPhotosViewer(
|
||||
not_null<Main::Session*> session,
|
||||
UserPhotosSlice::Key key,
|
||||
int limitBefore,
|
||||
int limitAfter) {
|
||||
return [key, limitBefore, limitAfter](auto consumer) {
|
||||
return [=](auto consumer) {
|
||||
auto lifetime = rpl::lifetime();
|
||||
auto builder = lifetime.make_state<UserPhotosSliceBuilder>(
|
||||
key,
|
||||
|
@ -208,17 +210,17 @@ rpl::producer<UserPhotosSlice> UserPhotosViewer(
|
|||
consumer.put_next(builder->snapshot());
|
||||
}
|
||||
};
|
||||
auto requestPhotosAround = [user = Auth().data().user(key.userId)](
|
||||
auto requestPhotosAround = [user = session->data().user(key.userId)](
|
||||
PhotoId photoId) {
|
||||
Auth().api().requestUserPhotos(user, photoId);
|
||||
user->session().api().requestUserPhotos(user, photoId);
|
||||
};
|
||||
builder->insufficientPhotosAround()
|
||||
| rpl::start_with_next(requestPhotosAround, lifetime);
|
||||
|
||||
Auth().storage().userPhotosSliceUpdated()
|
||||
session->storage().userPhotosSliceUpdated()
|
||||
| rpl::start_with_next(applyUpdate, lifetime);
|
||||
|
||||
Auth().storage().query(Storage::UserPhotosQuery(
|
||||
session->storage().query(Storage::UserPhotosQuery(
|
||||
key,
|
||||
limitBefore,
|
||||
limitAfter
|
||||
|
@ -233,10 +235,12 @@ rpl::producer<UserPhotosSlice> UserPhotosViewer(
|
|||
|
||||
|
||||
rpl::producer<UserPhotosSlice> UserPhotosReversedViewer(
|
||||
not_null<Main::Session*> session,
|
||||
UserPhotosSlice::Key key,
|
||||
int limitBefore,
|
||||
int limitAfter) {
|
||||
return UserPhotosViewer(
|
||||
session,
|
||||
key,
|
||||
limitBefore,
|
||||
limitAfter
|
||||
|
|
|
@ -10,6 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/storage_user_photos.h"
|
||||
#include "base/weak_ptr.h"
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class UserPhotosSlice {
|
||||
public:
|
||||
using Key = Storage::UserPhotosKey;
|
||||
|
@ -46,11 +50,13 @@ private:
|
|||
};
|
||||
|
||||
rpl::producer<UserPhotosSlice> UserPhotosViewer(
|
||||
not_null<Main::Session*> session,
|
||||
UserPhotosSlice::Key key,
|
||||
int limitBefore,
|
||||
int limitAfter);
|
||||
|
||||
rpl::producer<UserPhotosSlice> UserPhotosReversedViewer(
|
||||
not_null<Main::Session*> session,
|
||||
UserPhotosSlice::Key key,
|
||||
int limitBefore,
|
||||
int limitAfter);
|
||||
|
|
|
@ -302,18 +302,22 @@ WallPaper WallPaper::withoutImageData() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
std::optional<WallPaper> WallPaper::Create(const MTPWallPaper &data) {
|
||||
return data.match([](const MTPDwallPaper &data) {
|
||||
return Create(data);
|
||||
std::optional<WallPaper> WallPaper::Create(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPWallPaper &data) {
|
||||
return data.match([&](const MTPDwallPaper &data) {
|
||||
return Create(session, data);
|
||||
}, [](const MTPDwallPaperNoFile &data) {
|
||||
return std::optional<WallPaper>(); // #TODO themes
|
||||
});
|
||||
}
|
||||
|
||||
std::optional<WallPaper> WallPaper::Create(const MTPDwallPaper &data) {
|
||||
std::optional<WallPaper> WallPaper::Create(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDwallPaper &data) {
|
||||
using Flag = MTPDwallPaper::Flag;
|
||||
|
||||
const auto document = Auth().data().processDocument(
|
||||
const auto document = session->data().processDocument(
|
||||
data.vdocument());
|
||||
if (!document->checkWallPaperProperties()) {
|
||||
return std::nullopt;
|
||||
|
|
|
@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
class Image;
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Data {
|
||||
|
||||
struct FileOrigin;
|
||||
|
@ -49,8 +53,10 @@ public:
|
|||
[[nodiscard]] WallPaper withoutImageData() const;
|
||||
|
||||
[[nodiscard]] static std::optional<WallPaper> Create(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPWallPaper &data);
|
||||
[[nodiscard]] static std::optional<WallPaper> Create(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDwallPaper &data);
|
||||
|
||||
[[nodiscard]] QByteArray serialize() const;
|
||||
|
|
|
@ -35,6 +35,7 @@ QString SiteNameFromUrl(const QString &url) {
|
|||
}
|
||||
|
||||
WebPageCollage ExtractCollage(
|
||||
not_null<Data::Session*> owner,
|
||||
const QVector<MTPPageBlock> &items,
|
||||
const QVector<MTPPhoto> &photos,
|
||||
const QVector<MTPDocument> &documents) {
|
||||
|
@ -51,25 +52,24 @@ WebPageCollage ExtractCollage(
|
|||
return {};
|
||||
}
|
||||
|
||||
auto &storage = Auth().data();
|
||||
for (const auto &photo : photos) {
|
||||
storage.processPhoto(photo);
|
||||
owner->processPhoto(photo);
|
||||
}
|
||||
for (const auto &document : documents) {
|
||||
storage.processDocument(document);
|
||||
owner->processDocument(document);
|
||||
}
|
||||
auto result = WebPageCollage();
|
||||
result.items.reserve(count);
|
||||
for (const auto &item : items) {
|
||||
const auto good = item.match([&](const MTPDpageBlockPhoto &data) {
|
||||
const auto photo = storage.photo(data.vphoto_id().v);
|
||||
const auto photo = owner->photo(data.vphoto_id().v);
|
||||
if (photo->isNull()) {
|
||||
return false;
|
||||
}
|
||||
result.items.emplace_back(photo);
|
||||
return true;
|
||||
}, [&](const MTPDpageBlockVideo &data) {
|
||||
const auto document = storage.document(data.vvideo_id().v);
|
||||
const auto document = owner->document(data.vvideo_id().v);
|
||||
if (!document->isVideoFile()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -85,17 +85,19 @@ WebPageCollage ExtractCollage(
|
|||
return result;
|
||||
}
|
||||
|
||||
WebPageCollage ExtractCollage(const MTPDwebPage &data) {
|
||||
WebPageCollage ExtractCollage(
|
||||
not_null<Data::Session*> owner,
|
||||
const MTPDwebPage &data) {
|
||||
const auto page = data.vcached_page();
|
||||
if (!page) {
|
||||
return {};
|
||||
}
|
||||
const auto processMedia = [&] {
|
||||
if (const auto photo = data.vphoto()) {
|
||||
Auth().data().processPhoto(*photo);
|
||||
owner->processPhoto(*photo);
|
||||
}
|
||||
if (const auto document = data.vdocument()) {
|
||||
Auth().data().processDocument(*document);
|
||||
owner->processDocument(*document);
|
||||
}
|
||||
};
|
||||
return page->match([&](const auto &page) {
|
||||
|
@ -111,12 +113,14 @@ WebPageCollage ExtractCollage(const MTPDwebPage &data) {
|
|||
case mtpc_pageBlockSlideshow:
|
||||
processMedia();
|
||||
return ExtractCollage(
|
||||
owner,
|
||||
block.c_pageBlockSlideshow().vitems().v,
|
||||
page.vphotos().v,
|
||||
page.vdocuments().v);
|
||||
case mtpc_pageBlockCollage:
|
||||
processMedia();
|
||||
return ExtractCollage(
|
||||
owner,
|
||||
block.c_pageBlockCollage().vitems().v,
|
||||
page.vphotos().v,
|
||||
page.vdocuments().v);
|
||||
|
@ -148,8 +152,23 @@ WebPageType ParseWebPageType(const MTPDwebPage &page) {
|
|||
}
|
||||
}
|
||||
|
||||
WebPageCollage::WebPageCollage(const MTPDwebPage &data)
|
||||
: WebPageCollage(ExtractCollage(data)) {
|
||||
WebPageCollage::WebPageCollage(
|
||||
not_null<Data::Session*> owner,
|
||||
const MTPDwebPage &data)
|
||||
: WebPageCollage(ExtractCollage(owner, data)) {
|
||||
}
|
||||
|
||||
WebPageData::WebPageData(not_null<Data::Session*> owner, const WebPageId &id)
|
||||
: id(id)
|
||||
, _owner(owner) {
|
||||
}
|
||||
|
||||
Data::Session &WebPageData::owner() const {
|
||||
return *_owner;
|
||||
}
|
||||
|
||||
Main::Session &WebPageData::session() const {
|
||||
return _owner->session();
|
||||
}
|
||||
|
||||
bool WebPageData::applyChanges(
|
||||
|
@ -211,7 +230,7 @@ bool WebPageData::applyChanges(
|
|||
return false;
|
||||
}
|
||||
if (pendingTill > 0 && newPendingTill <= 0) {
|
||||
Auth().api().clearWebPageRequest(this);
|
||||
_owner->session().api().clearWebPageRequest(this);
|
||||
}
|
||||
type = newType;
|
||||
url = resultUrl;
|
||||
|
|
|
@ -12,9 +12,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
class ChannelData;
|
||||
|
||||
namespace Main {
|
||||
namespace Data {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
} // namespace Data
|
||||
|
||||
enum class WebPageType {
|
||||
Photo,
|
||||
|
@ -32,15 +32,19 @@ struct WebPageCollage {
|
|||
using Item = base::variant<PhotoData*, DocumentData*>;
|
||||
|
||||
WebPageCollage() = default;
|
||||
explicit WebPageCollage(const MTPDwebPage &data);
|
||||
explicit WebPageCollage(
|
||||
not_null<Data::Session*> owner,
|
||||
const MTPDwebPage &data);
|
||||
|
||||
std::vector<Item> items;
|
||||
|
||||
};
|
||||
|
||||
struct WebPageData {
|
||||
WebPageData(const WebPageId &id) : id(id) {
|
||||
}
|
||||
WebPageData(not_null<Data::Session*> owner, const WebPageId &id);
|
||||
|
||||
[[nodiscard]] Data::Session &owner() const;
|
||||
[[nodiscard]] Main::Session &session() const;
|
||||
|
||||
bool applyChanges(
|
||||
WebPageType newType,
|
||||
|
@ -79,4 +83,6 @@ struct WebPageData {
|
|||
private:
|
||||
void replaceDocumentGoodThumbnail();
|
||||
|
||||
const not_null<Data::Session*> _owner;
|
||||
|
||||
};
|
||||
|
|
|
@ -230,7 +230,7 @@ void paintRow(
|
|||
crl::time ms,
|
||||
PaintItemCallback &&paintItemCallback,
|
||||
PaintCounterCallback &&paintCounterCallback) {
|
||||
const auto supportMode = Auth().supportMode();
|
||||
const auto supportMode = entry->session().supportMode();
|
||||
if (supportMode) {
|
||||
draft = nullptr;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ void paintRow(
|
|||
history->cloudDraftTextCache.drawElided(p, nameleft, texttop, availableWidth, 1);
|
||||
} else if (draft
|
||||
|| (supportMode
|
||||
&& Auth().supportHelper().isOccupiedBySomeone(history))) {
|
||||
&& entry->session().supportHelper().isOccupiedBySomeone(history))) {
|
||||
if (!promoted) {
|
||||
PaintRowDate(p, date, rectForName, active, selected);
|
||||
}
|
||||
|
|
|
@ -553,19 +553,6 @@ bool InnerWidget::elementUnderCursor(
|
|||
return (App::hoveredItem() == view);
|
||||
}
|
||||
|
||||
void InnerWidget::elementAnimationAutoplayAsync(
|
||||
not_null<const HistoryView::Element*> view) {
|
||||
crl::on_main(this, [this, msgId = view->data()->fullId()] {
|
||||
if (const auto item = session().data().message(msgId)) {
|
||||
if (const auto view = viewForItem(item)) {
|
||||
if (const auto media = view->media()) {
|
||||
media->autoplayAnimation();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
crl::time InnerWidget::elementHighlightTime(
|
||||
not_null<const HistoryView::Element*> element) {
|
||||
return crl::time(0);
|
||||
|
|
|
@ -96,8 +96,6 @@ public:
|
|||
HistoryView::Element *replacing = nullptr) override;
|
||||
bool elementUnderCursor(
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
void elementAnimationAutoplayAsync(
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
crl::time elementHighlightTime(
|
||||
not_null<const HistoryView::Element*> element) override;
|
||||
bool elementInSelectionMode() override;
|
||||
|
|
|
@ -3333,18 +3333,6 @@ not_null<HistoryView::ElementDelegate*> HistoryInner::ElementDelegate() {
|
|||
not_null<const HistoryView::Element*> view) override {
|
||||
return (App::hoveredItem() == view);
|
||||
}
|
||||
void elementAnimationAutoplayAsync(
|
||||
not_null<const HistoryView::Element*> view) override {
|
||||
crl::on_main(&Auth(), [msgId = view->data()->fullId()] {
|
||||
if (const auto item = Auth().data().message(msgId)) {
|
||||
if (const auto view = item->mainView()) {
|
||||
if (const auto media = view->media()) {
|
||||
media->autoplayAnimation();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
crl::time elementHighlightTime(
|
||||
not_null<const HistoryView::Element*> view) override {
|
||||
const auto fullAnimMs = App::main()->highlightStartTime(
|
||||
|
|
|
@ -354,9 +354,11 @@ void FastShareMessage(not_null<HistoryItem*> item) {
|
|||
}
|
||||
|
||||
Fn<void(ChannelData*, MsgId)> HistoryDependentItemCallback(
|
||||
const FullMsgId &msgId) {
|
||||
return [dependent = msgId](ChannelData *channel, MsgId msgId) {
|
||||
if (const auto item = Auth().data().message(dependent)) {
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto session = &item->history()->session();
|
||||
const auto dependent = item->fullId();
|
||||
return [=](ChannelData *channel, MsgId msgId) {
|
||||
if (const auto item = session->data().message(dependent)) {
|
||||
item->updateDependencyItem();
|
||||
}
|
||||
};
|
||||
|
@ -830,7 +832,7 @@ void HistoryMessage::createComponents(const CreateConfig &config) {
|
|||
history()->session().api().requestMessageData(
|
||||
history()->peer->asChannel(),
|
||||
reply->replyToMsgId,
|
||||
HistoryDependentItemCallback(fullId()));
|
||||
HistoryDependentItemCallback(this));
|
||||
}
|
||||
}
|
||||
if (const auto via = Get<HistoryMessageVia>()) {
|
||||
|
|
|
@ -16,7 +16,7 @@ class Message;
|
|||
struct HistoryMessageEdited;
|
||||
|
||||
Fn<void(ChannelData*, MsgId)> HistoryDependentItemCallback(
|
||||
const FullMsgId &msgId);
|
||||
not_null<HistoryItem*> item);
|
||||
MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer);
|
||||
MTPDmessage_ClientFlags NewMessageClientFlags();
|
||||
QString GetErrorTextForSending(
|
||||
|
|
|
@ -687,7 +687,7 @@ void HistoryService::createFromMtp(const MTPDmessageService &message) {
|
|||
history()->session().api().requestMessageData(
|
||||
history()->peer->asChannel(),
|
||||
dependent->msgId,
|
||||
HistoryDependentItemCallback(fullId()));
|
||||
HistoryDependentItemCallback(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -371,7 +371,9 @@ HistoryWidget::HistoryWidget(
|
|||
_topBar->hide();
|
||||
_scroll->hide();
|
||||
|
||||
_keyboard = _kbScroll->setOwnedWidget(object_ptr<BotKeyboard>(this));
|
||||
_keyboard = _kbScroll->setOwnedWidget(object_ptr<BotKeyboard>(
|
||||
&session(),
|
||||
this));
|
||||
_kbScroll->hide();
|
||||
|
||||
updateScrollColors();
|
||||
|
@ -1039,7 +1041,7 @@ void HistoryWidget::updateInlineBotQuery() {
|
|||
if (!_history) {
|
||||
return;
|
||||
}
|
||||
const auto query = ParseInlineBotQuery(_field);
|
||||
const auto query = ParseInlineBotQuery(&session(), _field);
|
||||
if (_inlineBotUsername != query.username) {
|
||||
_inlineBotUsername = query.username;
|
||||
if (_inlineBotResolveRequestId) {
|
||||
|
@ -1780,7 +1782,7 @@ void HistoryWidget::showHistory(
|
|||
_contactStatus = nullptr;
|
||||
|
||||
// Unload lottie animations.
|
||||
Auth().data().unloadHeavyViewParts(HistoryInner::ElementDelegate());
|
||||
session().data().unloadHeavyViewParts(HistoryInner::ElementDelegate());
|
||||
|
||||
if (peerId) {
|
||||
_peer = session().data().peer(peerId);
|
||||
|
@ -3841,7 +3843,7 @@ void HistoryWidget::inlineBotResolveDone(
|
|||
}();
|
||||
session().data().processChats(data.vchats());
|
||||
|
||||
const auto query = ParseInlineBotQuery(_field);
|
||||
const auto query = ParseInlineBotQuery(&session(), _field);
|
||||
if (_inlineBotUsername == query.username) {
|
||||
applyInlineBotQuery(
|
||||
query.lookingUpBot ? resolvedBot : query.bot,
|
||||
|
|
|
@ -72,10 +72,6 @@ bool SimpleElementDelegate::elementUnderCursor(
|
|||
return false;
|
||||
}
|
||||
|
||||
void SimpleElementDelegate::elementAnimationAutoplayAsync(
|
||||
not_null<const Element*> element) {
|
||||
}
|
||||
|
||||
crl::time SimpleElementDelegate::elementHighlightTime(
|
||||
not_null<const Element*> element) {
|
||||
return crl::time(0);
|
||||
|
|
|
@ -43,8 +43,6 @@ public:
|
|||
not_null<HistoryService*> message,
|
||||
Element *replacing = nullptr) = 0;
|
||||
virtual bool elementUnderCursor(not_null<const Element*> view) = 0;
|
||||
virtual void elementAnimationAutoplayAsync(
|
||||
not_null<const Element*> element) = 0;
|
||||
virtual crl::time elementHighlightTime(
|
||||
not_null<const Element*> element) = 0;
|
||||
virtual bool elementInSelectionMode() = 0;
|
||||
|
@ -71,8 +69,6 @@ public:
|
|||
not_null<HistoryService*> message,
|
||||
Element *replacing = nullptr) override;
|
||||
bool elementUnderCursor(not_null<const Element*> view) override;
|
||||
void elementAnimationAutoplayAsync(
|
||||
not_null<const Element*> element) override;
|
||||
crl::time elementHighlightTime(
|
||||
not_null<const Element*> element) override;
|
||||
bool elementInSelectionMode() override;
|
||||
|
|
|
@ -1123,17 +1123,6 @@ bool ListWidget::elementUnderCursor(
|
|||
return (_overElement == view);
|
||||
}
|
||||
|
||||
void ListWidget::elementAnimationAutoplayAsync(
|
||||
not_null<const Element*> view) {
|
||||
crl::on_main(this, [this, msgId = view->data()->fullId()]{
|
||||
if (const auto view = viewForItem(msgId)) {
|
||||
if (const auto media = view->media()) {
|
||||
media->autoplayAnimation();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
crl::time ListWidget::elementHighlightTime(
|
||||
not_null<const HistoryView::Element*> element) {
|
||||
if (element->data()->fullId() == _highlightedMessageId) {
|
||||
|
|
|
@ -190,8 +190,6 @@ public:
|
|||
not_null<HistoryService*> message,
|
||||
Element *replacing = nullptr) override;
|
||||
bool elementUnderCursor(not_null<const Element*> view) override;
|
||||
void elementAnimationAutoplayAsync(
|
||||
not_null<const Element*> view) override;
|
||||
crl::time elementHighlightTime(
|
||||
not_null<const Element*> element) override;
|
||||
bool elementInSelectionMode() override;
|
||||
|
|
|
@ -455,7 +455,7 @@ void TopBarWidget::infoClicked() {
|
|||
// Info::Section(Info::Section::Type::Profile)));
|
||||
} else if (_activeChat.peer()->isSelf()) {
|
||||
_controller->showSection(Info::Memento(
|
||||
_activeChat.peer()->id,
|
||||
_activeChat.peer(),
|
||||
Info::Section(Storage::SharedMediaType::Photo)));
|
||||
} else {
|
||||
_controller->showPeerInfo(_activeChat.peer());
|
||||
|
|
|
@ -20,18 +20,23 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Info {
|
||||
namespace CommonGroups {
|
||||
|
||||
Memento::Memento(not_null<UserData*> user)
|
||||
: ContentMemento(user, 0) {
|
||||
}
|
||||
|
||||
Section Memento::section() const {
|
||||
return Section(Section::Type::CommonGroups);
|
||||
}
|
||||
|
||||
not_null<UserData*> Memento::user() const {
|
||||
return peer()->asUser();
|
||||
}
|
||||
|
||||
object_ptr<ContentWidget> Memento::createWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller,
|
||||
const QRect &geometry) {
|
||||
auto result = object_ptr<Widget>(
|
||||
parent,
|
||||
controller,
|
||||
Auth().data().user(userId()));
|
||||
auto result = object_ptr<Widget>(parent, controller, user());
|
||||
result->setInternalState(geometry, this);
|
||||
return result;
|
||||
}
|
||||
|
@ -66,7 +71,7 @@ bool Widget::showInternal(not_null<ContentMemento*> memento) {
|
|||
return false;
|
||||
}
|
||||
if (auto groupsMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||
if (groupsMemento->userId() == user()->bareId()) {
|
||||
if (groupsMemento->user() == user()) {
|
||||
restoreState(groupsMemento);
|
||||
return true;
|
||||
}
|
||||
|
@ -83,7 +88,7 @@ void Widget::setInternalState(
|
|||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_unique<Memento>(user()->bareId());
|
||||
auto result = std::make_unique<Memento>(user());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -23,9 +23,7 @@ class InnerWidget;
|
|||
|
||||
class Memento final : public ContentMemento {
|
||||
public:
|
||||
Memento(UserId userId)
|
||||
: ContentMemento(peerFromUser(userId), 0) {
|
||||
}
|
||||
explicit Memento(not_null<UserData*> user);
|
||||
|
||||
object_ptr<ContentWidget> createWidget(
|
||||
QWidget *parent,
|
||||
|
@ -34,9 +32,7 @@ public:
|
|||
|
||||
Section section() const override;
|
||||
|
||||
UserId userId() const {
|
||||
return peerToUser(peerId());
|
||||
}
|
||||
not_null<UserData*> user() const;
|
||||
|
||||
void setListState(std::unique_ptr<PeerListState> state);
|
||||
std::unique_ptr<PeerListState> listState();
|
||||
|
|
|
@ -262,8 +262,8 @@ void ContentWidget::refreshSearchField(bool shown) {
|
|||
}
|
||||
|
||||
Key ContentMemento::key() const {
|
||||
if (const auto peerId = this->peerId()) {
|
||||
return Key(Auth().data().peer(peerId));
|
||||
if (const auto peer = this->peer()) {
|
||||
return Key(peer);
|
||||
//} else if (const auto feed = this->feed()) { // #feed
|
||||
// return Key(feed);
|
||||
} else if (const auto poll = this->poll()) {
|
||||
|
|
|
@ -116,8 +116,8 @@ private:
|
|||
|
||||
class ContentMemento {
|
||||
public:
|
||||
ContentMemento(PeerId peerId, PeerId migratedPeerId)
|
||||
: _peerId(peerId)
|
||||
ContentMemento(not_null<PeerData*> peer, PeerId migratedPeerId)
|
||||
: _peer(peer)
|
||||
, _migratedPeerId(migratedPeerId) {
|
||||
}
|
||||
//explicit ContentMemento(not_null<Data::Feed*> feed) : _feed(feed) { // #feed
|
||||
|
@ -133,8 +133,8 @@ public:
|
|||
not_null<Controller*> controller,
|
||||
const QRect &geometry) = 0;
|
||||
|
||||
PeerId peerId() const {
|
||||
return _peerId;
|
||||
PeerData *peer() const {
|
||||
return _peer;
|
||||
}
|
||||
PeerId migratedPeerId() const {
|
||||
return _migratedPeerId;
|
||||
|
@ -183,7 +183,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
const PeerId _peerId = 0;
|
||||
PeerData * const _peer = nullptr;
|
||||
const PeerId _migratedPeerId = 0;
|
||||
//Data::Feed * const _feed = nullptr; // #feed
|
||||
UserData * const _settingsSelf = nullptr;
|
||||
|
|
|
@ -25,19 +25,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_session_controller.h"
|
||||
|
||||
namespace Info {
|
||||
namespace {
|
||||
|
||||
not_null<PeerData*> CorrectPeer(PeerId peerId) {
|
||||
Expects(peerId != 0);
|
||||
|
||||
const auto result = Auth().data().peer(peerId);
|
||||
if (const auto to = result->migrateTo()) {
|
||||
return to;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Key::Key(not_null<PeerData*> peer) : _value(peer) {
|
||||
}
|
||||
|
@ -91,10 +78,13 @@ rpl::producer<SparseIdsMergedSlice> AbstractController::mediaSource(
|
|||
SparseIdsMergedSlice::UniversalMsgId aroundId,
|
||||
int limitBefore,
|
||||
int limitAfter) const {
|
||||
Expects(peer() != nullptr);
|
||||
|
||||
return SharedMediaMergedViewer(
|
||||
&session(),
|
||||
SharedMediaMergedKey(
|
||||
SparseIdsMergedSlice::Key(
|
||||
peerId(),
|
||||
peer()->id,
|
||||
migratedPeerId(),
|
||||
aroundId),
|
||||
section().mediaType()),
|
||||
|
@ -112,11 +102,8 @@ AbstractController::AbstractController(
|
|||
, _parent(parent) {
|
||||
}
|
||||
|
||||
PeerId AbstractController::peerId() const {
|
||||
if (const auto peer = key().peer()) {
|
||||
return peer->id;
|
||||
}
|
||||
return PeerId(0);
|
||||
PeerData *AbstractController::peer() const {
|
||||
return key().peer();
|
||||
}
|
||||
|
||||
PeerId AbstractController::migratedPeerId() const {
|
||||
|
@ -154,7 +141,7 @@ Controller::Controller(
|
|||
, _widget(widget)
|
||||
, _key(memento->key())
|
||||
, _migrated(memento->migratedPeerId()
|
||||
? Auth().data().peer(memento->migratedPeerId()).get()
|
||||
? window->session().data().peer(memento->migratedPeerId()).get()
|
||||
: nullptr)
|
||||
, _section(memento->section()) {
|
||||
updateSearchControllers(memento);
|
||||
|
@ -175,7 +162,7 @@ void Controller::setupMigrationViewer() {
|
|||
const auto section = _section;
|
||||
InvokeQueued(_widget, [=] {
|
||||
window->showSection(
|
||||
Memento(peer->id, section),
|
||||
Memento(peer, section),
|
||||
Window::SectionShow(
|
||||
Window::SectionShow::Way::Backward,
|
||||
anim::type::instant,
|
||||
|
@ -195,7 +182,7 @@ rpl::producer<Wrap> Controller::wrapValue() const {
|
|||
|
||||
bool Controller::validateMementoPeer(
|
||||
not_null<ContentMemento*> memento) const {
|
||||
return memento->peerId() == peerId()
|
||||
return memento->peer() == peer()
|
||||
&& memento->migratedPeerId() == migratedPeerId()
|
||||
//&& memento->feed() == feed() // #feed
|
||||
&& memento->settingsSelf() == settingsSelf();
|
||||
|
@ -313,6 +300,7 @@ rpl::producer<SparseIdsMergedSlice> Controller::mediaSource(
|
|||
}
|
||||
|
||||
return SharedMediaMergedViewer(
|
||||
&session(),
|
||||
SharedMediaMergedKey(
|
||||
SparseIdsMergedSlice::Key(
|
||||
query.peerId,
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
virtual PeerData *migrated() const = 0;
|
||||
virtual Section section() const = 0;
|
||||
|
||||
PeerId peerId() const;
|
||||
PeerData *peer() const;
|
||||
PeerId migratedPeerId() const;
|
||||
//Data::Feed *feed() const { // #feed
|
||||
// return key().feed();
|
||||
|
|
|
@ -164,10 +164,10 @@ bool LayerWidget::takeToThirdSection() {
|
|||
//// shrink the window size.
|
||||
////
|
||||
//// See https://github.com/telegramdesktop/tdesktop/issues/4091
|
||||
//Auth().settings().setThirdSectionExtendedBy(0);
|
||||
//localCopy->session()().settings().setThirdSectionExtendedBy(0);
|
||||
|
||||
//Auth().settings().setThirdSectionInfoEnabled(true);
|
||||
//Auth().saveSettingsDelayed();
|
||||
//localCopy->session()().settings().setThirdSectionInfoEnabled(true);
|
||||
//localCopy->session()().saveSettingsDelayed();
|
||||
//localCopy->showSection(
|
||||
// std::move(memento),
|
||||
// Window::SectionShow(
|
||||
|
|
|
@ -27,12 +27,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace Info {
|
||||
|
||||
Memento::Memento(PeerId peerId)
|
||||
: Memento(peerId, Section::Type::Profile) {
|
||||
Memento::Memento(not_null<PeerData*> peer)
|
||||
: Memento(peer, Section::Type::Profile) {
|
||||
}
|
||||
|
||||
Memento::Memento(PeerId peerId, Section section)
|
||||
: Memento(DefaultStack(peerId, section)) {
|
||||
Memento::Memento(not_null<PeerData*> peer, Section section)
|
||||
: Memento(DefaultStack(peer, section)) {
|
||||
}
|
||||
|
||||
//Memento::Memento(not_null<Data::Feed*> feed, Section section) // #feed
|
||||
|
@ -52,10 +52,10 @@ Memento::Memento(std::vector<std::unique_ptr<ContentMemento>> stack)
|
|||
}
|
||||
|
||||
std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
PeerId peerId,
|
||||
not_null<PeerData*> peer,
|
||||
Section section) {
|
||||
auto result = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
result.push_back(DefaultContent(peerId, section));
|
||||
result.push_back(DefaultContent(peer, section));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ Section Memento::DefaultSection(not_null<PeerData*> peer) {
|
|||
//}
|
||||
|
||||
Memento Memento::Default(not_null<PeerData*> peer) {
|
||||
return Memento(peer->id, DefaultSection(peer));
|
||||
return Memento(peer, DefaultSection(peer));
|
||||
}
|
||||
// // #feed
|
||||
//Memento Memento::Default(Dialogs::Key key) {
|
||||
|
@ -113,35 +113,29 @@ Memento Memento::Default(not_null<PeerData*> peer) {
|
|||
//}
|
||||
|
||||
std::unique_ptr<ContentMemento> Memento::DefaultContent(
|
||||
PeerId peerId,
|
||||
not_null<PeerData*> peer,
|
||||
Section section) {
|
||||
Expects(peerId != 0);
|
||||
|
||||
auto peer = Auth().data().peer(peerId);
|
||||
if (auto to = peer->migrateTo()) {
|
||||
peer = to;
|
||||
}
|
||||
auto migrated = peer->migrateFrom();
|
||||
peerId = peer->id;
|
||||
auto migratedPeerId = migrated ? migrated->id : PeerId(0);
|
||||
|
||||
switch (section.type()) {
|
||||
case Section::Type::Profile:
|
||||
return std::make_unique<Profile::Memento>(
|
||||
peerId,
|
||||
peer,
|
||||
migratedPeerId);
|
||||
case Section::Type::Media:
|
||||
return std::make_unique<Media::Memento>(
|
||||
peerId,
|
||||
peer,
|
||||
migratedPeerId,
|
||||
section.mediaType());
|
||||
case Section::Type::CommonGroups:
|
||||
Assert(peerIsUser(peerId));
|
||||
return std::make_unique<CommonGroups::Memento>(
|
||||
peerToUser(peerId));
|
||||
return std::make_unique<CommonGroups::Memento>(peer->asUser());
|
||||
case Section::Type::Members:
|
||||
return std::make_unique<Members::Memento>(
|
||||
peerId,
|
||||
peer,
|
||||
migratedPeerId);
|
||||
}
|
||||
Unexpected("Wrong section type in Info::Memento::DefaultContent()");
|
||||
|
|
|
@ -32,8 +32,8 @@ class WrapWidget;
|
|||
|
||||
class Memento final : public Window::SectionMemento {
|
||||
public:
|
||||
explicit Memento(PeerId peerId);
|
||||
Memento(PeerId peerId, Section section);
|
||||
explicit Memento(not_null<PeerData*> peer);
|
||||
Memento(not_null<PeerData*> peer, Section section);
|
||||
//Memento(not_null<Data::Feed*> feed, Section section); // #feed
|
||||
Memento(Settings::Tag settings, Section section);
|
||||
Memento(not_null<PollData*> poll, FullMsgId contextId);
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
private:
|
||||
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||
PeerId peerId,
|
||||
not_null<PeerData*> peer,
|
||||
Section section);
|
||||
//static std::vector<std::unique_ptr<ContentMemento>> DefaultStack( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
|
@ -85,7 +85,7 @@ private:
|
|||
// not_null<Data::Feed*> feed,
|
||||
// Section section);
|
||||
static std::unique_ptr<ContentMemento> DefaultContent(
|
||||
PeerId peerId,
|
||||
not_null<PeerData*> peer,
|
||||
Section section);
|
||||
|
||||
std::vector<std::unique_ptr<ContentMemento>> _stack;
|
||||
|
|
|
@ -138,9 +138,9 @@ void WrapWidget::injectActiveProfile(Dialogs::Key key) {
|
|||
}
|
||||
|
||||
void WrapWidget::injectActivePeerProfile(not_null<PeerData*> peer) {
|
||||
const auto firstPeerId = hasStackHistory()
|
||||
? _historyStack.front().section->peerId()
|
||||
: _controller->peerId();
|
||||
const auto firstPeer = hasStackHistory()
|
||||
? _historyStack.front().section->peer()
|
||||
: _controller->peer();
|
||||
const auto firstSectionType = hasStackHistory()
|
||||
? _historyStack.front().section->section().type()
|
||||
: _controller->section().type();
|
||||
|
@ -160,12 +160,12 @@ void WrapWidget::injectActivePeerProfile(not_null<PeerData*> peer) {
|
|||
: Section::MediaType::kCount;
|
||||
if (firstSectionType != expectedType
|
||||
|| firstSectionMediaType != expectedMediaType
|
||||
|| firstPeerId != peer->id) {
|
||||
|| firstPeer != peer) {
|
||||
auto section = peer->isSelf()
|
||||
? Section(Section::MediaType::Photo)
|
||||
: Section(Section::Type::Profile);
|
||||
injectActiveProfileMemento(std::move(
|
||||
Memento(peer->id, section).takeStack().front()));
|
||||
Memento(peer, section).takeStack().front()));
|
||||
}
|
||||
}
|
||||
// // #feed
|
||||
|
@ -519,11 +519,11 @@ void WrapWidget::addProfileNotificationsButton() {
|
|||
(wrap() == Wrap::Layer
|
||||
? st::infoLayerTopBarNotifications
|
||||
: st::infoTopBarNotifications)));
|
||||
notifications->addClickHandler([peer] {
|
||||
const auto muteForSeconds = Auth().data().notifyIsMuted(peer)
|
||||
notifications->addClickHandler([=] {
|
||||
const auto muteForSeconds = peer->owner().notifyIsMuted(peer)
|
||||
? 0
|
||||
: Data::NotifySettings::kDefaultMutePeriod;
|
||||
Auth().data().updateNotifySettings(peer, muteForSeconds);
|
||||
peer->owner().updateNotifySettings(peer, muteForSeconds);
|
||||
});
|
||||
Profile::NotificationsEnabledValue(
|
||||
peer
|
||||
|
@ -908,9 +908,9 @@ bool WrapWidget::returnToFirstStackFrame(
|
|||
if (!hasStackHistory()) {
|
||||
return false;
|
||||
}
|
||||
auto firstPeerId = _historyStack.front().section->peerId();
|
||||
auto firstPeer = _historyStack.front().section->peer();
|
||||
auto firstSection = _historyStack.front().section->section();
|
||||
if (firstPeerId == memento->peerId()
|
||||
if (firstPeer == memento->peer()
|
||||
&& firstSection.type() == memento->section().type()
|
||||
&& firstSection.type() == Section::Type::Profile) {
|
||||
_historyStack.resize(1);
|
||||
|
|
|
@ -92,7 +92,7 @@ inline auto AddButton(
|
|||
tracker)->entity();
|
||||
result->addClickHandler([=] {
|
||||
navigation->showSection(
|
||||
Info::Memento(peer->id, Section(type)));
|
||||
Info::Memento(peer, Section(type)));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
@ -111,7 +111,7 @@ inline auto AddCommonGroupsButton(
|
|||
tracker)->entity();
|
||||
result->addClickHandler([=] {
|
||||
navigation->showSection(
|
||||
Info::Memento(user->id, Section::Type::CommonGroups));
|
||||
Info::Memento(user, Section::Type::CommonGroups));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/search_field_controller.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace Info {
|
||||
|
@ -37,16 +38,16 @@ Type TabIndexToType(int index) {
|
|||
|
||||
Memento::Memento(not_null<Controller*> controller)
|
||||
: Memento(
|
||||
controller->peerId(),
|
||||
controller->peer(),
|
||||
controller->migratedPeerId(),
|
||||
controller->section().mediaType()) {
|
||||
}
|
||||
|
||||
Memento::Memento(PeerId peerId, PeerId migratedPeerId, Type type)
|
||||
: ContentMemento(peerId, migratedPeerId)
|
||||
Memento::Memento(not_null<PeerData*> peer, PeerId migratedPeerId, Type type)
|
||||
: ContentMemento(peer, migratedPeerId)
|
||||
, _type(type) {
|
||||
_searchState.query.type = type;
|
||||
_searchState.query.peerId = peerId;
|
||||
_searchState.query.peerId = peer->id;
|
||||
_searchState.query.migratedPeerId = migratedPeerId;
|
||||
if (migratedPeerId) {
|
||||
_searchState.migratedList = Storage::SparseIdsList();
|
||||
|
|
|
@ -25,7 +25,7 @@ class InnerWidget;
|
|||
class Memento final : public ContentMemento {
|
||||
public:
|
||||
Memento(not_null<Controller*> controller);
|
||||
Memento(PeerId peerId, PeerId migratedPeerId, Type type);
|
||||
Memento(not_null<PeerData*> peer, PeerId migratedPeerId, Type type);
|
||||
|
||||
using SearchState = Api::DelayedSearchController::SavedState;
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ namespace Members {
|
|||
|
||||
Memento::Memento(not_null<Controller*> controller)
|
||||
: Memento(
|
||||
controller->peerId(),
|
||||
controller->peer(),
|
||||
controller->migratedPeerId()) {
|
||||
}
|
||||
|
||||
Memento::Memento(PeerId peerId, PeerId migratedPeerId)
|
||||
: ContentMemento(peerId, migratedPeerId) {
|
||||
Memento::Memento(not_null<PeerData*> peer, PeerId migratedPeerId)
|
||||
: ContentMemento(peer, migratedPeerId) {
|
||||
}
|
||||
|
||||
Section Memento::section() const {
|
||||
|
|
|
@ -24,7 +24,7 @@ using SavedState = Profile::MembersState;
|
|||
class Memento final : public ContentMemento {
|
||||
public:
|
||||
Memento(not_null<Controller*> controller);
|
||||
Memento(PeerId peerId, PeerId migratedPeerId);
|
||||
Memento(not_null<PeerData*> peer, PeerId migratedPeerId);
|
||||
|
||||
object_ptr<ContentWidget> createWidget(
|
||||
QWidget *parent,
|
||||
|
|
|
@ -840,7 +840,7 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
|
|||
MembersCountValue(channel) | tr::to_count());
|
||||
auto membersCallback = [=] {
|
||||
controller->showSection(Info::Memento(
|
||||
channel->id,
|
||||
channel,
|
||||
Section::Type::Members));
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupContent(
|
|||
_controller->parentController()));
|
||||
_cover->showSection(
|
||||
) | rpl::start_with_next([=](Section section) {
|
||||
_controller->showSection(Info::Memento(_peer->id, section));
|
||||
_controller->showSection(Info::Memento(_peer, section));
|
||||
}, _cover->lifetime());
|
||||
_cover->setOnlineCount(rpl::single(0));
|
||||
auto details = SetupDetails(_controller, parent, _peer);
|
||||
|
|
|
@ -150,9 +150,9 @@ rpl::producer<bool> NotificationsEnabledValue(not_null<PeerData*> peer) {
|
|||
peer,
|
||||
Notify::PeerUpdate::Flag::NotificationsEnabled
|
||||
) | rpl::map([] { return rpl::empty_value(); }),
|
||||
Auth().data().defaultNotifyUpdates(peer)
|
||||
) | rpl::map([peer] {
|
||||
return !Auth().data().notifyIsMuted(peer);
|
||||
peer->owner().defaultNotifyUpdates(peer)
|
||||
) | rpl::map([=] {
|
||||
return !peer->owner().notifyIsMuted(peer);
|
||||
}) | rpl::distinct_until_changed();
|
||||
}
|
||||
|
||||
|
@ -322,6 +322,7 @@ rpl::producer<int> SharedMediaCountValue(
|
|||
auto aroundId = 0;
|
||||
auto limit = 0;
|
||||
auto updated = SharedMediaMergedViewer(
|
||||
&peer->session(),
|
||||
SharedMediaMergedKey(
|
||||
SparseIdsMergedSlice::Key(
|
||||
peer->id,
|
||||
|
@ -391,7 +392,7 @@ rpl::producer<bool> ScamValue(not_null<PeerData*> peer) {
|
|||
// return rpl::single(
|
||||
// Data::FeedUpdate{ feed, Flag::Channels }
|
||||
// ) | rpl::then(
|
||||
// Auth().data().feedUpdated()
|
||||
// feed->owner().feedUpdated()
|
||||
// ) | rpl::filter([=](const Data::FeedUpdate &update) {
|
||||
// return (update.feed == feed) && (update.flag == Flag::Channels);
|
||||
// }) | rpl::filter([=] {
|
||||
|
|
|
@ -18,12 +18,12 @@ namespace Profile {
|
|||
|
||||
Memento::Memento(not_null<Controller*> controller)
|
||||
: Memento(
|
||||
controller->peerId(),
|
||||
controller->peer(),
|
||||
controller->migratedPeerId()) {
|
||||
}
|
||||
|
||||
Memento::Memento(PeerId peerId, PeerId migratedPeerId)
|
||||
: ContentMemento(peerId, migratedPeerId) {
|
||||
Memento::Memento(not_null<PeerData*> peer, PeerId migratedPeerId)
|
||||
: ContentMemento(peer, migratedPeerId) {
|
||||
}
|
||||
|
||||
Section Memento::section() const {
|
||||
|
|
|
@ -19,7 +19,7 @@ struct MembersState;
|
|||
class Memento final : public ContentMemento {
|
||||
public:
|
||||
Memento(not_null<Controller*> controller);
|
||||
Memento(PeerId peerId, PeerId migratedPeerId);
|
||||
Memento(not_null<PeerData*> peer, PeerId migratedPeerId);
|
||||
|
||||
object_ptr<ContentWidget> createWidget(
|
||||
QWidget *parent,
|
||||
|
|
|
@ -111,13 +111,13 @@ std::unique_ptr<Result> Result::Create(
|
|||
if (const auto content = r.vcontent()) {
|
||||
result->_content_url = GetContentUrl(*content);
|
||||
if (result->_type == Type::Photo) {
|
||||
result->_photo = Auth().data().photoFromWeb(
|
||||
result->_photo = session->data().photoFromWeb(
|
||||
*content,
|
||||
(imageThumb
|
||||
? Images::FromWebDocument(*r.vthumb())
|
||||
: ImageLocation()));
|
||||
} else if (contentMime != "text/html"_q) {
|
||||
result->_document = Auth().data().documentFromWeb(
|
||||
result->_document = session->data().documentFromWeb(
|
||||
result->adjustAttributes(*content),
|
||||
(imageThumb
|
||||
? Images::FromWebDocument(*r.vthumb())
|
||||
|
@ -140,10 +140,10 @@ std::unique_ptr<Result> Result::Create(
|
|||
result->_title = qs(r.vtitle().value_or_empty());
|
||||
result->_description = qs(r.vdescription().value_or_empty());
|
||||
if (const auto photo = r.vphoto()) {
|
||||
result->_photo = Auth().data().processPhoto(*photo);
|
||||
result->_photo = session->data().processPhoto(*photo);
|
||||
}
|
||||
if (const auto document = r.vdocument()) {
|
||||
result->_document = Auth().data().processDocument(*document);
|
||||
result->_document = session->data().processDocument(*document);
|
||||
}
|
||||
message = &r.vsend_message();
|
||||
} break;
|
||||
|
@ -186,7 +186,7 @@ std::unique_ptr<Result> Result::Create(
|
|||
message,
|
||||
entities);
|
||||
} else if (result->_type == Type::Game) {
|
||||
result->createGame();
|
||||
result->createGame(session);
|
||||
result->sendData = std::make_unique<internal::SendGame>(
|
||||
session,
|
||||
result->_game);
|
||||
|
@ -412,11 +412,13 @@ QString Result::getLayoutDescription() const {
|
|||
Result::~Result() {
|
||||
}
|
||||
|
||||
void Result::createGame() {
|
||||
if (_game) return;
|
||||
void Result::createGame(not_null<Main::Session*> session) {
|
||||
if (_game) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto gameId = rand_value<GameId>();
|
||||
_game = Auth().data().game(
|
||||
_game = session->data().game(
|
||||
gameId,
|
||||
0,
|
||||
QString(),
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
~Result();
|
||||
|
||||
private:
|
||||
void createGame();
|
||||
void createGame(not_null<Main::Session*> session);
|
||||
QSize thumbBox() const;
|
||||
MTPWebDocument adjustAttributes(const MTPWebDocument &document);
|
||||
MTPVector<MTPDocumentAttribute> adjustAttributes(
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Intro {
|
|||
namespace details {
|
||||
namespace {
|
||||
|
||||
void PrepareSupportMode() {
|
||||
void PrepareSupportMode(not_null<Main::Session*> session) {
|
||||
using ::Data::AutoDownload::Full;
|
||||
|
||||
anim::SetDisabled(true);
|
||||
|
@ -41,7 +41,7 @@ void PrepareSupportMode() {
|
|||
Global::SetDesktopNotify(false);
|
||||
Global::SetSoundNotify(false);
|
||||
Global::SetFlashBounceNotify(false);
|
||||
Auth().settings().autoDownload() = Full::FullDisabled();
|
||||
session->settings().autoDownload() = Full::FullDisabled();
|
||||
Local::writeUserSettings();
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ void Step::finish(const MTPUser &user, QImage &&photo) {
|
|||
session.api().uploadPeerPhoto(session.user(), std::move(photo));
|
||||
}
|
||||
if (session.supportMode()) {
|
||||
PrepareSupportMode();
|
||||
PrepareSupportMode(&session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2571,7 +2571,7 @@ auto MainWidget::thirdSectionForCurrentMainSection(
|
|||
return std::move(_thirdSectionFromStack);
|
||||
} else if (const auto peer = key.peer()) {
|
||||
return std::make_unique<Info::Memento>(
|
||||
peer->id,
|
||||
peer,
|
||||
Info::Memento::DefaultSection(peer));
|
||||
//} else if (const auto feed = key.feed()) { // #feed
|
||||
// return std::make_unique<Info::Memento>(
|
||||
|
|
|
@ -176,7 +176,9 @@ void Instance::setCurrent(const AudioMsgId &audioId) {
|
|||
data->current = audioId;
|
||||
data->isPlaying = false;
|
||||
|
||||
const auto item = Auth().data().message(data->current.contextId());
|
||||
const auto item = (audioId.audio() && audioId.contextId())
|
||||
? audioId.audio()->owner().message(audioId.contextId())
|
||||
: nullptr;
|
||||
if (item) {
|
||||
data->history = item->history()->migrateToOrMe();
|
||||
data->migrated = data->history->migrateFrom();
|
||||
|
@ -264,6 +266,7 @@ void Instance::validatePlaylist(not_null<Data*> data) {
|
|||
if (const auto key = playlistKey(data)) {
|
||||
data->playlistRequestedKey = key;
|
||||
SharedMediaMergedViewer(
|
||||
&data->history->session(),
|
||||
SharedMediaMergedKey(*key, data->overview),
|
||||
kIdsLimit,
|
||||
kIdsLimit
|
||||
|
@ -302,8 +305,9 @@ HistoryItem *Instance::itemByIndex(not_null<Data*> data, int index) {
|
|||
|| index >= data->playlistSlice->size()) {
|
||||
return nullptr;
|
||||
}
|
||||
Assert(data->history != nullptr);
|
||||
const auto fullId = (*data->playlistSlice)[index];
|
||||
return Auth().data().message(fullId);
|
||||
return data->history->owner().message(fullId);
|
||||
}
|
||||
|
||||
bool Instance::moveInPlaylist(
|
||||
|
@ -740,20 +744,21 @@ void Instance::handleStreamingUpdate(
|
|||
HistoryItem *Instance::roundVideoItem() const {
|
||||
const auto data = getData(AudioMsgId::Type::Voice);
|
||||
return (data->streamed
|
||||
&& !data->streamed->instance.info().video.size.isEmpty())
|
||||
? Auth().data().message(data->streamed->id.contextId())
|
||||
&& !data->streamed->instance.info().video.size.isEmpty()
|
||||
&& data->history)
|
||||
? data->history->owner().message(data->streamed->id.contextId())
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
void Instance::requestRoundVideoResize() const {
|
||||
if (const auto item = roundVideoItem()) {
|
||||
Auth().data().requestItemResize(item);
|
||||
item->history()->owner().requestItemResize(item);
|
||||
}
|
||||
}
|
||||
|
||||
void Instance::requestRoundVideoRepaint() const {
|
||||
if (const auto item = roundVideoItem()) {
|
||||
Auth().data().requestItemRepaint(item);
|
||||
item->history()->owner().requestItemRepaint(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ void Panel::refreshList() {
|
|||
}, weak->lifetime());
|
||||
|
||||
auto memento = Info::Media::Memento(
|
||||
peerId(),
|
||||
peer,
|
||||
migratedPeerId(),
|
||||
section().mediaType());
|
||||
memento.setAroundId(contextId);
|
||||
|
|
|
@ -302,9 +302,13 @@ void Widget::mouseReleaseEvent(QMouseEvent *e) {
|
|||
if (auto downLabels = base::take(_labelsDown)) {
|
||||
if (_labelsOver == downLabels) {
|
||||
if (_type == AudioMsgId::Type::Voice) {
|
||||
auto current = instance()->current(_type);
|
||||
if (auto item = Auth().data().message(current.contextId())) {
|
||||
Ui::showPeerHistoryAtItem(item);
|
||||
const auto current = instance()->current(_type);
|
||||
const auto document = current.audio();
|
||||
const auto context = current.contextId();
|
||||
if (document && context) {
|
||||
if (const auto item = document->owner().message(context)) {
|
||||
Ui::showPeerHistoryAtItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +520,7 @@ void Widget::handleSongChange() {
|
|||
|
||||
TextWithEntities textWithEntities;
|
||||
if (document->isVoiceMessage() || document->isVideoMessage()) {
|
||||
if (const auto item = Auth().data().message(current.contextId())) {
|
||||
if (const auto item = document->owner().message(current.contextId())) {
|
||||
const auto name = item->fromOriginal()->name;
|
||||
const auto date = [item] {
|
||||
const auto parsed = ItemDateTime(item);
|
||||
|
|
|
@ -1589,12 +1589,15 @@ bool OverlayWidget::validSharedMedia() const {
|
|||
}
|
||||
|
||||
void OverlayWidget::validateSharedMedia() {
|
||||
if (auto key = sharedMediaKey()) {
|
||||
if (const auto key = sharedMediaKey()) {
|
||||
Assert(_history != nullptr);
|
||||
|
||||
_sharedMedia = std::make_unique<SharedMedia>(*key);
|
||||
auto viewer = (key->type == SharedMediaType::ChatPhoto)
|
||||
? SharedMediaWithLastReversedViewer
|
||||
: SharedMediaWithLastViewer;
|
||||
viewer(
|
||||
&_history->session(),
|
||||
*key,
|
||||
kIdsLimit,
|
||||
kIdsLimit
|
||||
|
@ -1656,8 +1659,11 @@ bool OverlayWidget::validUserPhotos() const {
|
|||
|
||||
void OverlayWidget::validateUserPhotos() {
|
||||
if (const auto key = userPhotosKey()) {
|
||||
Assert(_user != nullptr);
|
||||
|
||||
_userPhotos = std::make_unique<UserPhotos>(*key);
|
||||
UserPhotosReversedViewer(
|
||||
&_user->session(),
|
||||
*key,
|
||||
kIdsLimit,
|
||||
kIdsLimit
|
||||
|
|
|
@ -339,6 +339,7 @@ FormRequest::FormRequest(
|
|||
}
|
||||
|
||||
EditFile::EditFile(
|
||||
not_null<Main::Session*> session,
|
||||
not_null<const Value*> value,
|
||||
FileType type,
|
||||
const File &fields,
|
||||
|
@ -346,13 +347,15 @@ EditFile::EditFile(
|
|||
: value(value)
|
||||
, type(type)
|
||||
, fields(std::move(fields))
|
||||
, uploadData(std::move(uploadData))
|
||||
, uploadData(session, std::move(uploadData))
|
||||
, guard(std::make_shared<bool>(true)) {
|
||||
}
|
||||
|
||||
UploadScanDataPointer::UploadScanDataPointer(
|
||||
not_null<Main::Session*> session,
|
||||
std::unique_ptr<UploadScanData> &&value)
|
||||
: _value(std::move(value)) {
|
||||
: _session(session)
|
||||
, _value(std::move(value)) {
|
||||
}
|
||||
|
||||
UploadScanDataPointer::UploadScanDataPointer(
|
||||
|
@ -364,7 +367,7 @@ UploadScanDataPointer &UploadScanDataPointer::operator=(
|
|||
UploadScanDataPointer::~UploadScanDataPointer() {
|
||||
if (const auto value = _value.get()) {
|
||||
if (const auto fullId = value->fullId) {
|
||||
Auth().uploader().cancel(fullId);
|
||||
_session->uploader().cancel(fullId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -460,12 +463,12 @@ int Value::whatNotFilled() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void Value::saveInEdit() {
|
||||
void Value::saveInEdit(not_null<Main::Session*> session) {
|
||||
const auto saveList = [&](FileType type) {
|
||||
filesInEdit(type) = ranges::view::all(
|
||||
files(type)
|
||||
) | ranges::view::transform([=](const File &file) {
|
||||
return EditFile(this, type, file, nullptr);
|
||||
return EditFile(session, this, type, file, nullptr);
|
||||
}) | ranges::to_vector;
|
||||
};
|
||||
saveList(FileType::Scan);
|
||||
|
@ -474,6 +477,7 @@ void Value::saveInEdit() {
|
|||
specialScansInEdit.clear();
|
||||
for (const auto &[type, scan] : specialScans) {
|
||||
specialScansInEdit.emplace(type, EditFile(
|
||||
session,
|
||||
this,
|
||||
type,
|
||||
scan,
|
||||
|
@ -627,6 +631,10 @@ FormController::FormController(
|
|||
, _view(std::make_unique<PanelController>(this)) {
|
||||
}
|
||||
|
||||
Main::Session &FormController::session() const {
|
||||
return _controller->session();
|
||||
}
|
||||
|
||||
void FormController::show() {
|
||||
requestForm();
|
||||
requestPassword();
|
||||
|
@ -876,7 +884,7 @@ void FormController::submitPassword(
|
|||
saved.hashForAuth = base::take(_passwordCheckHash);
|
||||
saved.hashForSecret = hashForSecret;
|
||||
saved.secretId = _secretId;
|
||||
Auth().data().rememberPassportCredentials(
|
||||
session().data().rememberPassportCredentials(
|
||||
std::move(saved),
|
||||
kRememberCredentialsDelay);
|
||||
}
|
||||
|
@ -963,7 +971,7 @@ void FormController::checkSavedPasswordSettings(
|
|||
}
|
||||
}
|
||||
if (_secret.empty()) {
|
||||
Auth().data().forgetPassportCredentials();
|
||||
session().data().forgetPassportCredentials();
|
||||
showForm();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
|
@ -971,7 +979,7 @@ void FormController::checkSavedPasswordSettings(
|
|||
if (error.type() != qstr("SRP_ID_INVALID")
|
||||
|| !handleSrpIdInvalid(_passwordCheckRequestId)) {
|
||||
} else {
|
||||
Auth().data().forgetPassportCredentials();
|
||||
session().data().forgetPassportCredentials();
|
||||
showForm();
|
||||
}
|
||||
}).send();
|
||||
|
@ -1366,7 +1374,12 @@ void FormController::uploadScan(
|
|||
}
|
||||
const auto nonconst = findValue(value);
|
||||
const auto fileIndex = [&]() -> std::optional<int> {
|
||||
auto scanInEdit = EditFile{ nonconst, type, File(), nullptr };
|
||||
auto scanInEdit = EditFile(
|
||||
&session(),
|
||||
nonconst,
|
||||
type,
|
||||
File(),
|
||||
nullptr);
|
||||
if (type == FileType::Scan || type == FileType::Translation) {
|
||||
auto &list = nonconst->filesInEdit(type);
|
||||
auto scanIndex = int(list.size());
|
||||
|
@ -1494,17 +1507,17 @@ void FormController::subscribeToUploader() {
|
|||
|
||||
using namespace Storage;
|
||||
|
||||
Auth().uploader().secureReady(
|
||||
session().uploader().secureReady(
|
||||
) | rpl::start_with_next([=](const UploadSecureDone &data) {
|
||||
scanUploadDone(data);
|
||||
}, _uploaderSubscriptions);
|
||||
|
||||
Auth().uploader().secureProgress(
|
||||
session().uploader().secureProgress(
|
||||
) | rpl::start_with_next([=](const UploadSecureProgress &data) {
|
||||
scanUploadProgress(data);
|
||||
}, _uploaderSubscriptions);
|
||||
|
||||
Auth().uploader().secureFailed(
|
||||
session().uploader().secureFailed(
|
||||
) | rpl::start_with_next([=](const FullMsgId &fullId) {
|
||||
scanUploadFail(fullId);
|
||||
}, _uploaderSubscriptions);
|
||||
|
@ -1515,7 +1528,9 @@ void FormController::uploadEncryptedFile(
|
|||
UploadScanData &&data) {
|
||||
subscribeToUploader();
|
||||
|
||||
file.uploadData = std::make_unique<UploadScanData>(std::move(data));
|
||||
file.uploadData = UploadScanDataPointer(
|
||||
&session(),
|
||||
std::make_unique<UploadScanData>(std::move(data)));
|
||||
|
||||
auto prepared = std::make_shared<FileLoadResult>(
|
||||
TaskId(),
|
||||
|
@ -1532,8 +1547,10 @@ void FormController::uploadEncryptedFile(
|
|||
|
||||
file.uploadData->fullId = FullMsgId(
|
||||
0,
|
||||
Auth().data().nextLocalMessageId());
|
||||
Auth().uploader().upload(file.uploadData->fullId, std::move(prepared));
|
||||
session().data().nextLocalMessageId());
|
||||
session().uploader().upload(
|
||||
file.uploadData->fullId,
|
||||
std::move(prepared));
|
||||
}
|
||||
|
||||
void FormController::scanUploadDone(const Storage::UploadSecureDone &data) {
|
||||
|
@ -1583,7 +1600,7 @@ QString FormController::defaultEmail() const {
|
|||
}
|
||||
|
||||
QString FormController::defaultPhoneNumber() const {
|
||||
return Auth().user()->phone();
|
||||
return session().user()->phone();
|
||||
}
|
||||
|
||||
auto FormController::scanUpdated() const
|
||||
|
@ -1705,7 +1722,7 @@ void FormController::startValueEdit(not_null<const Value*> value) {
|
|||
loadFile(scan);
|
||||
}
|
||||
}
|
||||
nonconst->saveInEdit();
|
||||
nonconst->saveInEdit(&session());
|
||||
}
|
||||
|
||||
void FormController::loadFile(File &file) {
|
||||
|
@ -1725,7 +1742,7 @@ void FormController::loadFile(File &file) {
|
|||
std::make_unique<mtpFileLoader>(
|
||||
StorageFileLocation(
|
||||
file.dcId,
|
||||
Auth().userId(),
|
||||
session().userId(),
|
||||
MTP_inputSecureFileLocation(
|
||||
MTP_long(file.id),
|
||||
MTP_long(file.accessHash))),
|
||||
|
@ -2235,7 +2252,7 @@ void FormController::saveSecret(
|
|||
MTP_bytes(encryptedSecret),
|
||||
MTP_long(saved.secretId)))
|
||||
)).done([=](const MTPBool &result) {
|
||||
Auth().data().rememberPassportCredentials(
|
||||
session().data().rememberPassportCredentials(
|
||||
std::move(saved),
|
||||
kRememberCredentialsDelay);
|
||||
|
||||
|
@ -2342,7 +2359,7 @@ void FormController::fillDownloadedFile(
|
|||
if (bytes.size() > Storage::kMaxFileInMemory) {
|
||||
return;
|
||||
}
|
||||
Auth().data().cache().put(
|
||||
session().data().cache().put(
|
||||
Data::DocumentCacheKey(destination.dcId, destination.id),
|
||||
Storage::Cache::Database::TaggedValue(
|
||||
QByteArray(
|
||||
|
@ -2495,7 +2512,7 @@ bool FormController::parseForm(const MTPaccount_AuthorizationForm &result) {
|
|||
|
||||
const auto &data = result.c_account_authorizationForm();
|
||||
|
||||
Auth().data().processUsers(data.vusers());
|
||||
session().data().processUsers(data.vusers());
|
||||
|
||||
for (const auto &value : data.vvalues().v) {
|
||||
auto parsed = parseValue(value);
|
||||
|
@ -2529,7 +2546,7 @@ bool FormController::parseForm(const MTPaccount_AuthorizationForm &result) {
|
|||
if (!ValidateForm(_form)) {
|
||||
return false;
|
||||
}
|
||||
_bot = Auth().data().userLoaded(_request.botId);
|
||||
_bot = session().data().userLoaded(_request.botId);
|
||||
_form.pendingErrors = data.verrors().v;
|
||||
return true;
|
||||
}
|
||||
|
@ -2597,7 +2614,7 @@ void FormController::showForm() {
|
|||
} else if (_password.request) {
|
||||
if (!_savedPasswordValue.isEmpty()) {
|
||||
submitPassword(base::duplicate(_savedPasswordValue));
|
||||
} else if (const auto saved = Auth().data().passportCredentials()) {
|
||||
} else if (const auto saved = session().data().passportCredentials()) {
|
||||
checkSavedPasswordSettings(*saved);
|
||||
} else {
|
||||
_view->showAskPassword();
|
||||
|
|
|
@ -23,6 +23,10 @@ namespace Window {
|
|||
class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Passport {
|
||||
|
||||
struct Config {
|
||||
|
@ -73,7 +77,9 @@ struct UploadScanData {
|
|||
|
||||
class UploadScanDataPointer {
|
||||
public:
|
||||
UploadScanDataPointer(std::unique_ptr<UploadScanData> &&value);
|
||||
UploadScanDataPointer(
|
||||
not_null<Main::Session*> session,
|
||||
std::unique_ptr<UploadScanData> &&value);
|
||||
UploadScanDataPointer(UploadScanDataPointer &&other);
|
||||
UploadScanDataPointer &operator=(UploadScanDataPointer &&other);
|
||||
~UploadScanDataPointer();
|
||||
|
@ -84,6 +90,7 @@ public:
|
|||
UploadScanData *operator->() const;
|
||||
|
||||
private:
|
||||
not_null<Main::Session*> _session;
|
||||
std::unique_ptr<UploadScanData> _value;
|
||||
|
||||
};
|
||||
|
@ -115,6 +122,7 @@ struct File {
|
|||
|
||||
struct EditFile {
|
||||
EditFile(
|
||||
not_null<Main::Session*> session,
|
||||
not_null<const Value*> value,
|
||||
FileType type,
|
||||
const File &fields,
|
||||
|
@ -188,7 +196,7 @@ struct Value {
|
|||
bool requiresSpecialScan(FileType type) const;
|
||||
bool requiresScan(FileType type) const;
|
||||
bool scansAreFilled() const;
|
||||
void saveInEdit();
|
||||
void saveInEdit(not_null<Main::Session*> session);
|
||||
void clearEditData();
|
||||
bool uploadingScan() const;
|
||||
bool saving() const;
|
||||
|
@ -324,9 +332,10 @@ public:
|
|||
not_null<Window::SessionController*> controller,
|
||||
const FormRequest &request);
|
||||
|
||||
not_null<Window::SessionController*> window() const {
|
||||
[[nodiscard]] not_null<Window::SessionController*> window() const {
|
||||
return _controller;
|
||||
}
|
||||
[[nodiscard]] Main::Session &session() const;
|
||||
|
||||
void show();
|
||||
UserData *bot() const;
|
||||
|
|
|
@ -598,7 +598,7 @@ void ChatBackground::checkUploadWallPaper() {
|
|||
LOG(("API Error: "
|
||||
"Got wallPaperNoFile after account.UploadWallPaper."));
|
||||
});
|
||||
if (const auto paper = Data::WallPaper::Create(result)) {
|
||||
if (const auto paper = Data::WallPaper::Create(_session, result)) {
|
||||
setPaper(*paper);
|
||||
writeNewBackgroundSettings();
|
||||
notify(BackgroundUpdate(BackgroundUpdate::Type::New, tile()));
|
||||
|
|
|
@ -68,18 +68,18 @@ Main::Session &SessionNavigation::session() const {
|
|||
void SessionNavigation::showPeerInfo(
|
||||
PeerId peerId,
|
||||
const SectionShow ¶ms) {
|
||||
//if (Adaptive::ThreeColumn()
|
||||
// && !_session->settings().thirdSectionInfoEnabled()) {
|
||||
// _session->settings().setThirdSectionInfoEnabled(true);
|
||||
// _session->saveSettingsDelayed();
|
||||
//}
|
||||
showSection(Info::Memento(peerId), params);
|
||||
showPeerInfo(_session->data().peer(peerId), params);
|
||||
}
|
||||
|
||||
void SessionNavigation::showPeerInfo(
|
||||
not_null<PeerData*> peer,
|
||||
const SectionShow ¶ms) {
|
||||
showPeerInfo(peer->id, params);
|
||||
//if (Adaptive::ThreeColumn()
|
||||
// && !_session->settings().thirdSectionInfoEnabled()) {
|
||||
// _session->settings().setThirdSectionInfoEnabled(true);
|
||||
// _session->saveSettingsDelayed();
|
||||
//}
|
||||
showSection(Info::Memento(peer), params);
|
||||
}
|
||||
|
||||
void SessionNavigation::showPeerInfo(
|
||||
|
|
Loading…
Add table
Reference in a new issue