mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Converted ttl and mute boxes to confirm boxes.
This commit is contained in:
parent
0427f90649
commit
07a022bfb6
2 changed files with 27 additions and 16 deletions
|
@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "main/main_session_settings.h"
|
#include "main/main_session_settings.h"
|
||||||
#include "ui/boxes/choose_time.h"
|
#include "ui/boxes/choose_time.h"
|
||||||
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/boxes/time_picker_box.h"
|
#include "ui/boxes/time_picker_box.h"
|
||||||
#include "ui/effects/animation_value.h"
|
#include "ui/effects/animation_value.h"
|
||||||
#include "ui/layers/generic_box.h"
|
#include "ui/layers/generic_box.h"
|
||||||
|
@ -153,11 +154,14 @@ void MuteBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||||
? tr::lng_mute_menu_unmute()
|
? tr::lng_mute_menu_unmute()
|
||||||
: tr::lng_mute_menu_mute();
|
: tr::lng_mute_menu_mute();
|
||||||
}) | rpl::flatten_latest();
|
}) | rpl::flatten_latest();
|
||||||
const auto confirm = box->addButton(std::move(confirmText), [=] {
|
Ui::ConfirmBox(box, {
|
||||||
peer->owner().notifySettings().update(peer, state->lastSeconds);
|
.confirmed = [=] {
|
||||||
box->getDelegate()->hideLayer();
|
peer->owner().notifySettings().update(peer, state->lastSeconds);
|
||||||
|
box->getDelegate()->hideLayer();
|
||||||
|
},
|
||||||
|
.confirmText = std::move(confirmText),
|
||||||
|
.cancelText = tr::lng_cancel(),
|
||||||
});
|
});
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PickMuteBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
void PickMuteBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||||
|
@ -190,18 +194,20 @@ void PickMuteBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||||
|
|
||||||
const auto pickerCallback = TimePickerBox(box, seconds, phrases, 0);
|
const auto pickerCallback = TimePickerBox(box, seconds, phrases, 0);
|
||||||
|
|
||||||
box->addButton(tr::lng_mute_menu_mute(), [=] {
|
Ui::ConfirmBox(box, {
|
||||||
const auto muteFor = pickerCallback();
|
.confirmed = [=] {
|
||||||
peer->owner().notifySettings().update(peer, muteFor);
|
const auto muteFor = pickerCallback();
|
||||||
peer->session().settings().addMutePeriod(muteFor);
|
peer->owner().notifySettings().update(peer, muteFor);
|
||||||
peer->session().saveSettings();
|
peer->session().settings().addMutePeriod(muteFor);
|
||||||
box->closeBox();
|
peer->session().saveSettings();
|
||||||
|
box->closeBox();
|
||||||
|
},
|
||||||
|
.confirmText = tr::lng_mute_menu_mute(),
|
||||||
|
.cancelText = tr::lng_cancel(),
|
||||||
});
|
});
|
||||||
|
|
||||||
box->setTitle(tr::lng_mute_box_title());
|
box->setTitle(tr::lng_mute_box_title());
|
||||||
|
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
|
||||||
|
|
||||||
const auto top = box->addTopButton(st::infoTopBarMenu);
|
const auto top = box->addTopButton(st::infoTopBarMenu);
|
||||||
top->setClickedCallback([=] {
|
top->setClickedCallback([=] {
|
||||||
if (state->menu) {
|
if (state->menu) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "menu/menu_ttl.h"
|
#include "menu/menu_ttl.h"
|
||||||
|
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/boxes/time_picker_box.h"
|
#include "ui/boxes/time_picker_box.h"
|
||||||
#include "ui/layers/generic_box.h"
|
#include "ui/layers/generic_box.h"
|
||||||
#include "ui/text/format_values.h"
|
#include "ui/text/format_values.h"
|
||||||
|
@ -186,17 +187,21 @@ void TTLBox(not_null<Ui::GenericBox*> box, Args args) {
|
||||||
|
|
||||||
const auto pickerTtl = TimePickerBox(box, ttls, phrases, args.startTtl);
|
const auto pickerTtl = TimePickerBox(box, ttls, phrases, args.startTtl);
|
||||||
|
|
||||||
box->addButton(tr::lng_settings_save(), [=] {
|
Ui::ConfirmBox(box, {
|
||||||
args.callback(pickerTtl());
|
.confirmed = [=] {
|
||||||
box->getDelegate()->hideLayer();
|
args.callback(pickerTtl());
|
||||||
|
box->getDelegate()->hideLayer();
|
||||||
|
},
|
||||||
|
.confirmText = tr::lng_settings_save(),
|
||||||
|
.cancelText = tr::lng_cancel(),
|
||||||
});
|
});
|
||||||
|
|
||||||
box->setTitle(tr::lng_manage_messages_ttl_title());
|
box->setTitle(tr::lng_manage_messages_ttl_title());
|
||||||
|
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
|
||||||
if (args.startTtl) {
|
if (args.startTtl) {
|
||||||
box->addLeftButton(tr::lng_manage_messages_ttl_disable(), [=] {
|
box->addLeftButton(tr::lng_manage_messages_ttl_disable(), [=] {
|
||||||
args.callback(0);
|
args.callback(0);
|
||||||
|
box->getDelegate()->hideLayer();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue