Allow sending inline result preview in scheduled messages

This commit is contained in:
Eric Kotato 2021-08-27 02:07:09 +03:00
parent 9e640c3f5c
commit 4b7a6b82c0
3 changed files with 15 additions and 10 deletions

View file

@ -49,6 +49,7 @@ FillMenuResult FillSendMenu(
} }
const auto now = type; const auto now = type;
if (now == Type::Disabled if (now == Type::Disabled
|| now == Type::PreviewOnly
|| (!silent && now == Type::SilentOnly)) { || (!silent && now == Type::SilentOnly)) {
return FillMenuResult::None; return FillMenuResult::None;
} }
@ -83,15 +84,17 @@ FillMenuResult FillSendPreviewMenu(
if (defaultSend) { if (defaultSend) {
menu->addAction(ktr("ktg_send_preview"), defaultSend); menu->addAction(ktr("ktg_send_preview"), defaultSend);
} }
if (silent && now != Type::Reminder) { if (type != Type::PreviewOnly) {
menu->addAction(ktr("ktg_send_silent_preview"), silent); if (silent && now != Type::Reminder) {
} menu->addAction(ktr("ktg_send_silent_preview"), silent);
if (schedule && now != Type::SilentOnly) { }
menu->addAction( if (schedule && now != Type::SilentOnly) {
(now == Type::Reminder menu->addAction(
? ktr("ktg_reminder_preview") (now == Type::Reminder
: ktr("ktg_schedule_preview")), ? ktr("ktg_reminder_preview")
schedule); : ktr("ktg_schedule_preview")),
schedule);
}
} }
return FillMenuResult::Success; return FillMenuResult::Success;
} }
@ -127,6 +130,7 @@ void SetupMenuAndShortcuts(
const auto now = type(); const auto now = type();
if (now == Type::Disabled if (now == Type::Disabled
|| now == Type::PreviewOnly
|| (!silent && now == Type::SilentOnly)) { || (!silent && now == Type::SilentOnly)) {
return; return;
} }

View file

@ -25,6 +25,7 @@ enum class Type {
Scheduled, Scheduled,
ScheduledToUser, // For "Send when online". ScheduledToUser, // For "Send when online".
Reminder, Reminder,
PreviewOnly,
}; };
enum class FillMenuResult { enum class FillMenuResult {

View file

@ -99,7 +99,7 @@ ScheduledWidget::ScheduledWidget(
this, this,
controller, controller,
ComposeControls::Mode::Scheduled, ComposeControls::Mode::Scheduled,
SendMenu::Type::Disabled)) SendMenu::Type::PreviewOnly))
, _scrollDown(_scroll, st::historyToDown) { , _scrollDown(_scroll, st::historyToDown) {
const auto state = Dialogs::EntryState{ const auto state = Dialogs::EntryState{
.key = _history, .key = _history,