2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Proof-of-concept last seen hidden.

This commit is contained in:
John Preston
2024-01-09 04:19:55 -08:00
parent 33643ff7fc
commit e63d573414
13 changed files with 291 additions and 25 deletions

View File

@@ -710,21 +710,13 @@ object_ptr<Ui::RpWidget> LastSeenPrivacyController::setupBelowWidget(
void LastSeenPrivacyController::confirmSave(
bool someAreDisallowed,
Fn<void()> saveCallback) {
const auto privacy = &_session->api().globalPrivacy();
const auto hideReadTime = _hideReadTime;
const auto save = [=, saveCallback = std::move(saveCallback)] {
if (privacy->hideReadTimeCurrent() != hideReadTime) {
privacy->updateHideReadTime(hideReadTime);
}
saveCallback();
};
if (someAreDisallowed && !Core::App().settings().lastSeenWarningSeen()) {
auto callback = [
=,
save = std::move(save)
saveCallback = std::move(saveCallback)
](Fn<void()> &&close) {
close();
save();
saveCallback();
Core::App().settings().setLastSeenWarningSeen(true);
Core::App().saveSettingsDelayed();
};
@@ -735,7 +727,14 @@ void LastSeenPrivacyController::confirmSave(
});
Ui::show(std::move(box), Ui::LayerOption::KeepOther);
} else {
save();
saveCallback();
}
}
void LastSeenPrivacyController::saveAdditional() {
const auto privacy = &_session->api().globalPrivacy();
if (privacy->hideReadTimeCurrent() != _hideReadTime) {
privacy->updateHideReadTime(_hideReadTime);
}
}

View File

@@ -117,6 +117,8 @@ public:
bool someAreDisallowed,
Fn<void()> saveCallback) override;
void saveAdditional() override;
private:
const not_null<::Main::Session*> _session;
bool _hideReadTime = false;