mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-31 09:36:12 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba8c1a6b0f | |||
| 0b02f28818 | |||
| 9d5fa2358b | |||
| 6faf41994e | |||
| 34bfeb7058 | |||
| d83cb2cd72 | |||
| dc437d43f2 | |||
| 21775bd509 | |||
| f3f6b349ea | |||
| 4de4665fc3 | |||
| 3c50e06dcc | |||
| 4a277eee39 |
@@ -8050,6 +8050,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
"ayu_HideReactionsInGroups" = "Groups";
|
"ayu_HideReactionsInGroups" = "Groups";
|
||||||
"ayu_HideReactionsInPrivateChats" = "Private Chats";
|
"ayu_HideReactionsInPrivateChats" = "Private Chats";
|
||||||
"ayu_QuickAdminShortcuts" = "Quick Admin Shortcuts";
|
"ayu_QuickAdminShortcuts" = "Quick Admin Shortcuts";
|
||||||
|
"ayu_DisableGreetingSticker" = "Disable Greeting Sticker";
|
||||||
"ayu_TranslationProvider" = "Translation Provider";
|
"ayu_TranslationProvider" = "Translation Provider";
|
||||||
"ayu_LinksHeader" = "Links";
|
"ayu_LinksHeader" = "Links";
|
||||||
"ayu_LinksChannel" = "Channel";
|
"ayu_LinksChannel" = "Channel";
|
||||||
|
|||||||
@@ -963,6 +963,12 @@ void AyuSettings::setQuickAdminShortcuts(bool val) {
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AyuSettings::setDisableGreetingSticker(bool val) {
|
||||||
|
if (_disableGreetingSticker.current() == val) return;
|
||||||
|
_disableGreetingSticker = val;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
void AyuSettings::setShowPeerId(PeerIdDisplay val) {
|
void AyuSettings::setShowPeerId(PeerIdDisplay val) {
|
||||||
if (_showPeerId.current() == val) return;
|
if (_showPeerId.current() == val) return;
|
||||||
_showPeerId = val;
|
_showPeerId = val;
|
||||||
@@ -1070,6 +1076,7 @@ void to_json(nlohmann::json &j, const AyuSettings &s) {
|
|||||||
{"disableAds", s._disableAds.current()},
|
{"disableAds", s._disableAds.current()},
|
||||||
{"disableStories", s._disableStories.current()},
|
{"disableStories", s._disableStories.current()},
|
||||||
{"disableCustomBackgrounds", s._disableCustomBackgrounds.current()},
|
{"disableCustomBackgrounds", s._disableCustomBackgrounds.current()},
|
||||||
|
{"hidePremiumStatuses", s._hidePremiumStatuses.current()},
|
||||||
{"showOnlyAddedEmojisAndStickers", s._showOnlyAddedEmojisAndStickers.current()},
|
{"showOnlyAddedEmojisAndStickers", s._showOnlyAddedEmojisAndStickers.current()},
|
||||||
{"collapseSimilarChannels", s._collapseSimilarChannels.current()},
|
{"collapseSimilarChannels", s._collapseSimilarChannels.current()},
|
||||||
{"hideSimilarChannels", s._hideSimilarChannels.current()},
|
{"hideSimilarChannels", s._hideSimilarChannels.current()},
|
||||||
@@ -1129,6 +1136,7 @@ void to_json(nlohmann::json &j, const AyuSettings &s) {
|
|||||||
{"hideAllChatsFolder", s._hideAllChatsFolder.current()},
|
{"hideAllChatsFolder", s._hideAllChatsFolder.current()},
|
||||||
{"channelBottomButton", s._channelBottomButton.current()},
|
{"channelBottomButton", s._channelBottomButton.current()},
|
||||||
{"quickAdminShortcuts", s._quickAdminShortcuts.current()},
|
{"quickAdminShortcuts", s._quickAdminShortcuts.current()},
|
||||||
|
{"disableGreetingSticker", s._disableGreetingSticker.current()},
|
||||||
{"showPeerId", s._showPeerId.current()},
|
{"showPeerId", s._showPeerId.current()},
|
||||||
{"showMessageSeconds", s._showMessageSeconds.current()},
|
{"showMessageSeconds", s._showMessageSeconds.current()},
|
||||||
{"showMessageShot", s._showMessageShot.current()},
|
{"showMessageShot", s._showMessageShot.current()},
|
||||||
@@ -1170,6 +1178,7 @@ void from_json(const nlohmann::json &j, AyuSettings &s) {
|
|||||||
s._disableAds = j.value("disableAds", defaults._disableAds.current());
|
s._disableAds = j.value("disableAds", defaults._disableAds.current());
|
||||||
s._disableStories = j.value("disableStories", defaults._disableStories.current());
|
s._disableStories = j.value("disableStories", defaults._disableStories.current());
|
||||||
s._disableCustomBackgrounds = j.value("disableCustomBackgrounds", defaults._disableCustomBackgrounds.current());
|
s._disableCustomBackgrounds = j.value("disableCustomBackgrounds", defaults._disableCustomBackgrounds.current());
|
||||||
|
s._hidePremiumStatuses = j.value("hidePremiumStatuses", defaults._hidePremiumStatuses.current());
|
||||||
s._showOnlyAddedEmojisAndStickers = j.value("showOnlyAddedEmojisAndStickers", defaults._showOnlyAddedEmojisAndStickers.current());
|
s._showOnlyAddedEmojisAndStickers = j.value("showOnlyAddedEmojisAndStickers", defaults._showOnlyAddedEmojisAndStickers.current());
|
||||||
s._collapseSimilarChannels = j.value("collapseSimilarChannels", defaults._collapseSimilarChannels.current());
|
s._collapseSimilarChannels = j.value("collapseSimilarChannels", defaults._collapseSimilarChannels.current());
|
||||||
s._hideSimilarChannels = j.value("hideSimilarChannels", defaults._hideSimilarChannels.current());
|
s._hideSimilarChannels = j.value("hideSimilarChannels", defaults._hideSimilarChannels.current());
|
||||||
@@ -1229,6 +1238,7 @@ void from_json(const nlohmann::json &j, AyuSettings &s) {
|
|||||||
s._hideAllChatsFolder = j.value("hideAllChatsFolder", defaults._hideAllChatsFolder.current());
|
s._hideAllChatsFolder = j.value("hideAllChatsFolder", defaults._hideAllChatsFolder.current());
|
||||||
s._channelBottomButton = j.value("channelBottomButton", defaults._channelBottomButton.current());
|
s._channelBottomButton = j.value("channelBottomButton", defaults._channelBottomButton.current());
|
||||||
s._quickAdminShortcuts = j.value("quickAdminShortcuts", defaults._quickAdminShortcuts.current());
|
s._quickAdminShortcuts = j.value("quickAdminShortcuts", defaults._quickAdminShortcuts.current());
|
||||||
|
s._disableGreetingSticker = j.value("disableGreetingSticker", defaults._disableGreetingSticker.current());
|
||||||
s._showPeerId = j.value("showPeerId", defaults._showPeerId.current());
|
s._showPeerId = j.value("showPeerId", defaults._showPeerId.current());
|
||||||
s._showMessageSeconds = j.value("showMessageSeconds", defaults._showMessageSeconds.current());
|
s._showMessageSeconds = j.value("showMessageSeconds", defaults._showMessageSeconds.current());
|
||||||
s._showMessageShot = j.value("showMessageShot", defaults._showMessageShot.current());
|
s._showMessageShot = j.value("showMessageShot", defaults._showMessageShot.current());
|
||||||
|
|||||||
@@ -337,6 +337,7 @@ public:
|
|||||||
[[nodiscard]] bool hideAllChatsFolder() const { return _hideAllChatsFolder.current(); }
|
[[nodiscard]] bool hideAllChatsFolder() const { return _hideAllChatsFolder.current(); }
|
||||||
[[nodiscard]] ChannelBottomButton channelBottomButton() const { return _channelBottomButton.current(); }
|
[[nodiscard]] ChannelBottomButton channelBottomButton() const { return _channelBottomButton.current(); }
|
||||||
[[nodiscard]] bool quickAdminShortcuts() const { return _quickAdminShortcuts.current(); }
|
[[nodiscard]] bool quickAdminShortcuts() const { return _quickAdminShortcuts.current(); }
|
||||||
|
[[nodiscard]] bool disableGreetingSticker() const { return _disableGreetingSticker.current(); }
|
||||||
[[nodiscard]] PeerIdDisplay showPeerId() const { return _showPeerId.current(); }
|
[[nodiscard]] PeerIdDisplay showPeerId() const { return _showPeerId.current(); }
|
||||||
[[nodiscard]] bool showMessageSeconds() const { return _showMessageSeconds.current(); }
|
[[nodiscard]] bool showMessageSeconds() const { return _showMessageSeconds.current(); }
|
||||||
[[nodiscard]] bool showMessageShot() const { return _showMessageShot.current(); }
|
[[nodiscard]] bool showMessageShot() const { return _showMessageShot.current(); }
|
||||||
@@ -421,6 +422,7 @@ public:
|
|||||||
void setHideAllChatsFolder(bool val);
|
void setHideAllChatsFolder(bool val);
|
||||||
void setChannelBottomButton(ChannelBottomButton val);
|
void setChannelBottomButton(ChannelBottomButton val);
|
||||||
void setQuickAdminShortcuts(bool val);
|
void setQuickAdminShortcuts(bool val);
|
||||||
|
void setDisableGreetingSticker(bool val);
|
||||||
void setShowPeerId(PeerIdDisplay val);
|
void setShowPeerId(PeerIdDisplay val);
|
||||||
void setShowMessageSeconds(bool val);
|
void setShowMessageSeconds(bool val);
|
||||||
void setShowMessageShot(bool val);
|
void setShowMessageShot(bool val);
|
||||||
@@ -577,6 +579,8 @@ public:
|
|||||||
[[nodiscard]] rpl::producer<ChannelBottomButton> channelBottomButtonChanges() const { return _channelBottomButton.changes(); }
|
[[nodiscard]] rpl::producer<ChannelBottomButton> channelBottomButtonChanges() const { return _channelBottomButton.changes(); }
|
||||||
[[nodiscard]] rpl::producer<bool> quickAdminShortcutsValue() const { return _quickAdminShortcuts.value(); }
|
[[nodiscard]] rpl::producer<bool> quickAdminShortcutsValue() const { return _quickAdminShortcuts.value(); }
|
||||||
[[nodiscard]] rpl::producer<bool> quickAdminShortcutsChanges() const { return _quickAdminShortcuts.changes(); }
|
[[nodiscard]] rpl::producer<bool> quickAdminShortcutsChanges() const { return _quickAdminShortcuts.changes(); }
|
||||||
|
[[nodiscard]] rpl::producer<bool> disableGreetingStickerValue() const { return _disableGreetingSticker.value(); }
|
||||||
|
[[nodiscard]] rpl::producer<bool> disableGreetingStickerChanges() const { return _disableGreetingSticker.changes(); }
|
||||||
[[nodiscard]] rpl::producer<PeerIdDisplay> showPeerIdValue() const { return _showPeerId.value(); }
|
[[nodiscard]] rpl::producer<PeerIdDisplay> showPeerIdValue() const { return _showPeerId.value(); }
|
||||||
[[nodiscard]] rpl::producer<PeerIdDisplay> showPeerIdChanges() const { return _showPeerId.changes(); }
|
[[nodiscard]] rpl::producer<PeerIdDisplay> showPeerIdChanges() const { return _showPeerId.changes(); }
|
||||||
[[nodiscard]] rpl::producer<bool> showMessageSecondsValue() const { return _showMessageSeconds.value(); }
|
[[nodiscard]] rpl::producer<bool> showMessageSecondsValue() const { return _showMessageSeconds.value(); }
|
||||||
@@ -683,6 +687,7 @@ private:
|
|||||||
rpl::variable<bool> _hideAllChatsFolder = false;
|
rpl::variable<bool> _hideAllChatsFolder = false;
|
||||||
rpl::variable<ChannelBottomButton> _channelBottomButton = ChannelBottomButton::DiscussWithFallback;
|
rpl::variable<ChannelBottomButton> _channelBottomButton = ChannelBottomButton::DiscussWithFallback;
|
||||||
rpl::variable<bool> _quickAdminShortcuts = true;
|
rpl::variable<bool> _quickAdminShortcuts = true;
|
||||||
|
rpl::variable<bool> _disableGreetingSticker = false;
|
||||||
rpl::variable<PeerIdDisplay> _showPeerId = PeerIdDisplay::BotApi;
|
rpl::variable<PeerIdDisplay> _showPeerId = PeerIdDisplay::BotApi;
|
||||||
rpl::variable<bool> _showMessageSeconds = false;
|
rpl::variable<bool> _showMessageSeconds = false;
|
||||||
rpl::variable<bool> _showMessageShot = true;
|
rpl::variable<bool> _showMessageShot = true;
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ bool filterBlocked(const not_null<HistoryItem*> item) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (const auto bot = item->viaBot()) {
|
||||||
|
if (isBlocked(bot)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ void loadPhotoSync(not_null<Main::Session*> session, const std::pair<not_null<Ph
|
|||||||
|
|
||||||
const auto finalCheck = [=]
|
const auto finalCheck = [=]
|
||||||
{
|
{
|
||||||
return !photo.first->loading();
|
return view->loaded();
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto saveToFiles = [=]
|
const auto saveToFiles = [=]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "api/api_text_entities.h"
|
#include "api/api_text_entities.h"
|
||||||
#include "ayu/features/translator/ayu_translator.h"
|
#include "ayu/features/translator/ayu_translator.h"
|
||||||
|
#include "base/weak_ptr.h"
|
||||||
#include "data/data_msg_id.h"
|
#include "data/data_msg_id.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
@@ -17,7 +18,9 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class AyuTranslateProvider final : public Ui::TranslateProvider {
|
class AyuTranslateProvider final
|
||||||
|
: public Ui::TranslateProvider
|
||||||
|
, public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
AyuTranslateProvider(
|
AyuTranslateProvider(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
@@ -48,6 +51,18 @@ public:
|
|||||||
const LanguageId &to,
|
const LanguageId &to,
|
||||||
Fn<void(int, Ui::TranslateProviderResult)> doneOne,
|
Fn<void(int, Ui::TranslateProviderResult)> doneOne,
|
||||||
Fn<void()> doneAll) override {
|
Fn<void()> doneAll) override {
|
||||||
|
doneOne = [weak = base::make_weak(this), doneOne = std::move(doneOne)](
|
||||||
|
int index,
|
||||||
|
Ui::TranslateProviderResult result) {
|
||||||
|
if (weak) {
|
||||||
|
doneOne(index, std::move(result));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
doneAll = [weak = base::make_weak(this), doneAll = std::move(doneAll)] {
|
||||||
|
if (weak) {
|
||||||
|
doneAll();
|
||||||
|
}
|
||||||
|
};
|
||||||
if (requests.empty()) {
|
if (requests.empty()) {
|
||||||
doneAll();
|
doneAll();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ MessagePreview::MessagePreview(
|
|||||||
.replyTo = FullReplyTo{
|
.replyTo = FullReplyTo{
|
||||||
.messageId = _state->reply->data()->fullId(),
|
.messageId = _state->reply->data()->fullId(),
|
||||||
},
|
},
|
||||||
.date = base::unixtime::now(),
|
.date = base::unixtime::now() - 3600,
|
||||||
}, TextWithEntities{ u"You need to go outside and touch some grass..."_q },
|
}, TextWithEntities{ u"You need to go outside and touch some grass..."_q },
|
||||||
MTP_messageMediaEmpty());
|
MTP_messageMediaEmpty());
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ void BuildAppearance(SectionBuilder &builder, AyuSectionBuilder &ayu) {
|
|||||||
.getter = &AyuSettings::disableCustomBackgrounds,
|
.getter = &AyuSettings::disableCustomBackgrounds,
|
||||||
.setter = &AyuSettings::setDisableCustomBackgrounds,
|
.setter = &AyuSettings::setDisableCustomBackgrounds,
|
||||||
});
|
});
|
||||||
|
|
||||||
ayu.addSettingToggle({
|
ayu.addSettingToggle({
|
||||||
.id = u"ayu/hidePremiumStatuses"_q,
|
.id = u"ayu/hidePremiumStatuses"_q,
|
||||||
.title = tr::ayu_HidePremiumStatuses(),
|
.title = tr::ayu_HidePremiumStatuses(),
|
||||||
|
|||||||
@@ -117,6 +117,12 @@ void BuildGroupsAndChannels(SectionBuilder &builder, AyuSectionBuilder &ayu) {
|
|||||||
.getter = &AyuSettings::quickAdminShortcuts,
|
.getter = &AyuSettings::quickAdminShortcuts,
|
||||||
.setter = &AyuSettings::setQuickAdminShortcuts,
|
.setter = &AyuSettings::setQuickAdminShortcuts,
|
||||||
});
|
});
|
||||||
|
ayu.addSettingToggle({
|
||||||
|
.id = u"ayu/disableGreetingSticker"_q,
|
||||||
|
.title = tr::ayu_DisableGreetingSticker(),
|
||||||
|
.getter = &AyuSettings::disableGreetingSticker,
|
||||||
|
.setter = &AyuSettings::setDisableGreetingSticker,
|
||||||
|
});
|
||||||
ayu.addSettingToggle({
|
ayu.addSettingToggle({
|
||||||
.id = u"ayu/showMessageShot"_q,
|
.id = u"ayu/showMessageShot"_q,
|
||||||
.title = tr::ayu_SettingsShowMessageShot(),
|
.title = tr::ayu_SettingsShowMessageShot(),
|
||||||
|
|||||||
@@ -783,7 +783,7 @@ void Controller::setupSharePhoneNumber() {
|
|||||||
object_ptr<Ui::Checkbox>(
|
object_ptr<Ui::Checkbox>(
|
||||||
_box,
|
_box,
|
||||||
tr::lng_contact_share_phone(tr::now),
|
tr::lng_contact_share_phone(tr::now),
|
||||||
true,
|
false,
|
||||||
st::defaultBoxCheckbox),
|
st::defaultBoxCheckbox),
|
||||||
st::addContactWarningMargin);
|
st::addContactWarningMargin);
|
||||||
_box->addRow(
|
_box->addRow(
|
||||||
|
|||||||
@@ -548,7 +548,7 @@ void GifsListWidget::selectInlineResult(
|
|||||||
|
|
||||||
const auto &settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.gifConfirmation()) {
|
if (settings.gifConfirmation()) {
|
||||||
Ui::show(Ui::MakeConfirmBox({
|
_show->showBox(Ui::MakeConfirmBox({
|
||||||
.text = tr::ayu_ConfirmationGIF(),
|
.text = tr::ayu_ConfirmationGIF(),
|
||||||
.confirmed = sendGIFCallback,
|
.confirmed = sendGIFCallback,
|
||||||
.confirmText = tr::lng_send_button()
|
.confirmText = tr::lng_send_button()
|
||||||
|
|||||||
@@ -2300,7 +2300,7 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (settings.stickerConfirmation() && (_mode == Mode::Full || _mode == Mode::ChatIntro) && _requireConfirmation) {
|
if (settings.stickerConfirmation() && (_mode == Mode::Full || _mode == Mode::ChatIntro) && _requireConfirmation) {
|
||||||
Ui::show(Ui::MakeConfirmBox({
|
_show->showBox(Ui::MakeConfirmBox({
|
||||||
.text = tr::ayu_ConfirmationSticker(),
|
.text = tr::ayu_ConfirmationSticker(),
|
||||||
.confirmed = sendStickerCallback,
|
.confirmed = sendStickerCallback,
|
||||||
.confirmText = tr::lng_send_button()
|
.confirmText = tr::lng_send_button()
|
||||||
|
|||||||
@@ -16,7 +16,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "ui/text/text_options.h"
|
#include "ui/text/text_options.h"
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "api/api_transcribes.h"
|
||||||
|
|
||||||
|
|
||||||
TextForMimeData HistoryItemText(not_null<HistoryItem*> item) {
|
TextForMimeData HistoryItemText(not_null<HistoryItem*> item) {
|
||||||
|
const auto &summary = item->summaryEntry();
|
||||||
|
if (!summary.result.empty() && summary.shown) {
|
||||||
|
return TextForMimeData::WithExpandedLinks(summary.result);
|
||||||
|
}
|
||||||
|
|
||||||
const auto media = item->media();
|
const auto media = item->media();
|
||||||
|
|
||||||
auto mediaResult = media ? media->clipboardText() : TextForMimeData();
|
auto mediaResult = media ? media->clipboardText() : TextForMimeData();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "api/api_premium.h"
|
#include "api/api_premium.h"
|
||||||
#include "api/api_sending.h"
|
#include "api/api_sending.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
#include "base/random.h"
|
#include "base/random.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "ui/effects/premium_stars.h"
|
#include "ui/effects/premium_stars.h"
|
||||||
@@ -268,6 +269,7 @@ auto GenerateChatIntro(
|
|||||||
st::defaultTextStyle,
|
st::defaultTextStyle,
|
||||||
links));
|
links));
|
||||||
};
|
};
|
||||||
|
const auto disableGreeting = AyuSettings::getInstance().disableGreetingSticker();
|
||||||
const auto title = data.customPhrases()
|
const auto title = data.customPhrases()
|
||||||
? data.title
|
? data.title
|
||||||
: tr::lng_chat_intro_default_title(tr::now);
|
: tr::lng_chat_intro_default_title(tr::now);
|
||||||
@@ -275,37 +277,41 @@ auto GenerateChatIntro(
|
|||||||
? data.description
|
? data.description
|
||||||
: tr::lng_chat_intro_default_message(tr::now);
|
: tr::lng_chat_intro_default_message(tr::now);
|
||||||
pushText(tr::bold(title), st::chatIntroTitleMargin);
|
pushText(tr::bold(title), st::chatIntroTitleMargin);
|
||||||
pushText({ description }, title.isEmpty()
|
if (!disableGreeting || data.customPhrases()) {
|
||||||
? st::chatIntroTitleMargin
|
pushText({ description }, title.isEmpty()
|
||||||
: st::chatIntroMargin);
|
? st::chatIntroTitleMargin
|
||||||
const auto sticker = [=] {
|
: st::chatIntroMargin);
|
||||||
using Tag = ChatHelpers::StickerLottieSize;
|
}
|
||||||
auto sticker = data.sticker;
|
if (!disableGreeting || data.sticker) {
|
||||||
if (!sticker) {
|
const auto sticker = [=] {
|
||||||
const auto api = &parent->history()->session().api();
|
using Tag = ChatHelpers::StickerLottieSize;
|
||||||
const auto &list = api->premium().helloStickers();
|
auto sticker = data.sticker;
|
||||||
if (!list.empty()) {
|
if (!sticker && !disableGreeting) {
|
||||||
sticker = list[base::RandomIndex(list.size())];
|
const auto api = &parent->history()->session().api();
|
||||||
if (helloChosen) {
|
const auto &list = api->premium().helloStickers();
|
||||||
helloChosen(sticker);
|
if (!list.empty()) {
|
||||||
|
sticker = list[base::RandomIndex(list.size())];
|
||||||
|
if (helloChosen) {
|
||||||
|
helloChosen(sticker);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
const auto send = [=] {
|
||||||
const auto send = [=] {
|
sendIntroSticker(sticker);
|
||||||
sendIntroSticker(sticker);
|
};
|
||||||
|
return StickerInBubblePart::Data{
|
||||||
|
.sticker = sticker,
|
||||||
|
.size = st::chatIntroStickerSize,
|
||||||
|
.cacheTag = Tag::ChatIntroHelloSticker,
|
||||||
|
.link = std::make_shared<LambdaClickHandler>(send),
|
||||||
|
};
|
||||||
};
|
};
|
||||||
return StickerInBubblePart::Data{
|
push(std::make_unique<StickerInBubblePart>(
|
||||||
.sticker = sticker,
|
parent,
|
||||||
.size = st::chatIntroStickerSize,
|
replacing,
|
||||||
.cacheTag = Tag::ChatIntroHelloSticker,
|
sticker,
|
||||||
.link = std::make_shared<LambdaClickHandler>(send),
|
st::chatIntroStickerPadding));
|
||||||
};
|
}
|
||||||
};
|
|
||||||
push(std::make_unique<StickerInBubblePart>(
|
|
||||||
parent,
|
|
||||||
replacing,
|
|
||||||
sticker,
|
|
||||||
st::chatIntroStickerPadding));
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,7 +759,7 @@ bool AboutView::refresh() {
|
|||||||
makeIntro(user);
|
makeIntro(user);
|
||||||
} else if (const auto stars = user->starsPerMessageChecked()) {
|
} else if (const auto stars = user->starsPerMessageChecked()) {
|
||||||
setItem(makeStarsPerMessage(stars), nullptr);
|
setItem(makeStarsPerMessage(stars), nullptr);
|
||||||
} else {
|
} else if (!AyuSettings::getInstance().disableGreetingSticker()) {
|
||||||
makeIntro(user);
|
makeIntro(user);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include <QtCore/QMimeData>
|
#include <QtCore/QMimeData>
|
||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
#include "ayu/features/message_shot/message_shot.h"
|
#include "ayu/features/message_shot/message_shot.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
|
|
||||||
@@ -459,10 +460,13 @@ ChatWidget::ChatWidget(
|
|||||||
}) | rpl::on_next([=](const Api::SendAction &action) {
|
}) | rpl::on_next([=](const Api::SendAction &action) {
|
||||||
if (action.options.scheduled) {
|
if (action.options.scheduled) {
|
||||||
_composeControls->cancelReplyMessage();
|
_composeControls->cancelReplyMessage();
|
||||||
crl::on_main(this, [=, t = _topic] {
|
const auto &ghost = AyuSettings::ghost(&session());
|
||||||
controller->showSection(
|
if (!ghost.isUseScheduledMessages()) {
|
||||||
std::make_shared<HistoryView::ScheduledMemento>(t));
|
crl::on_main(this, [=, t = _topic] {
|
||||||
});
|
controller->showSection(
|
||||||
|
std::make_shared<HistoryView::ScheduledMemento>(t));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
#include "ayu/utils/telegram_helpers.h"
|
#include "ayu/utils/telegram_helpers.h"
|
||||||
#include "styles/style_ayu_styles.h"
|
#include "styles/style_ayu_styles.h"
|
||||||
|
|
||||||
@@ -998,6 +999,9 @@ EmptyPainter::EmptyPainter(not_null<History*> history)
|
|||||||
, _text(st::msgMinWidth) {
|
, _text(st::msgMinWidth) {
|
||||||
if (NeedAboutGroup(_history)) {
|
if (NeedAboutGroup(_history)) {
|
||||||
fillAboutGroup();
|
fillAboutGroup();
|
||||||
|
} else if (_history->peer->isUser()
|
||||||
|
&& AyuSettings::getInstance().disableGreetingSticker()) {
|
||||||
|
SetText(_header, tr::lng_chat_intro_default_title(tr::now));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1049,7 +1053,33 @@ void EmptyPainter::paint(
|
|||||||
not_null<const Ui::ChatStyle*> st,
|
not_null<const Ui::ChatStyle*> st,
|
||||||
int width,
|
int width,
|
||||||
int height) {
|
int height) {
|
||||||
|
if (_phrases.empty() && _text.isEmpty() && _header.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_phrases.empty() && _text.isEmpty()) {
|
if (_phrases.empty() && _text.isEmpty()) {
|
||||||
|
const auto w = st::msgServiceFont->width(_header.toString())
|
||||||
|
+ st::msgPadding.left()
|
||||||
|
+ st::msgPadding.right();
|
||||||
|
const auto h = st::msgServiceFont->height
|
||||||
|
+ st::msgServicePadding.top()
|
||||||
|
+ st::msgServicePadding.bottom();
|
||||||
|
const auto rect = QRect(
|
||||||
|
(width - w) / 2,
|
||||||
|
(height - h) / 2,
|
||||||
|
w,
|
||||||
|
h);
|
||||||
|
ServiceMessagePainter::PaintBubble(
|
||||||
|
p,
|
||||||
|
st->msgServiceBg(),
|
||||||
|
st->serviceBgCornersNormal(),
|
||||||
|
rect);
|
||||||
|
p.setPen(st->msgServiceFg());
|
||||||
|
p.setFont(st::msgServiceFont->f);
|
||||||
|
p.drawTextLeft(
|
||||||
|
rect.left() + st::msgPadding.left(),
|
||||||
|
rect.top() + st::msgServicePadding.top(),
|
||||||
|
width,
|
||||||
|
_header.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
constexpr auto kMaxTextLines = 3;
|
constexpr auto kMaxTextLines = 3;
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "styles/style_chat.h"
|
#include "styles/style_chat.h"
|
||||||
#include "styles/style_polls.h"
|
#include "styles/style_polls.h"
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ui/chat/chat_style_radius.h"
|
||||||
|
|
||||||
|
|
||||||
namespace HistoryView {
|
namespace HistoryView {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -302,7 +306,7 @@ void SimilarChannels::draw(Painter &p, const PaintContext &context) const {
|
|||||||
if (cachedp) {
|
if (cachedp) {
|
||||||
q->setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
q->setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
||||||
const auto corners = _roundedCorners.data();
|
const auto corners = _roundedCorners.data();
|
||||||
const auto side = st::bubbleRadiusLarge;
|
const auto side = Ui::BubbleRadiusLarge();
|
||||||
q->drawImage(0, 0, corners[Images::kTopLeft]);
|
q->drawImage(0, 0, corners[Images::kTopLeft]);
|
||||||
q->drawImage(width() - side, 0, corners[Images::kTopRight]);
|
q->drawImage(width() - side, 0, corners[Images::kTopRight]);
|
||||||
q->drawImage(0, height() - side, corners[Images::kBottomLeft]);
|
q->drawImage(0, height() - side, corners[Images::kBottomLeft]);
|
||||||
@@ -473,7 +477,7 @@ void SimilarChannels::ensureCacheReady(QSize size) const {
|
|||||||
QImage::Format_ARGB32_Premultiplied);
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
_roundedCache.setDevicePixelRatio(ratio);
|
_roundedCache.setDevicePixelRatio(ratio);
|
||||||
}
|
}
|
||||||
const auto radius = st::bubbleRadiusLarge;
|
const auto radius = Ui::BubbleRadiusLarge();
|
||||||
if (_roundedCorners.front().size() != QSize(radius, radius) * ratio) {
|
if (_roundedCorners.front().size() != QSize(radius, radius) * ratio) {
|
||||||
_roundedCorners = Images::CornersMask(radius);
|
_roundedCorners = Images::CornersMask(radius);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/ui/context_menu/context_menu.h"
|
#include "ayu/ui/context_menu/context_menu.h"
|
||||||
#include "ayu/ayu_settings.h"
|
#include "ayu/ayu_settings.h"
|
||||||
|
#include "ayu/utils/qt_key_modifiers_extended.h"
|
||||||
|
|
||||||
|
|
||||||
namespace HistoryView::Reactions {
|
namespace HistoryView::Reactions {
|
||||||
@@ -1415,7 +1416,9 @@ AttachSelectorResult AttachSelectorToMenu(
|
|||||||
const auto itemId = item->fullId();
|
const auto itemId = item->fullId();
|
||||||
|
|
||||||
selector->chosen() | rpl::on_next([=](ChosenReaction reaction) {
|
selector->chosen() | rpl::on_next([=](ChosenReaction reaction) {
|
||||||
menu->hideMenu();
|
if (!base::IsExtendedContextMenuModifierPressed()) {
|
||||||
|
menu->hideMenu();
|
||||||
|
}
|
||||||
reaction.context = itemId;
|
reaction.context = itemId;
|
||||||
chosen(std::move(reaction));
|
chosen(std::move(reaction));
|
||||||
}, selector->lifetime());
|
}, selector->lifetime());
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include <QtGui/QScreen>
|
#include <QtGui/QScreen>
|
||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
#include "ayu/ui/ayu_userpic.h"
|
#include "ayu/ui/ayu_userpic.h"
|
||||||
|
#include "ui/chat/chat_style_radius.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
@@ -704,13 +706,15 @@ void Preview::paintReply(Painter &p, QRect clip) {
|
|||||||
outline,
|
outline,
|
||||||
_replyRect.height());
|
_replyRect.height());
|
||||||
p.drawRoundedRect(_replyRect, radius, radius);
|
p.drawRoundedRect(_replyRect, radius, radius);
|
||||||
p.setOpacity(Ui::kDefaultBgOpacity);
|
if (!AyuSettings::getInstance().simpleQuotesAndReplies()) {
|
||||||
p.setClipRect(
|
p.setOpacity(Ui::kDefaultBgOpacity);
|
||||||
_replyRect.x() + outline,
|
p.setClipRect(
|
||||||
_replyRect.y(),
|
_replyRect.x() + outline,
|
||||||
_replyRect.width() - outline,
|
_replyRect.y(),
|
||||||
_replyRect.height());
|
_replyRect.width() - outline,
|
||||||
p.drawRoundedRect(_replyRect, radius, radius);
|
_replyRect.height());
|
||||||
|
p.drawRoundedRect(_replyRect, radius, radius);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p.setOpacity(1.);
|
p.setOpacity(1.);
|
||||||
p.setClipping(false);
|
p.setClipping(false);
|
||||||
@@ -769,7 +773,7 @@ void Preview::validateBubbleCache() {
|
|||||||
if (!_bubbleCorners.p[0].isNull()) {
|
if (!_bubbleCorners.p[0].isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto radius = scaled(16); // st::bubbleRadiusLarge
|
const auto radius = scaled(Ui::BubbleRadiusLarge());
|
||||||
_bubbleCorners = Ui::PrepareCornerPixmaps(radius, st::msgInBg);
|
_bubbleCorners = Ui::PrepareCornerPixmaps(radius, st::msgInBg);
|
||||||
_bubbleCorners.p[2] = {};
|
_bubbleCorners.p[2] = {};
|
||||||
_bubbleTail = scaled(st::historyBubbleTailInLeft, st::msgInBg->c);
|
_bubbleTail = scaled(st::historyBubbleTailInLeft, st::msgInBg->c);
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
|
|
||||||
#include <QtGui/QFontDatabase>
|
#include <QtGui/QFontDatabase>
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
|
#include "ui/chat/chat_style_radius.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -638,7 +643,7 @@ void PreviewPainter::validateBubbleCache() {
|
|||||||
if (!_bubbleCorners.p[0].isNull()) {
|
if (!_bubbleCorners.p[0].isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto radius = st::bubbleRadiusLarge;
|
const auto radius = Ui::BubbleRadiusLarge();
|
||||||
_bubbleCorners = Ui::PrepareCornerPixmaps(radius, _msgBg.color());
|
_bubbleCorners = Ui::PrepareCornerPixmaps(radius, _msgBg.color());
|
||||||
_bubbleCorners.p[2] = {};
|
_bubbleCorners.p[2] = {};
|
||||||
_bubbleShadowBottomRight
|
_bubbleShadowBottomRight
|
||||||
@@ -669,13 +674,15 @@ void PreviewPainter::paintReply(Painter &p) {
|
|||||||
outline,
|
outline,
|
||||||
_replyRect.height());
|
_replyRect.height());
|
||||||
p.drawRoundedRect(_replyRect, radius, radius);
|
p.drawRoundedRect(_replyRect, radius, radius);
|
||||||
p.setOpacity(Ui::kDefaultBgOpacity);
|
if (!AyuSettings::getInstance().simpleQuotesAndReplies()) {
|
||||||
p.setClipRect(
|
p.setOpacity(Ui::kDefaultBgOpacity);
|
||||||
_replyRect.x() + outline,
|
p.setClipRect(
|
||||||
_replyRect.y(),
|
_replyRect.x() + outline,
|
||||||
_replyRect.width() - outline,
|
_replyRect.y(),
|
||||||
_replyRect.height());
|
_replyRect.width() - outline,
|
||||||
p.drawRoundedRect(_replyRect, radius, radius);
|
_replyRect.height());
|
||||||
|
p.drawRoundedRect(_replyRect, radius, radius);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p.setOpacity(1.);
|
p.setOpacity(1.);
|
||||||
p.setClipping(false);
|
p.setClipping(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user