mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
fix: don't mark contents read
fix: crash if config is not a valid json
This commit is contained in:
parent
d940dc193e
commit
f06747f2a1
2 changed files with 23 additions and 8 deletions
|
@ -1318,6 +1318,11 @@ void ApiWrap::migrateFail(not_null<PeerData*> peer, const QString &error) {
|
||||||
|
|
||||||
void ApiWrap::markContentsRead(
|
void ApiWrap::markContentsRead(
|
||||||
const base::flat_set<not_null<HistoryItem*>> &items) {
|
const base::flat_set<not_null<HistoryItem*>> &items) {
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
if (!settings->sendReadMessages) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto markedIds = QVector<MTPint>();
|
auto markedIds = QVector<MTPint>();
|
||||||
auto channelMarkedIds = base::flat_map<
|
auto channelMarkedIds = base::flat_map<
|
||||||
not_null<ChannelData*>,
|
not_null<ChannelData*>,
|
||||||
|
@ -1352,6 +1357,12 @@ void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
|
||||||
if (!item->markContentsRead(true) || !item->isRegular()) {
|
if (!item->markContentsRead(true) || !item->isRegular()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
if (!settings->sendReadMessages) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
|
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
|
||||||
if (const auto channel = item->history()->peer->asChannel()) {
|
if (const auto channel = item->history()->peer->asChannel()) {
|
||||||
request(MTPchannels_ReadMessageContents(
|
request(MTPchannels_ReadMessageContents(
|
||||||
|
|
|
@ -139,15 +139,19 @@ void load()
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
json p;
|
|
||||||
file >> p;
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
settings = p.get<AyuGramSettings>();
|
json p;
|
||||||
}
|
file >> p;
|
||||||
catch (...) {
|
file.close();
|
||||||
LOG(("AyuGramSettings: failed to parse settings file"));
|
|
||||||
|
try {
|
||||||
|
settings = p.get<AyuGramSettings>();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
LOG(("AyuGramSettings: failed to parse settings file"));
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
LOG(("AyuGramSettings: failed to read settings file (not json-like)"));
|
||||||
}
|
}
|
||||||
postinitialize();
|
postinitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue