mirror of https://github.com/procxx/kepka.git
Move non-settings session data to Data::Session.
Rename AuthSessionData to AuthSessionSettings, move data away.
This commit is contained in:
parent
724fe65d72
commit
6a9556d42c
|
@ -36,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_sparse_ids.h"
|
||||
#include "data/data_search_controller.h"
|
||||
#include "data/data_channel_admins.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_boxes.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/data_abstract_structure.h"
|
||||
#include "data/data_session.h"
|
||||
#include "history/history_service_layout.h"
|
||||
#include "history/history_location_manager.h"
|
||||
#include "history/history_media_types.h"
|
||||
|
|
|
@ -15,8 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/localstorage.h"
|
||||
#include "storage/storage_facade.h"
|
||||
#include "storage/serialize_common.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "data/data_session.h"
|
||||
#include "window/notifications_manager.h"
|
||||
#include "window/themes/window_theme.h"
|
||||
#include "platform/platform_specific.h"
|
||||
|
@ -24,7 +23,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/section_widget.h"
|
||||
#include "chat_helpers/tabbed_selector.h"
|
||||
#include "boxes/send_files_box.h"
|
||||
#include "observer_peer.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -32,28 +30,14 @@ constexpr auto kAutoLockTimeoutLateMs = TimeMs(3000);
|
|||
|
||||
} // namespace
|
||||
|
||||
AuthSessionData::AuthSessionData() {
|
||||
Notify::PeerUpdateViewer(
|
||||
Notify::PeerUpdate::Flag::UserIsContact
|
||||
) | rpl::map([](const Notify::PeerUpdate &update) {
|
||||
return update.peer->asUser();
|
||||
}) | rpl::filter([](UserData *user) {
|
||||
return user != nullptr;
|
||||
}) | rpl::start_with_next([=](not_null<UserData*> user) {
|
||||
userIsContactUpdated(user);
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
AuthSessionData::~AuthSessionData() = default;
|
||||
|
||||
AuthSessionData::Variables::Variables()
|
||||
AuthSessionSettings::Variables::Variables()
|
||||
: sendFilesWay(SendFilesWay::Album)
|
||||
, selectorTab(ChatHelpers::SelectorTab::Emoji)
|
||||
, floatPlayerColumn(Window::Column::Second)
|
||||
, floatPlayerCorner(RectPart::TopRight) {
|
||||
}
|
||||
|
||||
QByteArray AuthSessionData::serialize() const {
|
||||
QByteArray AuthSessionSettings::serialize() const {
|
||||
auto size = sizeof(qint32) * 10;
|
||||
for (auto i = _variables.soundOverrides.cbegin(), e = _variables.soundOverrides.cend(); i != e; ++i) {
|
||||
size += Serialize::stringSize(i.key()) + Serialize::stringSize(i.value());
|
||||
|
@ -92,7 +76,7 @@ QByteArray AuthSessionData::serialize() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void AuthSessionData::constructFromSerialized(const QByteArray &serialized) {
|
||||
void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized) {
|
||||
if (serialized.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -162,7 +146,8 @@ void AuthSessionData::constructFromSerialized(const QByteArray &serialized) {
|
|||
thirdSectionExtendedBy = value;
|
||||
}
|
||||
if (stream.status() != QDataStream::Ok) {
|
||||
LOG(("App Error: Bad data for AuthSessionData::constructFromSerialized()"));
|
||||
LOG(("App Error: "
|
||||
"Bad data for AuthSessionSettings::constructFromSerialized()"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -206,87 +191,7 @@ void AuthSessionData::constructFromSerialized(const QByteArray &serialized) {
|
|||
}
|
||||
}
|
||||
|
||||
void AuthSessionData::markItemLayoutChanged(not_null<const HistoryItem*> item) {
|
||||
_itemLayoutChanged.fire_copy(item);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> AuthSessionData::itemLayoutChanged() const {
|
||||
return _itemLayoutChanged.events();
|
||||
}
|
||||
|
||||
void AuthSessionData::requestItemRepaint(not_null<const HistoryItem*> item) {
|
||||
_itemRepaintRequest.fire_copy(item);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> AuthSessionData::itemRepaintRequest() const {
|
||||
return _itemRepaintRequest.events();
|
||||
}
|
||||
|
||||
void AuthSessionData::markItemRemoved(not_null<const HistoryItem*> item) {
|
||||
_itemRemoved.fire_copy(item);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> AuthSessionData::itemRemoved() const {
|
||||
return _itemRemoved.events();
|
||||
}
|
||||
|
||||
void AuthSessionData::markHistoryUnloaded(not_null<const History*> history) {
|
||||
_historyUnloaded.fire_copy(history);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const History*>> AuthSessionData::historyUnloaded() const {
|
||||
return _historyUnloaded.events();
|
||||
}
|
||||
|
||||
void AuthSessionData::markHistoryCleared(not_null<const History*> history) {
|
||||
_historyCleared.fire_copy(history);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const History*>> AuthSessionData::historyCleared() const {
|
||||
return _historyCleared.events();
|
||||
}
|
||||
|
||||
void AuthSessionData::removeMegagroupParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> user) {
|
||||
_megagroupParticipantRemoved.fire({ channel, user });
|
||||
}
|
||||
|
||||
auto AuthSessionData::megagroupParticipantRemoved() const -> rpl::producer<MegagroupParticipant> {
|
||||
return _megagroupParticipantRemoved.events();
|
||||
}
|
||||
|
||||
rpl::producer<not_null<UserData*>> AuthSessionData::megagroupParticipantRemoved(
|
||||
not_null<ChannelData*> channel) const {
|
||||
return megagroupParticipantRemoved(
|
||||
) | rpl::filter([channel](auto updateChannel, auto user) {
|
||||
return (updateChannel == channel);
|
||||
}) | rpl::map([](auto updateChannel, auto user) {
|
||||
return user;
|
||||
});
|
||||
}
|
||||
|
||||
void AuthSessionData::addNewMegagroupParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> user) {
|
||||
_megagroupParticipantAdded.fire({ channel, user });
|
||||
}
|
||||
|
||||
auto AuthSessionData::megagroupParticipantAdded() const -> rpl::producer<MegagroupParticipant> {
|
||||
return _megagroupParticipantAdded.events();
|
||||
}
|
||||
|
||||
rpl::producer<not_null<UserData*>> AuthSessionData::megagroupParticipantAdded(
|
||||
not_null<ChannelData*> channel) const {
|
||||
return megagroupParticipantAdded(
|
||||
) | rpl::filter([channel](auto updateChannel, auto user) {
|
||||
return (updateChannel == channel);
|
||||
}) | rpl::map([](auto updateChannel, auto user) {
|
||||
return user;
|
||||
});
|
||||
}
|
||||
|
||||
void AuthSessionData::setTabbedSelectorSectionEnabled(bool enabled) {
|
||||
void AuthSessionSettings::setTabbedSelectorSectionEnabled(bool enabled) {
|
||||
_variables.tabbedSelectorSectionEnabled = enabled;
|
||||
if (enabled) {
|
||||
setThirdSectionInfoEnabled(false);
|
||||
|
@ -294,12 +199,12 @@ void AuthSessionData::setTabbedSelectorSectionEnabled(bool enabled) {
|
|||
setTabbedReplacedWithInfo(false);
|
||||
}
|
||||
|
||||
rpl::producer<bool> AuthSessionData::tabbedReplacedWithInfoValue() const {
|
||||
rpl::producer<bool> AuthSessionSettings::tabbedReplacedWithInfoValue() const {
|
||||
return _tabbedReplacedWithInfoValue.events_starting_with(
|
||||
tabbedReplacedWithInfo());
|
||||
}
|
||||
|
||||
void AuthSessionData::setThirdSectionInfoEnabled(bool enabled) {
|
||||
void AuthSessionSettings::setThirdSectionInfoEnabled(bool enabled) {
|
||||
if (_variables.thirdSectionInfoEnabled != enabled) {
|
||||
_variables.thirdSectionInfoEnabled = enabled;
|
||||
if (enabled) {
|
||||
|
@ -310,19 +215,19 @@ void AuthSessionData::setThirdSectionInfoEnabled(bool enabled) {
|
|||
}
|
||||
}
|
||||
|
||||
rpl::producer<bool> AuthSessionData::thirdSectionInfoEnabledValue() const {
|
||||
rpl::producer<bool> AuthSessionSettings::thirdSectionInfoEnabledValue() const {
|
||||
return _thirdSectionInfoEnabledValue.events_starting_with(
|
||||
thirdSectionInfoEnabled());
|
||||
}
|
||||
|
||||
void AuthSessionData::setTabbedReplacedWithInfo(bool enabled) {
|
||||
void AuthSessionSettings::setTabbedReplacedWithInfo(bool enabled) {
|
||||
if (_tabbedReplacedWithInfo != enabled) {
|
||||
_tabbedReplacedWithInfo = enabled;
|
||||
_tabbedReplacedWithInfoValue.fire_copy(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
QString AuthSessionData::getSoundPath(const QString &key) const {
|
||||
QString AuthSessionSettings::getSoundPath(const QString &key) const {
|
||||
auto it = _variables.soundOverrides.constFind(key);
|
||||
if (it != _variables.soundOverrides.end()) {
|
||||
return it.value();
|
||||
|
@ -330,100 +235,30 @@ QString AuthSessionData::getSoundPath(const QString &key) const {
|
|||
return qsl(":/sounds/") + key + qsl(".mp3");
|
||||
}
|
||||
|
||||
void AuthSessionData::setDialogsWidthRatio(float64 ratio) {
|
||||
void AuthSessionSettings::setDialogsWidthRatio(float64 ratio) {
|
||||
_variables.dialogsWidthRatio = ratio;
|
||||
}
|
||||
|
||||
float64 AuthSessionData::dialogsWidthRatio() const {
|
||||
float64 AuthSessionSettings::dialogsWidthRatio() const {
|
||||
return _variables.dialogsWidthRatio.current();
|
||||
}
|
||||
|
||||
rpl::producer<float64> AuthSessionData::dialogsWidthRatioChanges() const {
|
||||
rpl::producer<float64> AuthSessionSettings::dialogsWidthRatioChanges() const {
|
||||
return _variables.dialogsWidthRatio.changes();
|
||||
}
|
||||
|
||||
void AuthSessionData::setThirdColumnWidth(int width) {
|
||||
void AuthSessionSettings::setThirdColumnWidth(int width) {
|
||||
_variables.thirdColumnWidth = width;
|
||||
}
|
||||
|
||||
int AuthSessionData::thirdColumnWidth() const {
|
||||
int AuthSessionSettings::thirdColumnWidth() const {
|
||||
return _variables.thirdColumnWidth.current();
|
||||
}
|
||||
|
||||
rpl::producer<int> AuthSessionData::thirdColumnWidthChanges() const {
|
||||
rpl::producer<int> AuthSessionSettings::thirdColumnWidthChanges() const {
|
||||
return _variables.thirdColumnWidth.changes();
|
||||
}
|
||||
|
||||
void AuthSessionData::markStickersUpdated() {
|
||||
_stickersUpdated.fire({});
|
||||
}
|
||||
|
||||
rpl::producer<> AuthSessionData::stickersUpdated() const {
|
||||
return _stickersUpdated.events();
|
||||
}
|
||||
|
||||
void AuthSessionData::markSavedGifsUpdated() {
|
||||
_savedGifsUpdated.fire({});
|
||||
}
|
||||
|
||||
rpl::producer<> AuthSessionData::savedGifsUpdated() const {
|
||||
return _savedGifsUpdated.events();
|
||||
}
|
||||
|
||||
void AuthSessionData::userIsContactUpdated(not_null<UserData*> user) {
|
||||
const auto &items = App::sharedContactItems();
|
||||
const auto i = items.constFind(peerToUser(user->id));
|
||||
if (i != items.cend()) {
|
||||
for (const auto item : std::as_const(i.value())) {
|
||||
item->setPendingInitDimensions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HistoryItemsList AuthSessionData::idsToItems(
|
||||
const MessageIdsList &ids) const {
|
||||
return ranges::view::all(
|
||||
ids
|
||||
) | ranges::view::transform([](const FullMsgId &fullId) {
|
||||
return App::histItemById(fullId);
|
||||
}) | ranges::view::filter([](HistoryItem *item) {
|
||||
return item != nullptr;
|
||||
}) | ranges::view::transform([](HistoryItem *item) {
|
||||
return not_null<HistoryItem*>(item);
|
||||
}) | ranges::to_vector;
|
||||
}
|
||||
|
||||
MessageIdsList AuthSessionData::itemsToIds(
|
||||
const HistoryItemsList &items) const {
|
||||
return ranges::view::all(
|
||||
items
|
||||
) | ranges::view::transform([](not_null<HistoryItem*> item) {
|
||||
return item->fullId();
|
||||
}) | ranges::to_vector;
|
||||
}
|
||||
|
||||
MessageIdsList AuthSessionData::groupToIds(
|
||||
not_null<HistoryMessageGroup*> group) const {
|
||||
auto result = itemsToIds(group->others);
|
||||
result.push_back(group->leader->fullId());
|
||||
return result;
|
||||
}
|
||||
|
||||
not_null<Data::Feed*> AuthSessionData::feed(FeedId id) {
|
||||
if (const auto result = feedLoaded(id)) {
|
||||
return result;
|
||||
}
|
||||
const auto [it, ok] = _feeds.emplace(
|
||||
id,
|
||||
std::make_unique<Data::Feed>(id));
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
Data::Feed *AuthSessionData::feedLoaded(FeedId id) {
|
||||
const auto it = _feeds.find(id);
|
||||
return (it == _feeds.end()) ? nullptr : it->second.get();
|
||||
}
|
||||
|
||||
AuthSession &Auth() {
|
||||
auto result = Messenger::Instance().authSession();
|
||||
Assert(result != nullptr);
|
||||
|
@ -433,6 +268,7 @@ AuthSession &Auth() {
|
|||
AuthSession::AuthSession(UserId userId)
|
||||
: _userId(userId)
|
||||
, _autoLockTimer([this] { checkAutoLock(); })
|
||||
, _data(std::make_unique<Data::Session>())
|
||||
, _api(std::make_unique<ApiWrap>(this))
|
||||
, _calls(std::make_unique<Calls::Instance>())
|
||||
, _downloader(std::make_unique<Storage::Downloader>())
|
||||
|
@ -476,7 +312,7 @@ bool AuthSession::validateSelf(const MTPUser &user) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void AuthSession::saveDataDelayed(TimeMs delay) {
|
||||
void AuthSession::saveSettingsDelayed(TimeMs delay) {
|
||||
Expects(this == &Auth());
|
||||
_saveDataTimer.callOnce(delay);
|
||||
}
|
||||
|
@ -488,7 +324,7 @@ void AuthSession::checkAutoLock() {
|
|||
auto now = getms(true);
|
||||
auto shouldLockInMs = Global::AutoLock() * 1000LL;
|
||||
auto idleForMs = psIdleTime();
|
||||
auto notPlayingVideoForMs = now - data().lastTimeVideoPlayedAt();
|
||||
auto notPlayingVideoForMs = now - settings().lastTimeVideoPlayedAt();
|
||||
auto checkTimeMs = qMin(idleForMs, notPlayingVideoForMs);
|
||||
if (checkTimeMs >= shouldLockInMs || (_shouldLockAt > 0 && now > _shouldLockAt + kAutoLockTimeoutLateMs)) {
|
||||
Messenger::Instance().setupPasscode();
|
||||
|
|
|
@ -11,13 +11,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <rpl/filter.h>
|
||||
#include <rpl/variable.h>
|
||||
#include "base/timer.h"
|
||||
#include "chat_helpers/stickers.h"
|
||||
|
||||
class ApiWrap;
|
||||
enum class SendFilesWay;
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
class Session;
|
||||
} // namespace Data
|
||||
|
||||
namespace Storage {
|
||||
|
@ -45,68 +44,20 @@ namespace Core {
|
|||
class Changelogs;
|
||||
} // namespace Core
|
||||
|
||||
class AuthSessionData final {
|
||||
class AuthSessionSettings final {
|
||||
public:
|
||||
AuthSessionData();
|
||||
~AuthSessionData();
|
||||
|
||||
base::Variable<bool> &contactsLoaded() {
|
||||
return _contactsLoaded;
|
||||
}
|
||||
base::Variable<bool> &allChatsLoaded() {
|
||||
return _allChatsLoaded;
|
||||
}
|
||||
base::Observable<void> &moreChatsLoaded() {
|
||||
return _moreChatsLoaded;
|
||||
}
|
||||
base::Observable<void> &pendingHistoryResize() {
|
||||
return _pendingHistoryResize;
|
||||
}
|
||||
struct ItemVisibilityQuery {
|
||||
not_null<HistoryItem*> item;
|
||||
not_null<bool*> isVisible;
|
||||
};
|
||||
base::Observable<ItemVisibilityQuery> &queryItemVisibility() {
|
||||
return _queryItemVisibility;
|
||||
}
|
||||
void markItemLayoutChanged(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemLayoutChanged() const;
|
||||
void requestItemRepaint(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemRepaintRequest() const;
|
||||
void markItemRemoved(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemRemoved() const;
|
||||
void markHistoryUnloaded(not_null<const History*> history);
|
||||
rpl::producer<not_null<const History*>> historyUnloaded() const;
|
||||
void markHistoryCleared(not_null<const History*> history);
|
||||
rpl::producer<not_null<const History*>> historyCleared() const;
|
||||
using MegagroupParticipant = std::tuple<
|
||||
not_null<ChannelData*>,
|
||||
not_null<UserData*>>;
|
||||
void removeMegagroupParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> user);
|
||||
rpl::producer<MegagroupParticipant> megagroupParticipantRemoved() const;
|
||||
rpl::producer<not_null<UserData*>> megagroupParticipantRemoved(
|
||||
not_null<ChannelData*> channel) const;
|
||||
void addNewMegagroupParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> user);
|
||||
rpl::producer<MegagroupParticipant> megagroupParticipantAdded() const;
|
||||
rpl::producer<not_null<UserData*>> megagroupParticipantAdded(
|
||||
not_null<ChannelData*> channel) const;
|
||||
|
||||
void moveFrom(AuthSessionData &&other) {
|
||||
void moveFrom(AuthSessionSettings &&other) {
|
||||
_variables = std::move(other._variables);
|
||||
}
|
||||
QByteArray serialize() const;
|
||||
void constructFromSerialized(const QByteArray &serialized);
|
||||
|
||||
bool lastSeenWarningSeen() const {
|
||||
return _variables.lastSeenWarningSeen;
|
||||
}
|
||||
void setLastSeenWarningSeen(bool lastSeenWarningSeen) {
|
||||
_variables.lastSeenWarningSeen = lastSeenWarningSeen;
|
||||
}
|
||||
bool lastSeenWarningSeen() const {
|
||||
return _variables.lastSeenWarningSeen;
|
||||
}
|
||||
void setSendFilesWay(SendFilesWay way) {
|
||||
_variables.sendFilesWay = way;
|
||||
}
|
||||
|
@ -183,10 +134,6 @@ public:
|
|||
int thirdColumnWidth() const;
|
||||
rpl::producer<int> thirdColumnWidthChanges() const;
|
||||
|
||||
void markStickersUpdated();
|
||||
rpl::producer<> stickersUpdated() const;
|
||||
void markSavedGifsUpdated();
|
||||
rpl::producer<> savedGifsUpdated() const;
|
||||
void setGroupStickersSectionHidden(PeerId peerId) {
|
||||
_variables.groupStickersSectionHidden.insert(peerId);
|
||||
}
|
||||
|
@ -196,82 +143,6 @@ public:
|
|||
void removeGroupStickersSectionHidden(PeerId peerId) {
|
||||
_variables.groupStickersSectionHidden.remove(peerId);
|
||||
}
|
||||
bool stickersUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastStickersUpdate, now);
|
||||
}
|
||||
void setLastStickersUpdate(TimeMs update) {
|
||||
_lastStickersUpdate = update;
|
||||
}
|
||||
bool recentStickersUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastRecentStickersUpdate, now);
|
||||
}
|
||||
void setLastRecentStickersUpdate(TimeMs update) {
|
||||
_lastRecentStickersUpdate = update;
|
||||
}
|
||||
bool favedStickersUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastFavedStickersUpdate, now);
|
||||
}
|
||||
void setLastFavedStickersUpdate(TimeMs update) {
|
||||
_lastFavedStickersUpdate = update;
|
||||
}
|
||||
bool featuredStickersUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastFeaturedStickersUpdate, now);
|
||||
}
|
||||
void setLastFeaturedStickersUpdate(TimeMs update) {
|
||||
_lastFeaturedStickersUpdate = update;
|
||||
}
|
||||
bool savedGifsUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastSavedGifsUpdate, now);
|
||||
}
|
||||
void setLastSavedGifsUpdate(TimeMs update) {
|
||||
_lastSavedGifsUpdate = update;
|
||||
}
|
||||
int featuredStickerSetsUnreadCount() const {
|
||||
return _featuredStickerSetsUnreadCount.current();
|
||||
}
|
||||
void setFeaturedStickerSetsUnreadCount(int count) {
|
||||
_featuredStickerSetsUnreadCount = count;
|
||||
}
|
||||
rpl::producer<int> featuredStickerSetsUnreadCountValue() const {
|
||||
return _featuredStickerSetsUnreadCount.value();
|
||||
}
|
||||
const Stickers::Sets &stickerSets() const {
|
||||
return _stickerSets;
|
||||
}
|
||||
Stickers::Sets &stickerSetsRef() {
|
||||
return _stickerSets;
|
||||
}
|
||||
const Stickers::Order &stickerSetsOrder() const {
|
||||
return _stickerSetsOrder;
|
||||
}
|
||||
Stickers::Order &stickerSetsOrderRef() {
|
||||
return _stickerSetsOrder;
|
||||
}
|
||||
const Stickers::Order &featuredStickerSetsOrder() const {
|
||||
return _featuredStickerSetsOrder;
|
||||
}
|
||||
Stickers::Order &featuredStickerSetsOrderRef() {
|
||||
return _featuredStickerSetsOrder;
|
||||
}
|
||||
const Stickers::Order &archivedStickerSetsOrder() const {
|
||||
return _archivedStickerSetsOrder;
|
||||
}
|
||||
Stickers::Order &archivedStickerSetsOrderRef() {
|
||||
return _archivedStickerSetsOrder;
|
||||
}
|
||||
const Stickers::SavedGifs &savedGifs() const {
|
||||
return _savedGifs;
|
||||
}
|
||||
Stickers::SavedGifs &savedGifsRef() {
|
||||
return _savedGifs;
|
||||
}
|
||||
|
||||
HistoryItemsList idsToItems(const MessageIdsList &ids) const;
|
||||
MessageIdsList itemsToIds(const HistoryItemsList &items) const;
|
||||
MessageIdsList groupToIds(not_null<HistoryMessageGroup*> group) const;
|
||||
|
||||
not_null<Data::Feed*> feed(FeedId id);
|
||||
Data::Feed *feedLoaded(FeedId id);
|
||||
|
||||
private:
|
||||
struct Variables {
|
||||
|
@ -298,42 +169,6 @@ private:
|
|||
= kDefaultThirdColumnWidth; // per-window
|
||||
};
|
||||
|
||||
bool stickersUpdateNeeded(TimeMs lastUpdate, TimeMs now) const {
|
||||
constexpr auto kStickersUpdateTimeout = TimeMs(3600'000);
|
||||
return (lastUpdate == 0)
|
||||
|| (now >= lastUpdate + kStickersUpdateTimeout);
|
||||
}
|
||||
void userIsContactUpdated(not_null<UserData*> user);
|
||||
|
||||
base::Variable<bool> _contactsLoaded = { false };
|
||||
base::Variable<bool> _allChatsLoaded = { false };
|
||||
base::Observable<void> _moreChatsLoaded;
|
||||
base::Observable<void> _pendingHistoryResize;
|
||||
base::Observable<ItemVisibilityQuery> _queryItemVisibility;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemLayoutChanged;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemRepaintRequest;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemRemoved;
|
||||
rpl::event_stream<not_null<const History*>> _historyUnloaded;
|
||||
rpl::event_stream<not_null<const History*>> _historyCleared;
|
||||
rpl::event_stream<MegagroupParticipant> _megagroupParticipantRemoved;
|
||||
rpl::event_stream<MegagroupParticipant> _megagroupParticipantAdded;
|
||||
|
||||
rpl::event_stream<> _stickersUpdated;
|
||||
rpl::event_stream<> _savedGifsUpdated;
|
||||
TimeMs _lastStickersUpdate = 0;
|
||||
TimeMs _lastRecentStickersUpdate = 0;
|
||||
TimeMs _lastFavedStickersUpdate = 0;
|
||||
TimeMs _lastFeaturedStickersUpdate = 0;
|
||||
TimeMs _lastSavedGifsUpdate = 0;
|
||||
rpl::variable<int> _featuredStickerSetsUnreadCount = 0;
|
||||
Stickers::Sets _stickerSets;
|
||||
Stickers::Order _stickerSetsOrder;
|
||||
Stickers::Order _featuredStickerSetsOrder;
|
||||
Stickers::Order _archivedStickerSetsOrder;
|
||||
Stickers::SavedGifs _savedGifs;
|
||||
|
||||
base::flat_map<FeedId, std::unique_ptr<Data::Feed>> _feeds;
|
||||
|
||||
rpl::event_stream<bool> _thirdSectionInfoEnabledValue;
|
||||
bool _tabbedReplacedWithInfo = false;
|
||||
rpl::event_stream<bool> _tabbedReplacedWithInfoValue;
|
||||
|
@ -341,8 +176,6 @@ private:
|
|||
Variables _variables;
|
||||
TimeMs _lastTimeVideoPlayedAt = 0;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
||||
// One per Messenger.
|
||||
|
@ -383,10 +216,13 @@ public:
|
|||
return *_notifications;
|
||||
}
|
||||
|
||||
AuthSessionData &data() {
|
||||
return _data;
|
||||
Data::Session &data() {
|
||||
return *_data;
|
||||
}
|
||||
void saveDataDelayed(TimeMs delay = kDefaultSaveDelay);
|
||||
AuthSessionSettings &settings() {
|
||||
return _settings;
|
||||
}
|
||||
void saveSettingsDelayed(TimeMs delay = kDefaultSaveDelay);
|
||||
|
||||
ApiWrap &api() {
|
||||
return *_api;
|
||||
|
@ -408,12 +244,13 @@ private:
|
|||
static constexpr auto kDefaultSaveDelay = TimeMs(1000);
|
||||
|
||||
const UserId _userId = 0;
|
||||
AuthSessionData _data;
|
||||
AuthSessionSettings _settings;
|
||||
base::Timer _saveDataTimer;
|
||||
|
||||
TimeMs _shouldLockAt = 0;
|
||||
base::Timer _autoLockTimer;
|
||||
|
||||
const std::unique_ptr<Data::Session> _data;
|
||||
const std::unique_ptr<ApiWrap> _api;
|
||||
const std::unique_ptr<Calls::Instance> _calls;
|
||||
const std::unique_ptr<Storage::Downloader> _downloader;
|
||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "observer_peer.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "auth_session.h"
|
||||
#include "data/data_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "mainwidget.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
|
|
@ -1433,7 +1433,7 @@ void SendFilesBox::initSendWay() {
|
|||
? SendFilesWay::Album
|
||||
: SendFilesWay::Photos;
|
||||
}
|
||||
const auto currentWay = Auth().data().sendFilesWay();
|
||||
const auto currentWay = Auth().settings().sendFilesWay();
|
||||
if (currentWay == SendFilesWay::Files) {
|
||||
return currentWay;
|
||||
} else if (currentWay == SendFilesWay::Album) {
|
||||
|
@ -1756,7 +1756,7 @@ void SendFilesBox::send(bool ctrlShiftEnter) {
|
|||
const auto way = _sendWay ? _sendWay->value() : Way::Files;
|
||||
|
||||
if (_compressConfirm == CompressConfirm::Auto) {
|
||||
const auto oldWay = Auth().data().sendFilesWay();
|
||||
const auto oldWay = Auth().settings().sendFilesWay();
|
||||
if (way != oldWay) {
|
||||
// Check if the user _could_ use the old value, but didn't.
|
||||
if ((oldWay == Way::Album && _sendAlbum)
|
||||
|
@ -1764,8 +1764,8 @@ void SendFilesBox::send(bool ctrlShiftEnter) {
|
|||
|| (oldWay == Way::Files && _sendFiles)
|
||||
|| (way == Way::Files && (_sendAlbum || _sendPhotos))) {
|
||||
// And in that case save it to settings.
|
||||
Auth().data().setSendFilesWay(way);
|
||||
Auth().saveDataDelayed();
|
||||
Auth().settings().setSendFilesWay(way);
|
||||
Auth().saveSettingsDelayed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/sticker_set_box.h"
|
||||
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "stickers_box.h"
|
||||
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "chat_helpers/stickers.h"
|
||||
|
|
|
@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_media_types.h"
|
||||
#include "mainwidget.h"
|
||||
#include "auth_session.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace Calls {
|
||||
namespace {
|
||||
|
|
|
@ -248,7 +248,10 @@ QString Call::getDebugLog() const {
|
|||
|
||||
void Call::startWaitingTrack() {
|
||||
_waitingTrack = Media::Audio::Current().createTrack();
|
||||
auto trackFileName = Auth().data().getSoundPath((_type == Type::Outgoing) ? qsl("call_outgoing") : qsl("call_incoming"));
|
||||
auto trackFileName = Auth().settings().getSoundPath(
|
||||
(_type == Type::Outgoing)
|
||||
? qsl("call_outgoing")
|
||||
: qsl("call_incoming"));
|
||||
_waitingTrack->samplePeakEach(kSoundSampleMs);
|
||||
_waitingTrack->fillFromFile(trackFileName);
|
||||
_waitingTrack->playInLoop();
|
||||
|
|
|
@ -60,7 +60,8 @@ void Instance::playSound(Sound sound) {
|
|||
case Sound::Busy: {
|
||||
if (!_callBusyTrack) {
|
||||
_callBusyTrack = Media::Audio::Current().createTrack();
|
||||
_callBusyTrack->fillFromFile(Auth().data().getSoundPath(qsl("call_busy")));
|
||||
_callBusyTrack->fillFromFile(
|
||||
Auth().settings().getSoundPath(qsl("call_busy")));
|
||||
}
|
||||
_callBusyTrack->playOnce();
|
||||
} break;
|
||||
|
@ -68,7 +69,8 @@ void Instance::playSound(Sound sound) {
|
|||
case Sound::Ended: {
|
||||
if (!_callEndedTrack) {
|
||||
_callEndedTrack = Media::Audio::Current().createTrack();
|
||||
_callEndedTrack->fillFromFile(Auth().data().getSoundPath(qsl("call_end")));
|
||||
_callEndedTrack->fillFromFile(
|
||||
Auth().settings().getSoundPath(qsl("call_end")));
|
||||
}
|
||||
_callEndedTrack->playOnce();
|
||||
} break;
|
||||
|
@ -76,7 +78,8 @@ void Instance::playSound(Sound sound) {
|
|||
case Sound::Connecting: {
|
||||
if (!_callConnectingTrack) {
|
||||
_callConnectingTrack = Media::Audio::Current().createTrack();
|
||||
_callConnectingTrack->fillFromFile(Auth().data().getSoundPath(qsl("call_connect")));
|
||||
_callConnectingTrack->fillFromFile(
|
||||
Auth().settings().getSoundPath(qsl("call_connect")));
|
||||
}
|
||||
_callConnectingTrack->playOnce();
|
||||
} break;
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "stickers.h"
|
||||
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "boxes/stickers_box.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "chat_helpers/stickers_list_widget.h"
|
||||
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "boxes/stickers_box.h"
|
||||
|
@ -1393,17 +1394,17 @@ void StickersListWidget::refreshMegagroupStickers(GroupStickersPlace place) {
|
|||
};
|
||||
if (_megagroupSet->mgInfo->stickerSet.type() == mtpc_inputStickerSetEmpty) {
|
||||
if (canEdit) {
|
||||
auto hidden = Auth().data().isGroupStickersSectionHidden(_megagroupSet->id);
|
||||
auto hidden = Auth().settings().isGroupStickersSectionHidden(_megagroupSet->id);
|
||||
if (isShownHere(hidden)) {
|
||||
_mySets.push_back(Set(Stickers::MegagroupSetId, MTPDstickerSet_ClientFlag::f_special | 0, lang(lng_group_stickers), 0));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
auto hidden = Auth().data().isGroupStickersSectionHidden(_megagroupSet->id);
|
||||
auto hidden = Auth().settings().isGroupStickersSectionHidden(_megagroupSet->id);
|
||||
auto removeHiddenForGroup = [this, &hidden] {
|
||||
if (hidden) {
|
||||
Auth().data().removeGroupStickersSectionHidden(_megagroupSet->id);
|
||||
Auth().settings().removeGroupStickersSectionHidden(_megagroupSet->id);
|
||||
Local::writeUserSettings();
|
||||
hidden = false;
|
||||
}
|
||||
|
@ -1753,7 +1754,7 @@ void StickersListWidget::installSet(uint64 setId) {
|
|||
|
||||
void StickersListWidget::removeMegagroupSet(bool locally) {
|
||||
if (locally) {
|
||||
Auth().data().setGroupStickersSectionHidden(_megagroupSet->id);
|
||||
Auth().settings().setGroupStickersSectionHidden(_megagroupSet->id);
|
||||
Local::writeUserSettings();
|
||||
refreshStickers();
|
||||
return;
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#pragma once
|
||||
|
||||
#include "chat_helpers/tabbed_selector.h"
|
||||
#include "chat_helpers/stickers.h"
|
||||
#include "base/variant.h"
|
||||
|
||||
namespace Window {
|
||||
|
|
|
@ -277,7 +277,7 @@ TabbedSelector::TabbedSelector(QWidget *parent, not_null<Window::Controller*> co
|
|||
Tab { SelectorTab::Stickers, object_ptr<StickersListWidget>(this, controller) },
|
||||
Tab { SelectorTab::Gifs, object_ptr<GifsListWidget>(this, controller) },
|
||||
} }
|
||||
, _currentTabType(Auth().data().selectorTab()) {
|
||||
, _currentTabType(Auth().settings().selectorTab()) {
|
||||
resize(st::emojiPanWidth, st::emojiPanMaxHeight);
|
||||
|
||||
for (auto &tab : _tabs) {
|
||||
|
@ -685,8 +685,8 @@ void TabbedSelector::switchTab() {
|
|||
_a_slide.start([this] { update(); }, 0., 1., st::emojiPanSlideDuration, anim::linear);
|
||||
update();
|
||||
|
||||
Auth().data().setSelectorTab(_currentTabType);
|
||||
Auth().saveDataDelayed();
|
||||
Auth().settings().setSelectorTab(_currentTabType);
|
||||
Auth().saveSettingsDelayed();
|
||||
}
|
||||
|
||||
not_null<EmojiListWidget*> TabbedSelector::emoji() const {
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "storage/localstorage.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/data_session.h"
|
||||
#include "mainwindow.h"
|
||||
#include "apiwrap.h"
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "data/data_document.h"
|
||||
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "inline_bots/inline_bot_layout_item.h"
|
||||
#include "mainwidget.h"
|
||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_channel_admins.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "observer_peer.h"
|
||||
#include "mainwidget.h"
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "data/data_photo.h"
|
||||
|
||||
#include "data/data_session.h"
|
||||
#include "mainwidget.h"
|
||||
#include "history/history_media_types.h"
|
||||
#include "auth_session.h"
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_search_controller.h"
|
||||
|
||||
#include "auth_session.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "data/data_session.h"
|
||||
|
||||
#include "observer_peer.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "data/data_feed.h"
|
||||
|
||||
namespace Data {
|
||||
|
||||
Session::Session() {
|
||||
Notify::PeerUpdateViewer(
|
||||
Notify::PeerUpdate::Flag::UserIsContact
|
||||
) | rpl::map([](const Notify::PeerUpdate &update) {
|
||||
return update.peer->asUser();
|
||||
}) | rpl::filter([](UserData *user) {
|
||||
return user != nullptr;
|
||||
}) | rpl::start_with_next([=](not_null<UserData*> user) {
|
||||
userIsContactUpdated(user);
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
Session::~Session() = default;
|
||||
|
||||
void Session::markItemLayoutChanged(not_null<const HistoryItem*> item) {
|
||||
_itemLayoutChanged.fire_copy(item);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> Session::itemLayoutChanged() const {
|
||||
return _itemLayoutChanged.events();
|
||||
}
|
||||
|
||||
void Session::requestItemRepaint(not_null<const HistoryItem*> item) {
|
||||
_itemRepaintRequest.fire_copy(item);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> Session::itemRepaintRequest() const {
|
||||
return _itemRepaintRequest.events();
|
||||
}
|
||||
|
||||
void Session::markItemRemoved(not_null<const HistoryItem*> item) {
|
||||
_itemRemoved.fire_copy(item);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> Session::itemRemoved() const {
|
||||
return _itemRemoved.events();
|
||||
}
|
||||
|
||||
void Session::markHistoryUnloaded(not_null<const History*> history) {
|
||||
_historyUnloaded.fire_copy(history);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const History*>> Session::historyUnloaded() const {
|
||||
return _historyUnloaded.events();
|
||||
}
|
||||
|
||||
void Session::markHistoryCleared(not_null<const History*> history) {
|
||||
_historyCleared.fire_copy(history);
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const History*>> Session::historyCleared() const {
|
||||
return _historyCleared.events();
|
||||
}
|
||||
|
||||
void Session::removeMegagroupParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> user) {
|
||||
_megagroupParticipantRemoved.fire({ channel, user });
|
||||
}
|
||||
|
||||
auto Session::megagroupParticipantRemoved() const
|
||||
-> rpl::producer<MegagroupParticipant> {
|
||||
return _megagroupParticipantRemoved.events();
|
||||
}
|
||||
|
||||
rpl::producer<not_null<UserData*>> Session::megagroupParticipantRemoved(
|
||||
not_null<ChannelData*> channel) const {
|
||||
return megagroupParticipantRemoved(
|
||||
) | rpl::filter([channel](auto updateChannel, auto user) {
|
||||
return (updateChannel == channel);
|
||||
}) | rpl::map([](auto updateChannel, auto user) {
|
||||
return user;
|
||||
});
|
||||
}
|
||||
|
||||
void Session::addNewMegagroupParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> user) {
|
||||
_megagroupParticipantAdded.fire({ channel, user });
|
||||
}
|
||||
|
||||
auto Session::megagroupParticipantAdded() const
|
||||
-> rpl::producer<MegagroupParticipant> {
|
||||
return _megagroupParticipantAdded.events();
|
||||
}
|
||||
|
||||
rpl::producer<not_null<UserData*>> Session::megagroupParticipantAdded(
|
||||
not_null<ChannelData*> channel) const {
|
||||
return megagroupParticipantAdded(
|
||||
) | rpl::filter([channel](auto updateChannel, auto user) {
|
||||
return (updateChannel == channel);
|
||||
}) | rpl::map([](auto updateChannel, auto user) {
|
||||
return user;
|
||||
});
|
||||
}
|
||||
|
||||
void Session::markStickersUpdated() {
|
||||
_stickersUpdated.fire({});
|
||||
}
|
||||
|
||||
rpl::producer<> Session::stickersUpdated() const {
|
||||
return _stickersUpdated.events();
|
||||
}
|
||||
|
||||
void Session::markSavedGifsUpdated() {
|
||||
_savedGifsUpdated.fire({});
|
||||
}
|
||||
|
||||
rpl::producer<> Session::savedGifsUpdated() const {
|
||||
return _savedGifsUpdated.events();
|
||||
}
|
||||
|
||||
void Session::userIsContactUpdated(not_null<UserData*> user) {
|
||||
const auto &items = App::sharedContactItems();
|
||||
const auto i = items.constFind(peerToUser(user->id));
|
||||
if (i != items.cend()) {
|
||||
for (const auto item : std::as_const(i.value())) {
|
||||
item->setPendingInitDimensions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HistoryItemsList Session::idsToItems(
|
||||
const MessageIdsList &ids) const {
|
||||
return ranges::view::all(
|
||||
ids
|
||||
) | ranges::view::transform([](const FullMsgId &fullId) {
|
||||
return App::histItemById(fullId);
|
||||
}) | ranges::view::filter([](HistoryItem *item) {
|
||||
return item != nullptr;
|
||||
}) | ranges::view::transform([](HistoryItem *item) {
|
||||
return not_null<HistoryItem*>(item);
|
||||
}) | ranges::to_vector;
|
||||
}
|
||||
|
||||
MessageIdsList Session::itemsToIds(
|
||||
const HistoryItemsList &items) const {
|
||||
return ranges::view::all(
|
||||
items
|
||||
) | ranges::view::transform([](not_null<HistoryItem*> item) {
|
||||
return item->fullId();
|
||||
}) | ranges::to_vector;
|
||||
}
|
||||
|
||||
MessageIdsList Session::groupToIds(
|
||||
not_null<HistoryMessageGroup*> group) const {
|
||||
auto result = itemsToIds(group->others);
|
||||
result.push_back(group->leader->fullId());
|
||||
return result;
|
||||
}
|
||||
|
||||
not_null<Data::Feed*> Session::feed(FeedId id) {
|
||||
if (const auto result = feedLoaded(id)) {
|
||||
return result;
|
||||
}
|
||||
const auto [it, ok] = _feeds.emplace(
|
||||
id,
|
||||
std::make_unique<Data::Feed>(id));
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
Data::Feed *Session::feedLoaded(FeedId id) {
|
||||
const auto it = _feeds.find(id);
|
||||
return (it == _feeds.end()) ? nullptr : it->second.get();
|
||||
}
|
||||
|
||||
} // namespace Data
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "chat_helpers/stickers.h"
|
||||
|
||||
namespace Data {
|
||||
|
||||
class Feed;
|
||||
|
||||
class Session final {
|
||||
public:
|
||||
Session();
|
||||
~Session();
|
||||
|
||||
base::Variable<bool> &contactsLoaded() {
|
||||
return _contactsLoaded;
|
||||
}
|
||||
base::Variable<bool> &allChatsLoaded() {
|
||||
return _allChatsLoaded;
|
||||
}
|
||||
base::Observable<void> &moreChatsLoaded() {
|
||||
return _moreChatsLoaded;
|
||||
}
|
||||
base::Observable<void> &pendingHistoryResize() {
|
||||
return _pendingHistoryResize;
|
||||
}
|
||||
struct ItemVisibilityQuery {
|
||||
not_null<HistoryItem*> item;
|
||||
not_null<bool*> isVisible;
|
||||
};
|
||||
base::Observable<ItemVisibilityQuery> &queryItemVisibility() {
|
||||
return _queryItemVisibility;
|
||||
}
|
||||
void markItemLayoutChanged(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemLayoutChanged() const;
|
||||
void requestItemRepaint(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemRepaintRequest() const;
|
||||
void markItemRemoved(not_null<const HistoryItem*> item);
|
||||
rpl::producer<not_null<const HistoryItem*>> itemRemoved() const;
|
||||
void markHistoryUnloaded(not_null<const History*> history);
|
||||
rpl::producer<not_null<const History*>> historyUnloaded() const;
|
||||
void markHistoryCleared(not_null<const History*> history);
|
||||
rpl::producer<not_null<const History*>> historyCleared() const;
|
||||
using MegagroupParticipant = std::tuple<
|
||||
not_null<ChannelData*>,
|
||||
not_null<UserData*>>;
|
||||
void removeMegagroupParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> user);
|
||||
rpl::producer<MegagroupParticipant> megagroupParticipantRemoved() const;
|
||||
rpl::producer<not_null<UserData*>> megagroupParticipantRemoved(
|
||||
not_null<ChannelData*> channel) const;
|
||||
void addNewMegagroupParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> user);
|
||||
rpl::producer<MegagroupParticipant> megagroupParticipantAdded() const;
|
||||
rpl::producer<not_null<UserData*>> megagroupParticipantAdded(
|
||||
not_null<ChannelData*> channel) const;
|
||||
|
||||
void markStickersUpdated();
|
||||
rpl::producer<> stickersUpdated() const;
|
||||
void markSavedGifsUpdated();
|
||||
rpl::producer<> savedGifsUpdated() const;
|
||||
|
||||
bool stickersUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastStickersUpdate, now);
|
||||
}
|
||||
void setLastStickersUpdate(TimeMs update) {
|
||||
_lastStickersUpdate = update;
|
||||
}
|
||||
bool recentStickersUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastRecentStickersUpdate, now);
|
||||
}
|
||||
void setLastRecentStickersUpdate(TimeMs update) {
|
||||
_lastRecentStickersUpdate = update;
|
||||
}
|
||||
bool favedStickersUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastFavedStickersUpdate, now);
|
||||
}
|
||||
void setLastFavedStickersUpdate(TimeMs update) {
|
||||
_lastFavedStickersUpdate = update;
|
||||
}
|
||||
bool featuredStickersUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastFeaturedStickersUpdate, now);
|
||||
}
|
||||
void setLastFeaturedStickersUpdate(TimeMs update) {
|
||||
_lastFeaturedStickersUpdate = update;
|
||||
}
|
||||
bool savedGifsUpdateNeeded(TimeMs now) const {
|
||||
return stickersUpdateNeeded(_lastSavedGifsUpdate, now);
|
||||
}
|
||||
void setLastSavedGifsUpdate(TimeMs update) {
|
||||
_lastSavedGifsUpdate = update;
|
||||
}
|
||||
int featuredStickerSetsUnreadCount() const {
|
||||
return _featuredStickerSetsUnreadCount.current();
|
||||
}
|
||||
void setFeaturedStickerSetsUnreadCount(int count) {
|
||||
_featuredStickerSetsUnreadCount = count;
|
||||
}
|
||||
rpl::producer<int> featuredStickerSetsUnreadCountValue() const {
|
||||
return _featuredStickerSetsUnreadCount.value();
|
||||
}
|
||||
const Stickers::Sets &stickerSets() const {
|
||||
return _stickerSets;
|
||||
}
|
||||
Stickers::Sets &stickerSetsRef() {
|
||||
return _stickerSets;
|
||||
}
|
||||
const Stickers::Order &stickerSetsOrder() const {
|
||||
return _stickerSetsOrder;
|
||||
}
|
||||
Stickers::Order &stickerSetsOrderRef() {
|
||||
return _stickerSetsOrder;
|
||||
}
|
||||
const Stickers::Order &featuredStickerSetsOrder() const {
|
||||
return _featuredStickerSetsOrder;
|
||||
}
|
||||
Stickers::Order &featuredStickerSetsOrderRef() {
|
||||
return _featuredStickerSetsOrder;
|
||||
}
|
||||
const Stickers::Order &archivedStickerSetsOrder() const {
|
||||
return _archivedStickerSetsOrder;
|
||||
}
|
||||
Stickers::Order &archivedStickerSetsOrderRef() {
|
||||
return _archivedStickerSetsOrder;
|
||||
}
|
||||
const Stickers::SavedGifs &savedGifs() const {
|
||||
return _savedGifs;
|
||||
}
|
||||
Stickers::SavedGifs &savedGifsRef() {
|
||||
return _savedGifs;
|
||||
}
|
||||
|
||||
HistoryItemsList idsToItems(const MessageIdsList &ids) const;
|
||||
MessageIdsList itemsToIds(const HistoryItemsList &items) const;
|
||||
MessageIdsList groupToIds(not_null<HistoryMessageGroup*> group) const;
|
||||
|
||||
not_null<Data::Feed*> feed(FeedId id);
|
||||
Data::Feed *feedLoaded(FeedId id);
|
||||
|
||||
private:
|
||||
bool stickersUpdateNeeded(TimeMs lastUpdate, TimeMs now) const {
|
||||
constexpr auto kStickersUpdateTimeout = TimeMs(3600'000);
|
||||
return (lastUpdate == 0)
|
||||
|| (now >= lastUpdate + kStickersUpdateTimeout);
|
||||
}
|
||||
void userIsContactUpdated(not_null<UserData*> user);
|
||||
|
||||
base::Variable<bool> _contactsLoaded = { false };
|
||||
base::Variable<bool> _allChatsLoaded = { false };
|
||||
base::Observable<void> _moreChatsLoaded;
|
||||
base::Observable<void> _pendingHistoryResize;
|
||||
base::Observable<ItemVisibilityQuery> _queryItemVisibility;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemLayoutChanged;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemRepaintRequest;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemRemoved;
|
||||
rpl::event_stream<not_null<const History*>> _historyUnloaded;
|
||||
rpl::event_stream<not_null<const History*>> _historyCleared;
|
||||
rpl::event_stream<MegagroupParticipant> _megagroupParticipantRemoved;
|
||||
rpl::event_stream<MegagroupParticipant> _megagroupParticipantAdded;
|
||||
|
||||
rpl::event_stream<> _stickersUpdated;
|
||||
rpl::event_stream<> _savedGifsUpdated;
|
||||
TimeMs _lastStickersUpdate = 0;
|
||||
TimeMs _lastRecentStickersUpdate = 0;
|
||||
TimeMs _lastFavedStickersUpdate = 0;
|
||||
TimeMs _lastFeaturedStickersUpdate = 0;
|
||||
TimeMs _lastSavedGifsUpdate = 0;
|
||||
rpl::variable<int> _featuredStickerSetsUnreadCount = 0;
|
||||
Stickers::Sets _stickerSets;
|
||||
Stickers::Order _stickerSetsOrder;
|
||||
Stickers::Order _featuredStickerSetsOrder;
|
||||
Stickers::Order _archivedStickerSetsOrder;
|
||||
Stickers::SavedGifs _savedGifs;
|
||||
|
||||
base::flat_map<FeedId, std::unique_ptr<Data::Feed>> _feeds;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Data
|
|
@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/text_options.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mainwidget.h"
|
||||
|
|
|
@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_slide_animation.h"
|
||||
#include "profile/profile_channel_controllers.h"
|
||||
#include "storage/storage_media_prepare.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/observer.h"
|
||||
#include "history/history_media.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
Q_DECLARE_METATYPE(ClickHandlerPtr);
|
||||
Q_DECLARE_METATYPE(Qt::MouseButton);
|
||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "dialogs/dialogs_indexed_list.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "apiwrap.h"
|
||||
#include "mainwidget.h"
|
||||
|
|
|
@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/overload.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "boxes/edit_participant_box.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace AdminLog {
|
||||
namespace {
|
||||
|
@ -214,7 +215,7 @@ InnerWidget::InnerWidget(
|
|||
}
|
||||
}, lifetime());
|
||||
subscribe(Auth().data().pendingHistoryResize(), [this] { handlePendingHistoryResize(); });
|
||||
subscribe(Auth().data().queryItemVisibility(), [this](const AuthSessionData::ItemVisibilityQuery &query) {
|
||||
subscribe(Auth().data().queryItemVisibility(), [this](const Data::Session::ItemVisibilityQuery &query) {
|
||||
if (_history != query.item->history() || !query.item->isLogEntry() || !isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "messenger.h"
|
||||
#include "apiwrap.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwindow.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "core/crash_reports.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/empty_userpic.h"
|
||||
#include "ui/grouped_layout.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_controller.h"
|
||||
#include "observer_peer.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -112,8 +112,8 @@ HistoryTopBarWidget::HistoryTopBarWidget(
|
|||
});
|
||||
|
||||
rpl::combine(
|
||||
Auth().data().thirdSectionInfoEnabledValue(),
|
||||
Auth().data().tabbedReplacedWithInfoValue()
|
||||
Auth().settings().thirdSectionInfoEnabledValue(),
|
||||
Auth().settings().tabbedReplacedWithInfoValue()
|
||||
) | rpl::start_with_next(
|
||||
[this] { updateInfoToggleActive(); },
|
||||
lifetime());
|
||||
|
@ -186,13 +186,13 @@ void HistoryTopBarWidget::showMenu() {
|
|||
|
||||
void HistoryTopBarWidget::toggleInfoSection() {
|
||||
if (Adaptive::ThreeColumn()
|
||||
&& (Auth().data().thirdSectionInfoEnabled()
|
||||
|| Auth().data().tabbedReplacedWithInfo())) {
|
||||
&& (Auth().settings().thirdSectionInfoEnabled()
|
||||
|| Auth().settings().tabbedReplacedWithInfo())) {
|
||||
_controller->closeThirdSection();
|
||||
} else if (_historyPeer) {
|
||||
if (_controller->canShowThirdSection()) {
|
||||
Auth().data().setThirdSectionInfoEnabled(true);
|
||||
Auth().saveDataDelayed();
|
||||
Auth().settings().setThirdSectionInfoEnabled(true);
|
||||
Auth().saveSettingsDelayed();
|
||||
if (Adaptive::ThreeColumn()) {
|
||||
_controller->showSection(
|
||||
Info::Memento::Default(_historyPeer),
|
||||
|
@ -598,8 +598,8 @@ void HistoryTopBarWidget::updateUnreadBadge() {
|
|||
|
||||
void HistoryTopBarWidget::updateInfoToggleActive() {
|
||||
auto infoThirdActive = Adaptive::ThreeColumn()
|
||||
&& (Auth().data().thirdSectionInfoEnabled()
|
||||
|| Auth().data().tabbedReplacedWithInfo());
|
||||
&& (Auth().settings().thirdSectionInfoEnabled()
|
||||
|| Auth().settings().tabbedReplacedWithInfo());
|
||||
auto iconOverride = infoThirdActive
|
||||
? &st::topBarInfoActive
|
||||
: nullptr;
|
||||
|
|
|
@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/effects/ripple_animation.h"
|
||||
#include "inline_bots/inline_bot_result.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_session.h"
|
||||
#include "history/history_message.h"
|
||||
#include "history/history_service_layout.h"
|
||||
#include "history/history_media_types.h"
|
||||
|
@ -624,7 +625,7 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
|
|||
}
|
||||
}));
|
||||
subscribe(Auth().data().pendingHistoryResize(), [this] { handlePendingHistoryUpdate(); });
|
||||
subscribe(Auth().data().queryItemVisibility(), [this](const AuthSessionData::ItemVisibilityQuery &query) {
|
||||
subscribe(Auth().data().queryItemVisibility(), [this](const Data::Session::ItemVisibilityQuery &query) {
|
||||
if (_a_show.animating() || _history != query.item->history() || query.item->detached() || !isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
@ -3736,11 +3737,11 @@ void HistoryWidget::pushTabbedSelectorToThirdSection(
|
|||
if (!_history || !_tabbedPanel) {
|
||||
return;
|
||||
} else if (!_canSendMessages) {
|
||||
Auth().data().setTabbedReplacedWithInfo(true);
|
||||
Auth().settings().setTabbedReplacedWithInfo(true);
|
||||
controller()->showPeerInfo(_peer, params.withThirdColumn());
|
||||
return;
|
||||
}
|
||||
Auth().data().setTabbedReplacedWithInfo(false);
|
||||
Auth().settings().setTabbedReplacedWithInfo(false);
|
||||
_tabbedSelectorToggle->setColorOverrides(
|
||||
&st::historyAttachEmojiActive,
|
||||
&st::historyRecordVoiceFgActive,
|
||||
|
@ -3771,8 +3772,8 @@ void HistoryWidget::toggleTabbedSelectorMode() {
|
|||
if (_tabbedPanel) {
|
||||
if (controller()->canShowThirdSection()
|
||||
&& !Adaptive::OneColumn()) {
|
||||
Auth().data().setTabbedSelectorSectionEnabled(true);
|
||||
Auth().saveDataDelayed();
|
||||
Auth().settings().setTabbedSelectorSectionEnabled(true);
|
||||
Auth().saveSettingsDelayed();
|
||||
pushTabbedSelectorToThirdSection(
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
} else {
|
||||
|
|
|
@ -108,10 +108,10 @@ bool LayerWidget::takeToThirdSection() {
|
|||
//// shrink the window size.
|
||||
////
|
||||
//// See https://github.com/telegramdesktop/tdesktop/issues/4091
|
||||
//Auth().data().setThirdSectionExtendedBy(0);
|
||||
//Auth().settings().setThirdSectionExtendedBy(0);
|
||||
|
||||
//Auth().data().setThirdSectionInfoEnabled(true);
|
||||
//Auth().saveDataDelayed();
|
||||
//Auth().settings().setThirdSectionInfoEnabled(true);
|
||||
//Auth().saveSettingsDelayed();
|
||||
//localCopy->showSection(
|
||||
// std::move(memento),
|
||||
// Window::SectionShow(
|
||||
|
|
|
@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace Layout = Overview::Layout;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "styles/style_overview.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
|
|
@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/section_memento.h"
|
||||
#include "window/section_widget.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_session.h"
|
||||
#include "ui/widgets/dropdown_menu.h"
|
||||
#include "ui/focus_persister.h"
|
||||
#include "ui/resize_area.h"
|
||||
|
@ -222,9 +223,9 @@ MainWidget::MainWidget(
|
|||
updateDialogsWidthAnimated();
|
||||
});
|
||||
rpl::merge(
|
||||
Auth().data().dialogsWidthRatioChanges()
|
||||
Auth().settings().dialogsWidthRatioChanges()
|
||||
| rpl::map([] { return rpl::empty_value(); }),
|
||||
Auth().data().thirdColumnWidthChanges()
|
||||
Auth().settings().thirdColumnWidthChanges()
|
||||
| rpl::map([] { return rpl::empty_value(); })
|
||||
) | rpl::start_with_next(
|
||||
[this] { updateControlsGeometry(); },
|
||||
|
@ -331,8 +332,8 @@ void MainWidget::checkCurrentFloatPlayer() {
|
|||
}, [this](not_null<Float*> instance, bool closed) {
|
||||
finishFloatPlayerDrag(instance, closed);
|
||||
}));
|
||||
currentFloatPlayer()->column = Auth().data().floatPlayerColumn();
|
||||
currentFloatPlayer()->corner = Auth().data().floatPlayerCorner();
|
||||
currentFloatPlayer()->column = Auth().settings().floatPlayerColumn();
|
||||
currentFloatPlayer()->corner = Auth().settings().floatPlayerCorner();
|
||||
checkFloatPlayerVisibility();
|
||||
}
|
||||
}
|
||||
|
@ -498,8 +499,8 @@ void MainWidget::updateFloatPlayerColumnCorner(QPoint center) {
|
|||
Expects(!_playerFloats.empty());
|
||||
auto size = _playerFloats.back()->widget->size();
|
||||
auto min = INT_MAX;
|
||||
auto column = Auth().data().floatPlayerColumn();
|
||||
auto corner = Auth().data().floatPlayerCorner();
|
||||
auto column = Auth().settings().floatPlayerColumn();
|
||||
auto corner = Auth().settings().floatPlayerCorner();
|
||||
auto checkSection = [this, center, size, &min, &column, &corner](
|
||||
Window::AbstractSectionWidget *widget,
|
||||
Window::Column widgetColumn) {
|
||||
|
@ -550,13 +551,13 @@ void MainWidget::updateFloatPlayerColumnCorner(QPoint center) {
|
|||
checkSection(_dialogs, Window::Column::First);
|
||||
}
|
||||
}
|
||||
if (Auth().data().floatPlayerColumn() != column) {
|
||||
Auth().data().setFloatPlayerColumn(column);
|
||||
Auth().saveDataDelayed();
|
||||
if (Auth().settings().floatPlayerColumn() != column) {
|
||||
Auth().settings().setFloatPlayerColumn(column);
|
||||
Auth().saveSettingsDelayed();
|
||||
}
|
||||
if (Auth().data().floatPlayerCorner() != corner) {
|
||||
Auth().data().setFloatPlayerCorner(corner);
|
||||
Auth().saveDataDelayed();
|
||||
if (Auth().settings().floatPlayerCorner() != corner) {
|
||||
Auth().settings().setFloatPlayerCorner(corner);
|
||||
Auth().saveSettingsDelayed();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -568,8 +569,8 @@ void MainWidget::finishFloatPlayerDrag(not_null<Float*> instance, bool closed) {
|
|||
instance->animationSide = getFloatPlayerSide(center);
|
||||
}
|
||||
updateFloatPlayerColumnCorner(center);
|
||||
instance->column = Auth().data().floatPlayerColumn();
|
||||
instance->corner = Auth().data().floatPlayerCorner();
|
||||
instance->column = Auth().settings().floatPlayerColumn();
|
||||
instance->corner = Auth().settings().floatPlayerCorner();
|
||||
|
||||
instance->draggedAnimation.finish();
|
||||
instance->draggedAnimation.start([this, instance] { updateFloatPlayerPosition(instance); }, 0., 1., st::slideDuration, anim::sineInOut);
|
||||
|
@ -3129,7 +3130,7 @@ void MainWidget::resizeEvent(QResizeEvent *e) {
|
|||
|
||||
void MainWidget::updateControlsGeometry() {
|
||||
updateWindowAdaptiveLayout();
|
||||
if (Auth().data().dialogsWidthRatio() > 0) {
|
||||
if (Auth().settings().dialogsWidthRatio() > 0) {
|
||||
_a_dialogsWidth.finish();
|
||||
}
|
||||
if (!_a_dialogsWidth.animating()) {
|
||||
|
@ -3142,9 +3143,9 @@ void MainWidget::updateControlsGeometry() {
|
|||
Window::SectionShow::Way::ClearStack,
|
||||
anim::type::instant,
|
||||
anim::activation::background);
|
||||
if (Auth().data().tabbedSelectorSectionEnabled()) {
|
||||
if (Auth().settings().tabbedSelectorSectionEnabled()) {
|
||||
_history->pushTabbedSelectorToThirdSection(params);
|
||||
} else if (Auth().data().thirdSectionInfoEnabled()) {
|
||||
} else if (Auth().settings().thirdSectionInfoEnabled()) {
|
||||
_history->pushInfoToThirdSection(params);
|
||||
}
|
||||
}
|
||||
|
@ -3266,14 +3267,14 @@ void MainWidget::ensureFirstColumnResizeAreaCreated() {
|
|||
auto newRatio = (newWidth < st::columnMinimalWidthLeft / 2)
|
||||
? 0.
|
||||
: float64(newWidth) / width();
|
||||
Auth().data().setDialogsWidthRatio(newRatio);
|
||||
Auth().settings().setDialogsWidthRatio(newRatio);
|
||||
};
|
||||
auto moveFinishedCallback = [=] {
|
||||
if (Adaptive::OneColumn()) {
|
||||
return;
|
||||
}
|
||||
if (Auth().data().dialogsWidthRatio() > 0) {
|
||||
Auth().data().setDialogsWidthRatio(
|
||||
if (Auth().settings().dialogsWidthRatio() > 0) {
|
||||
Auth().settings().setDialogsWidthRatio(
|
||||
float64(_dialogsWidth) / width());
|
||||
}
|
||||
Local::writeUserSettings();
|
||||
|
@ -3290,14 +3291,14 @@ void MainWidget::ensureThirdColumnResizeAreaCreated() {
|
|||
}
|
||||
auto moveLeftCallback = [=](int globalLeft) {
|
||||
auto newWidth = mapToGlobal(QPoint(width(), 0)).x() - globalLeft;
|
||||
Auth().data().setThirdColumnWidth(newWidth);
|
||||
Auth().settings().setThirdColumnWidth(newWidth);
|
||||
};
|
||||
auto moveFinishedCallback = [=] {
|
||||
if (!Adaptive::ThreeColumn() || !_thirdSection) {
|
||||
return;
|
||||
}
|
||||
Auth().data().setThirdColumnWidth(snap(
|
||||
Auth().data().thirdColumnWidth(),
|
||||
Auth().settings().setThirdColumnWidth(snap(
|
||||
Auth().settings().thirdColumnWidth(),
|
||||
st::columnMinimalWidthThird,
|
||||
st::columnMaximalWidthThird));
|
||||
Local::writeUserSettings();
|
||||
|
@ -3309,12 +3310,12 @@ void MainWidget::ensureThirdColumnResizeAreaCreated() {
|
|||
}
|
||||
|
||||
void MainWidget::updateDialogsWidthAnimated() {
|
||||
if (Auth().data().dialogsWidthRatio() > 0) {
|
||||
if (Auth().settings().dialogsWidthRatio() > 0) {
|
||||
return;
|
||||
}
|
||||
auto dialogsWidth = _dialogsWidth;
|
||||
updateWindowAdaptiveLayout();
|
||||
if (!Auth().data().dialogsWidthRatio()
|
||||
if (!Auth().settings().dialogsWidthRatio()
|
||||
&& (_dialogsWidth != dialogsWidth
|
||||
|| _a_dialogsWidth.animating())) {
|
||||
_dialogs->startWidthAnimation();
|
||||
|
@ -3366,9 +3367,9 @@ void MainWidget::updateThirdColumnToCurrentPeer(
|
|||
// Like in _controller->showPeerInfo()
|
||||
//
|
||||
if (Adaptive::ThreeColumn()
|
||||
&& !Auth().data().thirdSectionInfoEnabled()) {
|
||||
Auth().data().setThirdSectionInfoEnabled(true);
|
||||
Auth().saveDataDelayed();
|
||||
&& !Auth().settings().thirdSectionInfoEnabled()) {
|
||||
Auth().settings().setThirdSectionInfoEnabled(true);
|
||||
Auth().saveSettingsDelayed();
|
||||
}
|
||||
|
||||
_controller->showSection(
|
||||
|
@ -3380,18 +3381,18 @@ void MainWidget::updateThirdColumnToCurrentPeer(
|
|||
_history->pushTabbedSelectorToThirdSection(params);
|
||||
};
|
||||
if (Adaptive::ThreeColumn()
|
||||
&& Auth().data().tabbedSelectorSectionEnabled()
|
||||
&& Auth().settings().tabbedSelectorSectionEnabled()
|
||||
&& peer) {
|
||||
if (!canWrite) {
|
||||
switchInfoFast();
|
||||
Auth().data().setTabbedSelectorSectionEnabled(true);
|
||||
Auth().data().setTabbedReplacedWithInfo(true);
|
||||
} else if (Auth().data().tabbedReplacedWithInfo()) {
|
||||
Auth().data().setTabbedReplacedWithInfo(false);
|
||||
Auth().settings().setTabbedSelectorSectionEnabled(true);
|
||||
Auth().settings().setTabbedReplacedWithInfo(true);
|
||||
} else if (Auth().settings().tabbedReplacedWithInfo()) {
|
||||
Auth().settings().setTabbedReplacedWithInfo(false);
|
||||
switchTabbedFast();
|
||||
}
|
||||
} else {
|
||||
Auth().data().setTabbedReplacedWithInfo(false);
|
||||
Auth().settings().setTabbedReplacedWithInfo(false);
|
||||
if (!peer) {
|
||||
if (_thirdSection) {
|
||||
_thirdSection.destroy();
|
||||
|
@ -3399,7 +3400,7 @@ void MainWidget::updateThirdColumnToCurrentPeer(
|
|||
updateControlsGeometry();
|
||||
}
|
||||
} else if (Adaptive::ThreeColumn()
|
||||
&& Auth().data().thirdSectionInfoEnabled()) {
|
||||
&& Auth().settings().thirdSectionInfoEnabled()) {
|
||||
switchInfoFast();
|
||||
}
|
||||
}
|
||||
|
@ -3474,13 +3475,13 @@ void MainWidget::handleAdaptiveLayoutUpdate() {
|
|||
|
||||
void MainWidget::updateWindowAdaptiveLayout() {
|
||||
auto layout = _controller->computeColumnLayout();
|
||||
auto dialogsWidthRatio = Auth().data().dialogsWidthRatio();
|
||||
auto dialogsWidthRatio = Auth().settings().dialogsWidthRatio();
|
||||
|
||||
// Check if we are in a single-column layout in a wide enough window
|
||||
// for the normal layout. If so, switch to the normal layout.
|
||||
if (layout.windowLayout == Adaptive::WindowLayout::OneColumn) {
|
||||
auto chatWidth = layout.chatWidth;
|
||||
//if (Auth().data().tabbedSelectorSectionEnabled()
|
||||
//if (Auth().settings().tabbedSelectorSectionEnabled()
|
||||
// && chatWidth >= _history->minimalWidthForTabbedSelectorSection()) {
|
||||
// chatWidth -= _history->tabbedSelectorSectionWidth();
|
||||
//}
|
||||
|
@ -3517,7 +3518,7 @@ void MainWidget::updateWindowAdaptiveLayout() {
|
|||
//}
|
||||
}
|
||||
|
||||
Auth().data().setDialogsWidthRatio(dialogsWidthRatio);
|
||||
Auth().settings().setDialogsWidthRatio(dialogsWidthRatio);
|
||||
|
||||
auto useSmallColumnWidth = !Adaptive::OneColumn()
|
||||
&& !dialogsWidthRatio
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include <rpl/merge.h>
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "history/history_media.h"
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "media/view/media_clip_playback.h"
|
||||
|
|
|
@ -1870,7 +1870,7 @@ void MediaView::onVideoPlayProgress(const AudioMsgId &audioId) {
|
|||
if (state.length) {
|
||||
updateVideoPlaybackState(state);
|
||||
}
|
||||
Auth().data().setLastTimeVideoPlayedAt(getms(true));
|
||||
Auth().settings().setLastTimeVideoPlayedAt(getms(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ Messenger *Messenger::InstancePointer() {
|
|||
|
||||
struct Messenger::Private {
|
||||
UserId authSessionUserId = 0;
|
||||
std::unique_ptr<AuthSessionData> storedAuthSession;
|
||||
std::unique_ptr<AuthSessionSettings> storedAuthSession;
|
||||
MTP::Instance::Config mtpConfig;
|
||||
MTP::AuthKeysList mtpKeysToDestroy;
|
||||
base::Timer quitTimer;
|
||||
|
@ -332,16 +332,18 @@ void Messenger::setAuthSessionUserId(UserId userId) {
|
|||
_private->authSessionUserId = userId;
|
||||
}
|
||||
|
||||
void Messenger::setAuthSessionFromStorage(std::unique_ptr<AuthSessionData> data) {
|
||||
void Messenger::setAuthSessionFromStorage(std::unique_ptr<AuthSessionSettings> data) {
|
||||
Expects(!authSession());
|
||||
_private->storedAuthSession = std::move(data);
|
||||
}
|
||||
|
||||
AuthSessionData *Messenger::getAuthSessionData() {
|
||||
AuthSessionSettings *Messenger::getAuthSessionSettings() {
|
||||
if (_private->authSessionUserId) {
|
||||
return _private->storedAuthSession ? _private->storedAuthSession.get() : nullptr;
|
||||
return _private->storedAuthSession
|
||||
? _private->storedAuthSession.get()
|
||||
: nullptr;
|
||||
} else if (_authSession) {
|
||||
return &_authSession->data();
|
||||
return &_authSession->settings();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -409,7 +411,7 @@ void Messenger::startMtp() {
|
|||
}
|
||||
if (_private->storedAuthSession) {
|
||||
if (_authSession) {
|
||||
_authSession->data().moveFrom(
|
||||
_authSession->settings().moveFrom(
|
||||
std::move(*_private->storedAuthSession));
|
||||
}
|
||||
_private->storedAuthSession.reset();
|
||||
|
|
|
@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/timer.h"
|
||||
|
||||
class AuthSession;
|
||||
class AuthSessionData;
|
||||
class AuthSessionSettings;
|
||||
class MainWidget;
|
||||
class FileUploader;
|
||||
class Translator;
|
||||
|
@ -103,8 +103,9 @@ public:
|
|||
void setMtpMainDcId(MTP::DcId mainDcId);
|
||||
void setMtpKey(MTP::DcId dcId, const MTP::AuthKey::Data &keyData);
|
||||
void setAuthSessionUserId(UserId userId);
|
||||
void setAuthSessionFromStorage(std::unique_ptr<AuthSessionData> data);
|
||||
AuthSessionData *getAuthSessionData();
|
||||
void setAuthSessionFromStorage(
|
||||
std::unique_ptr<AuthSessionSettings> data);
|
||||
AuthSessionSettings *getAuthSessionSettings();
|
||||
|
||||
// Serialization.
|
||||
QByteArray serializeMtpAuthorization() const;
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "overview/overview_layout.h"
|
||||
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "styles/style_overview.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "core/file_utilities.h"
|
||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "observer_peer.h"
|
||||
#include "dialogs/dialogs_indexed_list.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_session.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "window/window_controller.h"
|
||||
|
||||
|
|
|
@ -256,14 +256,14 @@ QString LastSeenPrivacyController::exceptionsDescription() {
|
|||
}
|
||||
|
||||
void LastSeenPrivacyController::confirmSave(bool someAreDisallowed, base::lambda_once<void()> saveCallback) {
|
||||
if (someAreDisallowed && !Auth().data().lastSeenWarningSeen()) {
|
||||
if (someAreDisallowed && !Auth().settings().lastSeenWarningSeen()) {
|
||||
auto weakBox = std::make_shared<QPointer<ConfirmBox>>();
|
||||
auto callback = [weakBox, saveCallback = std::move(saveCallback)]() mutable {
|
||||
if (auto box = *weakBox) {
|
||||
box->closeBox();
|
||||
}
|
||||
saveCallback();
|
||||
Auth().data().setLastSeenWarningSeen(true);
|
||||
Auth().settings().setLastSeenWarningSeen(true);
|
||||
Local::writeUserSettings();
|
||||
};
|
||||
auto box = Box<ConfirmBox>(lang(lng_edit_privacy_lastseen_warning), lang(lng_continue), lang(lng_cancel), std::move(callback));
|
||||
|
|
|
@ -131,7 +131,7 @@ void fillCodes() {
|
|||
if (track->failed()) {
|
||||
Ui::show(Box<InformBox>("Could not audio :( Errors in 'log.txt'."));
|
||||
} else {
|
||||
Auth().data().setSoundOverride(key, result.paths.front());
|
||||
Auth().settings().setSoundOverride(key, result.paths.front());
|
||||
Local::writeUserSettings();
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void fillCodes() {
|
|||
}
|
||||
Codes.insert(qsl("sounds_reset"), [] {
|
||||
if (AuthSession::Exists()) {
|
||||
Auth().data().clearSoundOverrides();
|
||||
Auth().settings().clearSoundOverrides();
|
||||
Local::writeUserSettings();
|
||||
Ui::show(Box<InformBox>("All sound overrides were reset."));
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "auth_session.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "base/flags.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
|
@ -564,7 +565,7 @@ enum {
|
|||
dbiDcOptions = 0x4a,
|
||||
dbiMtpAuthorization = 0x4b,
|
||||
dbiLastSeenWarningSeenOld = 0x4c,
|
||||
dbiAuthSessionData = 0x4d,
|
||||
dbiAuthSessionSettings = 0x4d,
|
||||
dbiLangPackKey = 0x4e,
|
||||
dbiConnectionType = 0x4f,
|
||||
dbiStickersFavedLimit = 0x50,
|
||||
|
@ -634,10 +635,10 @@ enum class WriteMapWhen {
|
|||
Soon,
|
||||
};
|
||||
|
||||
std::unique_ptr<AuthSessionData> StoredAuthSessionCache;
|
||||
AuthSessionData &GetStoredAuthSessionCache() {
|
||||
std::unique_ptr<AuthSessionSettings> StoredAuthSessionCache;
|
||||
AuthSessionSettings &GetStoredAuthSessionCache() {
|
||||
if (!StoredAuthSessionCache) {
|
||||
StoredAuthSessionCache = std::make_unique<AuthSessionData>();
|
||||
StoredAuthSessionCache = std::make_unique<AuthSessionSettings>();
|
||||
}
|
||||
return *StoredAuthSessionCache;
|
||||
}
|
||||
|
@ -1106,7 +1107,7 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
|
|||
GetStoredAuthSessionCache().setLastSeenWarningSeen(v == 1);
|
||||
} break;
|
||||
|
||||
case dbiAuthSessionData: {
|
||||
case dbiAuthSessionSettings: {
|
||||
QByteArray v;
|
||||
stream >> v;
|
||||
if (!_checkStreamStatus(stream)) return false;
|
||||
|
@ -1756,8 +1757,12 @@ void _writeUserSettings() {
|
|||
recentEmojiPreloadData.push_back(qMakePair(item.first->id(), item.second));
|
||||
}
|
||||
}
|
||||
auto userDataInstance = StoredAuthSessionCache ? StoredAuthSessionCache.get() : Messenger::Instance().getAuthSessionData();
|
||||
auto userData = userDataInstance ? userDataInstance->serialize() : QByteArray();
|
||||
auto userDataInstance = StoredAuthSessionCache
|
||||
? StoredAuthSessionCache.get()
|
||||
: Messenger::Instance().getAuthSessionSettings();
|
||||
auto userData = userDataInstance
|
||||
? userDataInstance->serialize()
|
||||
: QByteArray();
|
||||
|
||||
uint32 size = 21 * (sizeof(quint32) + sizeof(qint32));
|
||||
size += sizeof(quint32) + Serialize::stringSize(Global::AskDownloadPath() ? QString() : Global::DownloadPath()) + Serialize::bytearraySize(Global::AskDownloadPath() ? QByteArray() : Global::DownloadPathBookmark());
|
||||
|
@ -1803,7 +1808,7 @@ void _writeUserSettings() {
|
|||
data.stream << quint32(dbiAutoPlay) << qint32(cAutoPlayGif() ? 1 : 0);
|
||||
data.stream << quint32(dbiUseExternalVideoPlayer) << qint32(cUseExternalVideoPlayer());
|
||||
if (!userData.isEmpty()) {
|
||||
data.stream << quint32(dbiAuthSessionData) << userData;
|
||||
data.stream << quint32(dbiAuthSessionSettings) << userData;
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -364,7 +364,8 @@ void System::ensureSoundCreated() {
|
|||
}
|
||||
|
||||
_soundTrack = Media::Audio::Current().createTrack();
|
||||
_soundTrack->fillFromFile(Auth().data().getSoundPath(qsl("msg_incoming")));
|
||||
_soundTrack->fillFromFile(
|
||||
Auth().settings().getSoundPath(qsl("msg_incoming")));
|
||||
}
|
||||
|
||||
void System::updateAll() {
|
||||
|
|
|
@ -84,8 +84,8 @@ Controller::ColumnLayout Controller::computeColumnLayout() const {
|
|||
if (bodyWidth < minimalThreeColumnWidth()) {
|
||||
return true;
|
||||
}
|
||||
if (!Auth().data().tabbedSelectorSectionEnabled()
|
||||
&& !Auth().data().thirdSectionInfoEnabled()) {
|
||||
if (!Auth().settings().tabbedSelectorSectionEnabled()
|
||||
&& !Auth().settings().thirdSectionInfoEnabled()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -115,14 +115,14 @@ Controller::ColumnLayout Controller::computeColumnLayout() const {
|
|||
}
|
||||
|
||||
int Controller::countDialogsWidthFromRatio(int bodyWidth) const {
|
||||
auto result = qRound(bodyWidth * Auth().data().dialogsWidthRatio());
|
||||
auto result = qRound(bodyWidth * Auth().settings().dialogsWidthRatio());
|
||||
accumulate_max(result, st::columnMinimalWidthLeft);
|
||||
// accumulate_min(result, st::columnMaximalWidthLeft);
|
||||
return result;
|
||||
}
|
||||
|
||||
int Controller::countThirdColumnWidthFromRatio(int bodyWidth) const {
|
||||
auto result = Auth().data().thirdColumnWidth();
|
||||
auto result = Auth().settings().thirdColumnWidth();
|
||||
accumulate_max(result, st::columnMinimalWidthThird);
|
||||
accumulate_min(result, st::columnMaximalWidthThird);
|
||||
return result;
|
||||
|
@ -175,11 +175,11 @@ void Controller::resizeForThirdSection() {
|
|||
|
||||
auto layout = computeColumnLayout();
|
||||
auto tabbedSelectorSectionEnabled =
|
||||
Auth().data().tabbedSelectorSectionEnabled();
|
||||
Auth().settings().tabbedSelectorSectionEnabled();
|
||||
auto thirdSectionInfoEnabled =
|
||||
Auth().data().thirdSectionInfoEnabled();
|
||||
Auth().data().setTabbedSelectorSectionEnabled(false);
|
||||
Auth().data().setThirdSectionInfoEnabled(false);
|
||||
Auth().settings().thirdSectionInfoEnabled();
|
||||
Auth().settings().setTabbedSelectorSectionEnabled(false);
|
||||
Auth().settings().setThirdSectionInfoEnabled(false);
|
||||
|
||||
auto wanted = countThirdColumnWidthFromRatio(layout.bodyWidth);
|
||||
auto minimal = st::columnMinimalWidthThird;
|
||||
|
@ -200,20 +200,20 @@ void Controller::resizeForThirdSection() {
|
|||
return window()->tryToExtendWidthBy(minimal);
|
||||
}();
|
||||
if (extendedBy) {
|
||||
if (extendBy != Auth().data().thirdColumnWidth()) {
|
||||
Auth().data().setThirdColumnWidth(extendBy);
|
||||
if (extendBy != Auth().settings().thirdColumnWidth()) {
|
||||
Auth().settings().setThirdColumnWidth(extendBy);
|
||||
}
|
||||
auto newBodyWidth = layout.bodyWidth + extendedBy;
|
||||
auto currentRatio = Auth().data().dialogsWidthRatio();
|
||||
Auth().data().setDialogsWidthRatio(
|
||||
auto currentRatio = Auth().settings().dialogsWidthRatio();
|
||||
Auth().settings().setDialogsWidthRatio(
|
||||
(currentRatio * layout.bodyWidth) / newBodyWidth);
|
||||
}
|
||||
auto savedValue = (extendedBy == extendBy) ? -1 : extendedBy;
|
||||
Auth().data().setThirdSectionExtendedBy(savedValue);
|
||||
Auth().settings().setThirdSectionExtendedBy(savedValue);
|
||||
|
||||
Auth().data().setTabbedSelectorSectionEnabled(
|
||||
Auth().settings().setTabbedSelectorSectionEnabled(
|
||||
tabbedSelectorSectionEnabled);
|
||||
Auth().data().setThirdSectionInfoEnabled(
|
||||
Auth().settings().setThirdSectionInfoEnabled(
|
||||
thirdSectionInfoEnabled);
|
||||
}
|
||||
|
||||
|
@ -223,23 +223,23 @@ void Controller::closeThirdSection() {
|
|||
if (layout.windowLayout == Adaptive::WindowLayout::ThreeColumn) {
|
||||
auto noResize = window()->isFullScreen()
|
||||
|| window()->isMaximized();
|
||||
auto savedValue = Auth().data().thirdSectionExtendedBy();
|
||||
auto savedValue = Auth().settings().thirdSectionExtendedBy();
|
||||
auto extendedBy = (savedValue == -1)
|
||||
? layout.thirdWidth
|
||||
: savedValue;
|
||||
auto newBodyWidth = noResize
|
||||
? layout.bodyWidth
|
||||
: (layout.bodyWidth - extendedBy);
|
||||
auto currentRatio = Auth().data().dialogsWidthRatio();
|
||||
Auth().data().setDialogsWidthRatio(
|
||||
auto currentRatio = Auth().settings().dialogsWidthRatio();
|
||||
Auth().settings().setDialogsWidthRatio(
|
||||
(currentRatio * layout.bodyWidth) / newBodyWidth);
|
||||
newWindowSize = QSize(
|
||||
window()->width() + (newBodyWidth - layout.bodyWidth),
|
||||
window()->height());
|
||||
}
|
||||
Auth().data().setTabbedSelectorSectionEnabled(false);
|
||||
Auth().data().setThirdSectionInfoEnabled(false);
|
||||
Auth().saveDataDelayed();
|
||||
Auth().settings().setTabbedSelectorSectionEnabled(false);
|
||||
Auth().settings().setThirdSectionInfoEnabled(false);
|
||||
Auth().saveSettingsDelayed();
|
||||
if (window()->size() != newWindowSize) {
|
||||
window()->resize(newWindowSize);
|
||||
} else {
|
||||
|
@ -358,9 +358,9 @@ void Navigation::showPeerInfo(
|
|||
PeerId peerId,
|
||||
const SectionShow ¶ms) {
|
||||
//if (Adaptive::ThreeColumn()
|
||||
// && !Auth().data().thirdSectionInfoEnabled()) {
|
||||
// Auth().data().setThirdSectionInfoEnabled(true);
|
||||
// Auth().saveDataDelayed();
|
||||
// && !Auth().settings().thirdSectionInfoEnabled()) {
|
||||
// Auth().settings().setThirdSectionInfoEnabled(true);
|
||||
// Auth().saveSettingsDelayed();
|
||||
//}
|
||||
showSection(Info::Memento(peerId), params);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "observer_peer.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
namespace Window {
|
||||
namespace {
|
||||
|
@ -94,8 +95,8 @@ bool Filler::showInfo() {
|
|||
} else if (!Adaptive::ThreeColumn()) {
|
||||
return true;
|
||||
} else if (
|
||||
!Auth().data().thirdSectionInfoEnabled() &&
|
||||
!Auth().data().tabbedReplacedWithInfo()) {
|
||||
!Auth().settings().thirdSectionInfoEnabled() &&
|
||||
!Auth().settings().tabbedReplacedWithInfo()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -181,6 +181,8 @@
|
|||
<(src_loc)/data/data_photo.h
|
||||
<(src_loc)/data/data_search_controller.cpp
|
||||
<(src_loc)/data/data_search_controller.h
|
||||
<(src_loc)/data/data_session.cpp
|
||||
<(src_loc)/data/data_session.h
|
||||
<(src_loc)/data/data_shared_media.cpp
|
||||
<(src_loc)/data/data_shared_media.h
|
||||
<(src_loc)/data/data_sparse_ids.cpp
|
||||
|
|
Loading…
Reference in New Issue