2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

Simplified confirmed callback for ConfirmBox instances.

This commit is contained in:
23rd
2020-09-24 15:48:02 +03:00
committed by John Preston
parent 9f3af7234e
commit f81271d1fe
21 changed files with 89 additions and 144 deletions

View File

@@ -514,11 +514,11 @@ void LastSeenPrivacyController::confirmSave(
FnMut<void()> saveCallback) {
if (someAreDisallowed && !Core::App().settings().lastSeenWarningSeen()) {
const auto session = _session;
auto weakBox = std::make_shared<QPointer<ConfirmBox>>();
auto callback = [=, saveCallback = std::move(saveCallback)]() mutable {
if (auto box = *weakBox) {
box->closeBox();
}
auto callback = [
=,
saveCallback = std::move(saveCallback)
](Fn<void()> &&close) mutable {
close();
saveCallback();
Core::App().settings().setLastSeenWarningSeen(true);
Core::App().saveSettingsDelayed();
@@ -528,7 +528,7 @@ void LastSeenPrivacyController::confirmSave(
tr::lng_continue(tr::now),
tr::lng_cancel(tr::now),
std::move(callback));
*weakBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
Ui::show(std::move(box), Ui::LayerOption::KeepOther);
} else {
saveCallback();
}