mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
feat: confirmation while attempting to send sticker (changeable in settings)
This commit is contained in:
parent
7450d3fc4d
commit
a1aac455db
6 changed files with 77 additions and 7 deletions
|
@ -366,6 +366,7 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
|
||||||
const auto itemId = item->id;
|
const auto itemId = item->id;
|
||||||
const auto topicRootId = item->topicRootId();
|
const auto topicRootId = item->topicRootId();
|
||||||
const auto history = item->history();
|
const auto history = item->history();
|
||||||
|
|
||||||
controller->show(Ui::MakeConfirmBox({
|
controller->show(Ui::MakeConfirmBox({
|
||||||
.text = tr::lng_bot_share_phone(),
|
.text = tr::lng_bot_share_phone(),
|
||||||
.confirmed = [=] {
|
.confirmed = [=] {
|
||||||
|
|
|
@ -145,6 +145,14 @@ namespace AyuSettings {
|
||||||
showMessageSeconds = val;
|
showMessageSeconds = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_stickerConfirmation(bool val) {
|
||||||
|
stickerConfirmation = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_GIFConfirmation(bool val) {
|
||||||
|
GIFConfirmation = val;
|
||||||
|
}
|
||||||
|
|
||||||
rpl::producer<QString> get_deletedMarkReactive() {
|
rpl::producer<QString> get_deletedMarkReactive() {
|
||||||
return deletedMarkReactive.value();
|
return deletedMarkReactive.value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,10 @@ namespace AyuSettings {
|
||||||
recentStickersCount = 20;
|
recentStickersCount = 20;
|
||||||
showGhostToggleInDrawer = true;
|
showGhostToggleInDrawer = true;
|
||||||
|
|
||||||
|
// ~ Beta functionality
|
||||||
|
stickerConfirmation = false;
|
||||||
|
GIFConfirmation = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* showPeerId = 0 means no ID shown
|
* showPeerId = 0 means no ID shown
|
||||||
* showPeerId = 1 means ID shown as for Telegram API devs
|
* showPeerId = 1 means ID shown as for Telegram API devs
|
||||||
|
@ -78,6 +82,10 @@ namespace AyuSettings {
|
||||||
|
|
||||||
QS_FIELD(bool, showMessageSeconds)
|
QS_FIELD(bool, showMessageSeconds)
|
||||||
|
|
||||||
|
QS_FIELD(bool, stickerConfirmation)
|
||||||
|
|
||||||
|
QS_FIELD(bool, GIFConfirmation)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_sendReadPackets(bool val);
|
void set_sendReadPackets(bool val);
|
||||||
void set_sendOnlinePackets(bool val);
|
void set_sendOnlinePackets(bool val);
|
||||||
|
@ -99,6 +107,9 @@ namespace AyuSettings {
|
||||||
void set_showGhostToggleInDrawer(bool val);
|
void set_showGhostToggleInDrawer(bool val);
|
||||||
void set_showPeerId(int val);
|
void set_showPeerId(int val);
|
||||||
void set_showMessageSeconds(bool val);
|
void set_showMessageSeconds(bool val);
|
||||||
|
|
||||||
|
void set_stickerConfirmation(bool val);
|
||||||
|
void set_GIFConfirmation(bool val);
|
||||||
};
|
};
|
||||||
|
|
||||||
AyuGramSettings &getInstance();
|
AyuGramSettings &getInstance();
|
||||||
|
|
|
@ -242,6 +242,8 @@ namespace Settings {
|
||||||
AddDividerText(container, tr::ayu_SettingsCustomizationHint());
|
AddDividerText(container, tr::ayu_SettingsCustomizationHint());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Ayu::SetupShowPeerId(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller) {
|
void Ayu::SetupShowPeerId(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller) {
|
||||||
auto settings = &AyuSettings::getInstance();
|
auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
|
@ -316,6 +318,26 @@ namespace Settings {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ayu::SetupBetaFunctions(not_null<Ui::VerticalLayout *> container) {
|
||||||
|
auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
|
AddSubsectionTitle(container, rpl::single(QString("Beta functions")));
|
||||||
|
|
||||||
|
AddButton(
|
||||||
|
container,
|
||||||
|
rpl::single(QString("Send sticker confirmation")),
|
||||||
|
st::settingsButtonNoIcon
|
||||||
|
)->toggleOn(
|
||||||
|
rpl::single(settings->stickerConfirmation)
|
||||||
|
)->toggledValue(
|
||||||
|
) | rpl::filter([=] (bool enabled) {
|
||||||
|
return (enabled != settings->stickerConfirmation);
|
||||||
|
}) | rpl::start_with_next([=] (bool enabled) {
|
||||||
|
settings->set_stickerConfirmation(enabled);
|
||||||
|
AyuSettings::save();
|
||||||
|
}, container->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
void Ayu::SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller) {
|
void Ayu::SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller) {
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
SetupGhostEssentials(container);
|
SetupGhostEssentials(container);
|
||||||
|
@ -335,6 +357,9 @@ namespace Settings {
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
SetupCustomization(container, controller);
|
SetupCustomization(container, controller);
|
||||||
|
|
||||||
|
AddSkip(container);
|
||||||
|
SetupBetaFunctions(container);
|
||||||
|
|
||||||
AddDividerText(container, tr::ayu_SettingsWatermark());
|
AddDividerText(container, tr::ayu_SettingsWatermark());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace Settings {
|
||||||
void SetupShowPeerId(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller);
|
void SetupShowPeerId(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller);
|
||||||
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout *> container);
|
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout *> container);
|
||||||
|
|
||||||
|
void SetupBetaFunctions(not_null<Ui::VerticalLayout *> container);
|
||||||
|
|
||||||
void SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> null);
|
void SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> null);
|
||||||
void setupContent(not_null<Window::SessionController *> controller);
|
void setupContent(not_null<Window::SessionController *> controller);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1710,13 +1710,36 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
if (e->modifiers() & Qt::ControlModifier) {
|
if (e->modifiers() & Qt::ControlModifier) {
|
||||||
showStickerSetBox(document);
|
showStickerSetBox(document);
|
||||||
} else {
|
} else {
|
||||||
_chosen.fire({
|
auto settings = &AyuSettings::getInstance();
|
||||||
.document = document,
|
if (settings->stickerConfirmation) {
|
||||||
.messageSendingFrom = messageSentAnimationInfo(
|
// it is necessary to store it here, because section & index can be changed by cursor position (guess)
|
||||||
sticker->section,
|
int currentSection = sticker->section;
|
||||||
sticker->index,
|
int currentIndex = sticker->index;
|
||||||
document),
|
auto sendStickerCallback = [=, this] {
|
||||||
});
|
_chosen.fire({
|
||||||
|
.document = document,
|
||||||
|
.messageSendingFrom = messageSentAnimationInfo(
|
||||||
|
currentSection,
|
||||||
|
currentIndex,
|
||||||
|
document),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
|
.text = rpl::single(QString("Do you want to send sticker?")),
|
||||||
|
.confirmed = sendStickerCallback,
|
||||||
|
.confirmText = rpl::single(QString("Send")),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_chosen.fire({
|
||||||
|
.document = document,
|
||||||
|
.messageSendingFrom = messageSentAnimationInfo(
|
||||||
|
sticker->section,
|
||||||
|
sticker->index,
|
||||||
|
document),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (auto set = std::get_if<OverSet>(&pressed)) {
|
} else if (auto set = std::get_if<OverSet>(&pressed)) {
|
||||||
Assert(set->section >= 0 && set->section < sets.size());
|
Assert(set->section >= 0 && set->section < sets.size());
|
||||||
|
|
Loading…
Add table
Reference in a new issue