mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-30 01:08:02 +00:00
chore: refactor settings
This commit is contained in:
@@ -319,8 +319,8 @@ Session::Session(not_null<Main::Session*> session)
|
||||
}, _lifetime);
|
||||
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->disableStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.disableStories) {
|
||||
_stories->loadMore(Data::StorySourcesList::NotHidden);
|
||||
}
|
||||
});
|
||||
@@ -2485,14 +2485,14 @@ void Session::updateEditedMessage(const MTPMessage &data) {
|
||||
}
|
||||
|
||||
// AyuGram saveMessagesHistory
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
HistoryMessageEdition edit;
|
||||
|
||||
if (data.type() != mtpc_message) {
|
||||
goto proceed;
|
||||
}
|
||||
edit = HistoryMessageEdition(_session, data.c_message());
|
||||
if (settings->saveMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) {
|
||||
if (settings.saveMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) {
|
||||
const auto msg = existing->originalText();
|
||||
|
||||
if (edit.textWithEntities == msg || msg.empty()) {
|
||||
@@ -2637,12 +2637,12 @@ void Session::unregisterMessageTTL(
|
||||
}
|
||||
|
||||
void Session::checkTTLs() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
_ttlCheckTimer.cancel();
|
||||
const auto now = base::unixtime::now();
|
||||
|
||||
if (settings->saveDeletedMessages) {
|
||||
if (settings.saveDeletedMessages) {
|
||||
auto toBeRemoved = ranges::views::take_while(
|
||||
_ttlMessages,
|
||||
[now](const auto &pair) {
|
||||
|
||||
Reference in New Issue
Block a user