From 6559e83e834779ffd8666378430cf6c7a92b4665 Mon Sep 17 00:00:00 2001 From: Wei Cheng Date: Fri, 15 May 2020 13:43:46 +0800 Subject: [PATCH 01/23] fix: obtain doNotDisturb value correctly --- Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm b/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm index 6f327d121..6f0e0b765 100644 --- a/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm +++ b/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm @@ -34,7 +34,7 @@ void queryDoNotDisturbState() { auto userDefaults = [NSUserDefaults alloc]; if ([userDefaults respondsToSelector:@selector(initWithSuiteName:)]) { - id userDefaultsValue = [[[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui_test"] objectForKey:@"doNotDisturb"]; + id userDefaultsValue = [[[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui"] objectForKey:@"doNotDisturb"]; DoNotDisturbEnabled = ([userDefaultsValue boolValue] == YES); } else { DoNotDisturbEnabled = false; From 5a75dd2b6f52fb027f91d0a82d69c10f595f7bd9 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 9 May 2020 23:34:57 +0300 Subject: [PATCH 02/23] Added handling of updates for rescheduled messages. --- Telegram/SourceFiles/data/data_scheduled_messages.cpp | 1 + Telegram/SourceFiles/history/history_item.cpp | 11 +++++++++++ Telegram/SourceFiles/history/history_item.h | 3 +++ 3 files changed, 15 insertions(+) diff --git a/Telegram/SourceFiles/data/data_scheduled_messages.cpp b/Telegram/SourceFiles/data/data_scheduled_messages.cpp index 8d6831675..75b725b3e 100644 --- a/Telegram/SourceFiles/data/data_scheduled_messages.cpp +++ b/Telegram/SourceFiles/data/data_scheduled_messages.cpp @@ -414,6 +414,7 @@ HistoryItem *ScheduledMessages::append( }, data.vmedia()); existing->updateReplyMarkup(data.vreply_markup()); existing->updateForwardedInfo(data.vfwd_from()); + existing->updateDate(data.vdate().v); history->owner().requestItemTextRefresh(existing); }, [&](const auto &data) {}); return existing; diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index f515c4891..20f40fc25 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -708,6 +708,17 @@ MsgId HistoryItem::idOriginal() const { return id; } +void HistoryItem::updateDate(TimeId newDate) { + if (canUpdateDate() && _date != newDate) { + _date = newDate; + _history->owner().requestItemViewRefresh(this); + } +} + +bool HistoryItem::canUpdateDate() const { + return isScheduled(); +} + void HistoryItem::sendFailed() { Expects(_clientFlags & MTPDmessage_ClientFlag::f_sending); Expects(!(_clientFlags & MTPDmessage_ClientFlag::f_failed)); diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index 92f149492..20ec30e1e 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -328,6 +328,9 @@ public: [[nodiscard]] virtual std::unique_ptr createView( not_null delegate) = 0; + void updateDate(TimeId newDate); + [[nodiscard]] bool canUpdateDate() const; + virtual ~HistoryItem(); MsgId id; From 97446ae7830b7a9e03c130befb974f292a245df3 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 11 May 2020 03:11:32 +0300 Subject: [PATCH 03/23] Added ability to reschedule scheduled messages. --- Telegram/Resources/langs/lang.strings | 1 + Telegram/SourceFiles/apiwrap.cpp | 37 +++++++++++++++ Telegram/SourceFiles/apiwrap.h | 4 ++ .../view/history_view_context_menu.cpp | 45 +++++++++++++++++++ .../history/view/history_view_schedule_box.h | 5 ++- 5 files changed, 90 insertions(+), 2 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 4722c2f7d..397d57520 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1454,6 +1454,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_context_edit_msg" = "Edit"; "lng_context_forward_msg" = "Forward Message"; "lng_context_send_now_msg" = "Send now"; +"lng_context_reschedule" = "Reschedule"; "lng_context_delete_msg" = "Delete Message"; "lng_context_select_msg" = "Select Message"; "lng_context_report_msg" = "Report Message"; diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 24d30648d..9786062ce 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -5857,6 +5857,43 @@ void ApiWrap::closePoll(not_null item) { _pollCloseRequestIds.emplace(itemId, requestId); } +void ApiWrap::rescheduleMessage( + not_null item, + Api::SendOptions options) { + const auto text = item->originalText().text; + const auto sentEntities = Api::EntitiesToMTP( + item->originalText().entities, + Api::ConvertOption::SkipLocal); + const auto media = item->media(); + + const auto emptyFlag = MTPmessages_EditMessage::Flag(0); + const auto flags = MTPmessages_EditMessage::Flag::f_schedule_date + | (!text.isEmpty() + ? MTPmessages_EditMessage::Flag::f_message + : emptyFlag) + | ((!media || !media->webpage()) + ? MTPmessages_EditMessage::Flag::f_no_webpage + : emptyFlag) + | (!sentEntities.v.isEmpty() + ? MTPmessages_EditMessage::Flag::f_entities + : emptyFlag); + + const auto id = _session->data().scheduledMessages().lookupId(item); + request(MTPmessages_EditMessage( + MTP_flags(flags), + item->history()->peer->input, + MTP_int(id), + MTP_string(text), + MTPInputMedia(), + MTPReplyMarkup(), + sentEntities, + MTP_int(options.scheduled) + )).done([=](const MTPUpdates &result) { + applyUpdates(result); + }).fail([](const RPCError &error) { + }).send(); +} + void ApiWrap::reloadPollResults(not_null item) { const auto itemId = item->fullId(); if (!IsServerMsgId(item->id) diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index eb4015625..65a148a81 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -476,6 +476,10 @@ public: void closePoll(not_null item); void reloadPollResults(not_null item); + void rescheduleMessage( + not_null item, + Api::SendOptions options); + private: struct MessageDataRequest { using Callbacks = QList; diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index ec3da7b81..c35dd7692 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item.h" #include "history/history_message.h" #include "history/history_item_text.h" +#include "history/view/history_view_schedule_box.h" #include "history/view/media/history_view_media.h" #include "history/view/media/history_view_web_page.h" #include "ui/widgets/popup_menu.h" @@ -385,6 +386,49 @@ bool AddSendNowMessageAction( return true; } +bool AddRescheduleMessageAction( + not_null menu, + const ContextMenuRequest &request) { + const auto item = request.item; + if (!item || item->isSending() || !request.selectedItems.empty()) { + return false; + } + const auto peer = item->history()->peer; + if (const auto channel = peer->asChannel()) { + if (!channel->canEditMessages()) { + return false; + } + } + const auto owner = &item->history()->owner(); + const auto itemId = item->fullId(); + menu->addAction(tr::lng_context_reschedule(tr::now), [=] { + const auto item = owner->message(itemId); + if (!item) { + return; + } + const auto callback = [=](Api::SendOptions options) { + item->history()->session().api().rescheduleMessage(item, options); + }; + + const auto sendMenuType = !peer + ? SendMenuType::Disabled + : peer->isSelf() + ? SendMenuType::Reminder + : HistoryView::CanScheduleUntilOnline(peer) + ? SendMenuType::ScheduledToUser + : SendMenuType::Scheduled; + + Ui::show( + HistoryView::PrepareScheduleBox( + &request.navigation->session(), + sendMenuType, + callback, + item->date() + 600), + Ui::LayerOption::KeepOther); + }); + return true; +} + void AddSendNowAction( not_null menu, const ContextMenuRequest &request, @@ -531,6 +575,7 @@ void AddMessageActions( AddSendNowAction(menu, request, list); AddDeleteAction(menu, request, list); AddSelectionAction(menu, request, list); + AddRescheduleMessageAction(menu, request); } void AddCopyLinkAction( diff --git a/Telegram/SourceFiles/history/view/history_view_schedule_box.h b/Telegram/SourceFiles/history/view/history_view_schedule_box.h index 6e4e9c3c2..d51b2e2b1 100644 --- a/Telegram/SourceFiles/history/view/history_view_schedule_box.h +++ b/Telegram/SourceFiles/history/view/history_view_schedule_box.h @@ -29,12 +29,13 @@ template [[nodiscard]] object_ptr PrepareScheduleBox( Guard &&guard, SendMenuType type, - Submit &&submit) { + Submit &&submit, + TimeId scheduleTime = DefaultScheduleTime()) { return Box( ScheduleBox, type, crl::guard(std::forward(guard), std::forward(submit)), - DefaultScheduleTime()); + scheduleTime); } } // namespace HistoryView From ccbc63cd6e4b3f73c33aab358a522d666e111351 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 15 May 2020 15:47:10 +0300 Subject: [PATCH 04/23] Added ability to paste data in section of scheduled messages. Fixed #6702. Fixed #6539. --- .../SourceFiles/boxes/edit_caption_box.cpp | 5 +- .../SourceFiles/history/history_widget.cpp | 5 +- .../view/history_view_compose_controls.cpp | 4 ++ .../view/history_view_compose_controls.h | 7 +- .../view/history_view_scheduled_section.cpp | 64 +++++++++++++++++++ .../view/history_view_scheduled_section.h | 4 ++ 6 files changed, 80 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 948a1150a..811cb455d 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -551,10 +551,7 @@ void EditCaptionBox::prepare() { } else if (data->hasImage()) { return true; } else if (const auto urls = data->urls(); !urls.empty()) { - if (ranges::find_if( - urls, - [](const QUrl &url) { return !url.isLocalFile(); } - ) == urls.end()) { + if (ranges::all_of(urls, &QUrl::isLocalFile)) { return true; } } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index fb63f0672..56f369d1a 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4475,10 +4475,7 @@ bool HistoryWidget::canSendFiles(not_null data) const { } else if (data->hasImage()) { return true; } else if (const auto urls = data->urls(); !urls.empty()) { - if (ranges::find_if( - urls, - [](const QUrl &url) { return !url.isLocalFile(); } - ) == urls.end()) { + if (ranges::all_of(urls, &QUrl::isLocalFile)) { return true; } } diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp index af14fb3a8..04daa403f 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp @@ -110,6 +110,10 @@ rpl::producer<> ComposeControls::attachRequests() const { }); } +void ComposeControls::setMimeDataHook(MimeDataHook hook) { + _field->setMimeDataHook(std::move(hook)); +} + rpl::producer> ComposeControls::fileChosen() const { return _fileChosen.events(); } diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.h b/Telegram/SourceFiles/history/view/history_view_compose_controls.h index ecda04061..239b7b1f3 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.h +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.h @@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/unique_qptr.h" #include "ui/rp_widget.h" #include "ui/effects/animations.h" +#include "ui/widgets/input_fields.h" #include "chat_helpers/tabbed_selector.h" class History; @@ -31,7 +32,6 @@ namespace Ui { class SendButton; class IconButton; class EmojiButton; -class InputField; } // namespace Ui namespace Main { @@ -76,6 +76,11 @@ public: [[nodiscard]] auto inlineResultChosen() const -> rpl::producer; + using MimeDataHook = Fn data, + Ui::InputField::MimeAction action)>; + void setMimeDataHook(MimeDataHook hook); + bool pushTabbedSelectorToThirdSection( not_null peer, const Window::SectionShow ¶ms); diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 5e519f23f..42fc8056d 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -44,6 +44,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_info.h" #include "styles/style_boxes.h" +#include + namespace HistoryView { namespace { @@ -55,6 +57,17 @@ void ShowErrorToast(const QString &text) { }); } +bool CanSendFiles(not_null data) { + if (data->hasImage()) { + return true; + } else if (const auto urls = data->urls(); !urls.empty()) { + if (ranges::all_of(urls, &QUrl::isLocalFile)) { + return true; + } + } + return false; +} + } // namespace object_ptr ScheduledMemento::createWidget( @@ -165,6 +178,20 @@ void ScheduledWidget::setupComposeControls() { ChatHelpers::TabbedSelector::InlineChosen chosen) { sendInlineResult(chosen.result, chosen.bot); }, lifetime()); + + _composeControls->setMimeDataHook([=]( + not_null data, + Ui::InputField::MimeAction action) { + if (action == Ui::InputField::MimeAction::Check) { + return CanSendFiles(data); + } else if (action == Ui::InputField::MimeAction::Insert) { + return confirmSendingFiles( + data, + CompressConfirm::Auto, + data->text()); + } + Unexpected("action in MimeData hook."); + }); } void ScheduledWidget::chooseAttach() { @@ -214,6 +241,43 @@ void ScheduledWidget::chooseAttach() { }), nullptr); } +bool ScheduledWidget::confirmSendingFiles( + not_null data, + CompressConfirm compressed, + const QString &insertTextOnCancel) { + const auto hasImage = data->hasImage(); + + if (const auto urls = data->urls(); !urls.empty()) { + auto list = Storage::PrepareMediaList( + urls, + st::sendMediaPreviewSize); + if (list.error != Storage::PreparedList::Error::NonLocalUrl) { + if (list.error == Storage::PreparedList::Error::None + || !hasImage) { + const auto emptyTextOnCancel = QString(); + confirmSendingFiles( + std::move(list), + compressed, + emptyTextOnCancel); + return true; + } + } + } + + if (hasImage) { + auto image = qvariant_cast(data->imageData()); + if (!image.isNull()) { + confirmSendingFiles( + std::move(image), + QByteArray(), + compressed, + insertTextOnCancel); + return true; + } + } + return false; +} + bool ScheduledWidget::confirmSendingFiles( Storage::PreparedList &&list, CompressConfirm compressed, diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h index a7c92df1a..146059209 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h @@ -159,6 +159,10 @@ private: Storage::PreparedList &&list, CompressConfirm compressed, const QString &insertTextOnCancel = QString()); + bool confirmSendingFiles( + not_null data, + CompressConfirm compressed, + const QString &insertTextOnCancel = QString()); bool showSendingFilesError(const Storage::PreparedList &list) const; void uploadFilesAfterConfirmation( Storage::PreparedList &&list, From 41255cab44de16a0f6799d6b2e9b78a0811a423c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 17 May 2020 12:09:20 +0300 Subject: [PATCH 05/23] Removed display views and author for sent scheduled messages. Moved filling of post flags to a single place. --- Telegram/SourceFiles/api/api_sending.cpp | 47 ++++++++++++------- Telegram/SourceFiles/api/api_sending.h | 5 ++ Telegram/SourceFiles/apiwrap.cpp | 40 ++-------------- .../SourceFiles/history/history_message.cpp | 2 +- .../SourceFiles/history/history_widget.cpp | 10 +--- 5 files changed, 40 insertions(+), 64 deletions(-) diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp index dacd96d0d..1e8627445 100644 --- a/Telegram/SourceFiles/api/api_sending.cpp +++ b/Telegram/SourceFiles/api/api_sending.cpp @@ -30,6 +30,26 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Api { namespace { +void InnerFillMessagePostFlags( + const Api::SendOptions &options, + not_null peer, + MTPDmessage::Flags &flags) { + const auto channelPost = peer->isChannel() && !peer->isMegagroup(); + if (!channelPost) { + flags |= MTPDmessage::Flag::f_from_id; + return; + } + flags |= MTPDmessage::Flag::f_post; + // Don't display views and author of a new post when it's scheduled. + if (options.scheduled) { + return; + } + flags |= MTPDmessage::Flag::f_views; + if (peer->asChannel()->addsSignature()) { + flags |= MTPDmessage::Flag::f_post_author; + } +} + template void SendExistingMedia( Api::MessageToSend &&message, @@ -60,15 +80,7 @@ void SendExistingMedia( const auto channelPost = peer->isChannel() && !peer->isMegagroup(); const auto silentPost = message.action.options.silent || (channelPost && session->data().notifySilentPosts(peer)); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + InnerFillMessagePostFlags(message.action.options, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } @@ -246,15 +258,7 @@ bool SendDice(Api::MessageToSend &message) { const auto channelPost = peer->isChannel() && !peer->isMegagroup(); const auto silentPost = message.action.options.silent || (channelPost && session->data().notifySilentPosts(peer)); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + InnerFillMessagePostFlags(message.action.options, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } @@ -320,4 +324,11 @@ bool SendDice(Api::MessageToSend &message) { return true; } +void FillMessagePostFlags( + const Api::SendAction &action, + not_null peer, + MTPDmessage::Flags &flags) { + InnerFillMessagePostFlags(action.options, peer, flags); +} + } // namespace Api diff --git a/Telegram/SourceFiles/api/api_sending.h b/Telegram/SourceFiles/api/api_sending.h index 86bde8c93..0a8d9f08e 100644 --- a/Telegram/SourceFiles/api/api_sending.h +++ b/Telegram/SourceFiles/api/api_sending.h @@ -25,4 +25,9 @@ void SendExistingPhoto( bool SendDice(Api::MessageToSend &message); +void FillMessagePostFlags( + const SendAction &action, + not_null peer, + MTPDmessage::Flags &flags); + } // namespace Api diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 9786062ce..3426a1551 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -4328,15 +4328,7 @@ void ApiWrap::forwardMessages( auto flags = MTPDmessage::Flags(0); auto clientFlags = MTPDmessage_ClientFlags(); auto sendFlags = MTPmessages_ForwardMessages::Flags(0); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + FillMessagePostFlags(action, peer, flags); if (silentPost) { sendFlags |= MTPmessages_ForwardMessages::Flag::f_silent; } @@ -4489,15 +4481,7 @@ void ApiWrap::sendSharedContact( if (action.replyTo) { flags |= MTPDmessage::Flag::f_reply_to_msg_id; } - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } - } else { - flags |= MTPDmessage::Flag::f_from_id; - } + FillMessagePostFlags(action, peer, flags); if (action.options.scheduled) { flags |= MTPDmessage::Flag::f_from_scheduled; } else { @@ -4874,15 +4858,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) { const auto channelPost = peer->isChannel() && !peer->isMegagroup(); const auto silentPost = action.options.silent || (channelPost && _session->data().notifySilentPosts(peer)); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + FillMessagePostFlags(action, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendMessage::Flag::f_silent; } @@ -5019,15 +4995,7 @@ void ApiWrap::sendInlineResult( bool channelPost = peer->isChannel() && !peer->isMegagroup(); bool silentPost = action.options.silent || (channelPost && _session->data().notifySilentPosts(peer)); - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + FillMessagePostFlags(action, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_silent; } diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 524e4c5ea..6a2232b7c 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -695,7 +695,7 @@ void HistoryMessage::createComponentsHelper( if (flags & MTPDmessage::Flag::f_reply_to_msg_id) config.replyTo = replyTo; if (flags & MTPDmessage::Flag::f_reply_markup) config.mtpMarkup = &markup; if (flags & MTPDmessage::Flag::f_post_author) config.author = postAuthor; - if (isPost()) config.viewsCount = 1; + if (flags & MTPDmessage::Flag::f_views) config.viewsCount = 1; createComponents(config); } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 56f369d1a..74be742ed 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4677,15 +4677,7 @@ void HistoryWidget::sendFileConfirmed( } const auto channelPost = peer->isChannel() && !peer->isMegagroup(); const auto silentPost = file->to.options.silent; - if (channelPost) { - flags |= MTPDmessage::Flag::f_views; - flags |= MTPDmessage::Flag::f_post; - } - if (!channelPost) { - flags |= MTPDmessage::Flag::f_from_id; - } else if (peer->asChannel()->addsSignature()) { - flags |= MTPDmessage::Flag::f_post_author; - } + Api::FillMessagePostFlags(action, peer, flags); if (silentPost) { flags |= MTPDmessage::Flag::f_silent; } From bc6c01de7f61a5c69e993e78af5a0c1693159c33 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 19 May 2020 10:54:21 +0300 Subject: [PATCH 06/23] Added Esc shortcut to clear selection in section of scheduled messages. --- .../history/view/history_view_scheduled_section.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 42fc8056d..24ddbb0d4 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -898,6 +898,10 @@ void ScheduledWidget::listScrollTo(int top) { } void ScheduledWidget::listCancelRequest() { + if (_inner && !_inner->getSelectedItems().empty()) { + clearSelected(); + return; + } controller()->showBackFromStack(); } From 1c5eadcd79e893751d213755e7937e16e57d352d Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 18 May 2020 21:35:06 +0300 Subject: [PATCH 07/23] Fixed context menu for caption of scheduled album. Fixed #6523. --- .../history/view/history_view_context_menu.cpp | 16 ++++++++++++++-- .../history/view/history_view_list_widget.cpp | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index c35dd7692..397162308 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_groups.h" #include "data/data_channel.h" #include "data/data_file_origin.h" +#include "data/data_scheduled_messages.h" #include "core/file_utilities.h" #include "base/platform/base_platform_info.h" #include "window/window_peer_menu.h" @@ -62,6 +63,14 @@ constexpr auto kExportLocalTimeout = crl::time(1000); // } //} +MsgId ItemIdAcrossData(not_null item) { + if (!item->isScheduled()) { + return item->id; + } + const auto session = &item->history()->session(); + return session->data().scheduledMessages().lookupId(item); +} + void SavePhotoToFile(not_null photo) { if (photo->isNull() || !photo->loaded()) { return; @@ -480,7 +489,8 @@ bool AddDeleteMessageAction( if (asGroup) { if (const auto group = owner->groups().find(item)) { if (ranges::find_if(group->items, [](auto item) { - return !IsServerMsgId(item->id) || !item->canDelete(); + const auto id = ItemIdAcrossData(item); + return !IsServerMsgId(id) || !item->canDelete(); }) != end(group->items)) { return false; } @@ -539,7 +549,9 @@ bool AddSelectMessageAction( const auto item = request.item; if (request.overSelection && !request.selectedItems.empty()) { return false; - } else if (!item || !IsServerMsgId(item->id) || item->serviceMsg()) { + } else if (!item + || !IsServerMsgId(ItemIdAcrossData(item)) + || item->serviceMsg()) { return false; } const auto owner = &item->history()->owner(); diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 4b652fed7..8bdbc2fe1 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -937,6 +937,7 @@ void ListWidget::selectItemAsGroup(not_null item) { item, SelectAction::Select); pushSelectedItems(); + update(); } } From 9ff427afad938cd9fc6db93ae817434c3817861b Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 15 May 2020 01:10:27 +0300 Subject: [PATCH 08/23] Fixed indefinitely bouncing of dock icon. --- Telegram/SourceFiles/window/notifications_manager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 2d297637b..faa15f9b9 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -37,6 +37,12 @@ namespace { constexpr auto kMinimalAlertDelay = crl::time(500); constexpr auto kWaitingForAllGroupedDelay = crl::time(1000); +#ifdef Q_OS_MAC +constexpr auto kSystemAlertDuration = crl::time(1000); +#elif // !Q_OS_MAC +constexpr auto kSystemAlertDuration = crl::time(0); +#endif // Q_OS_MAC + } // namespace System::System(not_null session) @@ -295,7 +301,7 @@ void System::showNext() { if (Global::FlashBounceNotify() && !Platform::Notifications::SkipFlashBounce()) { if (const auto widget = App::wnd()) { if (const auto window = widget->windowHandle()) { - window->alert(0); + window->alert(kSystemAlertDuration); // (window, SLOT(_q_clearAlert())); in the future. } } From 1ef5d812709198b2f37dd30e6010b427bea1e70f Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 18 May 2020 23:04:28 +0300 Subject: [PATCH 09/23] Added ability to change months in calendar with mouse wheel. --- Telegram/SourceFiles/boxes/calendar_box.cpp | 15 +++++++++++++++ Telegram/SourceFiles/boxes/calendar_box.h | 1 + 2 files changed, 16 insertions(+) diff --git a/Telegram/SourceFiles/boxes/calendar_box.cpp b/Telegram/SourceFiles/boxes/calendar_box.cpp index 48cfdd794..a9d5158f7 100644 --- a/Telegram/SourceFiles/boxes/calendar_box.cpp +++ b/Telegram/SourceFiles/boxes/calendar_box.cpp @@ -599,4 +599,19 @@ void CalendarBox::keyPressEvent(QKeyEvent *e) { } } +void CalendarBox::wheelEvent(QWheelEvent *e) { + // Only a mouse wheel is accepted. + constexpr auto step = static_cast(QWheelEvent::DefaultDeltasPerStep); + const auto delta = e->angleDelta().y(); + if (std::abs(delta) != step) { + return; + } + + if (delta < 0) { + goPreviousMonth(); + } else { + goNextMonth(); + } +} + CalendarBox::~CalendarBox() = default; diff --git a/Telegram/SourceFiles/boxes/calendar_box.h b/Telegram/SourceFiles/boxes/calendar_box.h index 066d0425f..391f25bed 100644 --- a/Telegram/SourceFiles/boxes/calendar_box.h +++ b/Telegram/SourceFiles/boxes/calendar_box.h @@ -46,6 +46,7 @@ protected: void keyPressEvent(QKeyEvent *e) override; void resizeEvent(QResizeEvent *e) override; + void wheelEvent(QWheelEvent *e) override; private: void monthChanged(QDate month); From 97305c8cb534bf26432a05775ba50d5ec5f7a3b6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 20 May 2020 12:49:41 +0400 Subject: [PATCH 10/23] Fix build. --- Telegram/SourceFiles/window/notifications_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index faa15f9b9..8ef2f0cae 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -39,7 +39,7 @@ constexpr auto kWaitingForAllGroupedDelay = crl::time(1000); #ifdef Q_OS_MAC constexpr auto kSystemAlertDuration = crl::time(1000); -#elif // !Q_OS_MAC +#else // !Q_OS_MAC constexpr auto kSystemAlertDuration = crl::time(0); #endif // Q_OS_MAC From 8d1db85a2801c49e4b64e7daa1bb24d1533df9d9 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 20 May 2020 11:54:24 +0300 Subject: [PATCH 11/23] Fixed album items selection in section of scheduled messages. This bug relates only to albums with captions. --- Telegram/SourceFiles/history/view/history_view_message.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 6f83064b1..ab905aa4b 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1763,6 +1763,9 @@ void Message::fromNameUpdated(int width) const { } TextSelection Message::skipTextSelection(TextSelection selection) const { + if (selection.from == 0xFFFF) { + return selection; + } return HistoryView::UnshiftItemSelection(selection, message()->_text); } From ced2652debd8b896c3ed1da1b895293bf0e54c97 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 14 May 2020 08:39:45 +0400 Subject: [PATCH 12/23] OpenAL returns device names with UTF-8 --- Telegram/SourceFiles/media/audio/media_audio.cpp | 8 ++++---- Telegram/SourceFiles/media/audio/media_audio_capture.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/media/audio/media_audio.cpp b/Telegram/SourceFiles/media/audio/media_audio.cpp index 9356bfc78..74564a27b 100644 --- a/Telegram/SourceFiles/media/audio/media_audio.cpp +++ b/Telegram/SourceFiles/media/audio/media_audio.cpp @@ -86,14 +86,14 @@ void EnumeratePlaybackDevices() { Assert(devices != nullptr); while (*devices != 0) { auto deviceName8Bit = QByteArray(devices); - auto deviceName = QString::fromLocal8Bit(deviceName8Bit); + auto deviceName = QString::fromUtf8(deviceName8Bit); deviceNames.append(deviceName); devices += deviceName8Bit.size() + 1; } LOG(("Audio Playback Devices: %1").arg(deviceNames.join(';'))); if (auto device = alcGetString(nullptr, ALC_DEFAULT_ALL_DEVICES_SPECIFIER)) { - LOG(("Audio Playback Default Device: %1").arg(QString::fromLocal8Bit(device))); + LOG(("Audio Playback Default Device: %1").arg(QString::fromUtf8(device))); } else { LOG(("Audio Playback Default Device: (null)")); } @@ -105,14 +105,14 @@ void EnumerateCaptureDevices() { Assert(devices != nullptr); while (*devices != 0) { auto deviceName8Bit = QByteArray(devices); - auto deviceName = QString::fromLocal8Bit(deviceName8Bit); + auto deviceName = QString::fromUtf8(deviceName8Bit); deviceNames.append(deviceName); devices += deviceName8Bit.size() + 1; } LOG(("Audio Capture Devices: %1").arg(deviceNames.join(';'))); if (auto device = alcGetString(nullptr, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) { - LOG(("Audio Capture Default Device: %1").arg(QString::fromLocal8Bit(device))); + LOG(("Audio Capture Default Device: %1").arg(QString::fromUtf8(device))); } else { LOG(("Audio Capture Default Device: (null)")); } diff --git a/Telegram/SourceFiles/media/audio/media_audio_capture.cpp b/Telegram/SourceFiles/media/audio/media_audio_capture.cpp index 3bc9a3845..53ded4255 100644 --- a/Telegram/SourceFiles/media/audio/media_audio_capture.cpp +++ b/Telegram/SourceFiles/media/audio/media_audio_capture.cpp @@ -63,7 +63,7 @@ Instance::Instance() : _inner(new Inner(&_thread)) { void Instance::check() { _available = false; if (auto device = alcGetString(0, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) { - if (!QString::fromLocal8Bit(device).isEmpty()) { + if (!QString::fromUtf8(device).isEmpty()) { _available = true; return; } From 4c1f83dacab08f2220406c79db8f31c354887984 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 14 May 2020 21:03:36 +0400 Subject: [PATCH 13/23] Add a check for bundled Qt plugins --- .../SourceFiles/platform/linux/specific_linux.cpp | 14 ++++++++++++-- .../SourceFiles/platform/linux/specific_linux.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 8fa0a35fa..718489156 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -271,6 +271,14 @@ bool IsGtkFileDialogForced() { #endif // !TDESKTOP_FORCE_GTK_FILE_DIALOG } +bool IsQtPluginsBundled() { +#ifdef DESKTOP_APP_USE_PACKAGED_LAZY + return true; +#else // DESKTOP_APP_USE_PACKAGED_LAZY + return false; +#endif // !DESKTOP_APP_USE_PACKAGED_LAZY +} + bool IsXDGDesktopPortalPresent() { #ifdef TDESKTOP_DISABLE_DBUS_INTEGRATION static const auto XDGDesktopPortalPresent = false; @@ -633,14 +641,16 @@ void start() { if(IsStaticBinary() || InAppImage() || InSandbox() - || InSnap()) { + || InSnap() + || IsQtPluginsBundled()) { qputenv("QT_WAYLAND_DECORATION", "material"); } if(IsStaticBinary() || InAppImage() || InSnap() - || IsGtkFileDialogForced()) { + || IsGtkFileDialogForced() + || IsQtPluginsBundled()) { LOG(("Checking for XDG Desktop Portal...")); // this can give us a chance to use a proper file dialog for current session if (IsXDGDesktopPortalPresent()) { diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.h b/Telegram/SourceFiles/platform/linux/specific_linux.h index f3a79555e..a0cff2971 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.h +++ b/Telegram/SourceFiles/platform/linux/specific_linux.h @@ -25,6 +25,7 @@ bool InSnap(); bool InAppImage(); bool IsStaticBinary(); bool IsGtkFileDialogForced(); +bool IsQtPluginsBundled(); bool IsXDGDesktopPortalPresent(); bool UseXDGDesktopPortal(); From e0669e222d29484b5e55064f7a4a48c9f4eb99e9 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 14 May 2020 20:12:29 +0400 Subject: [PATCH 14/23] Update fcitx5-qt --- Telegram/CMakeLists.txt | 1 + Telegram/SourceFiles/qt_static_plugins.cpp | 1 + Telegram/ThirdParty/fcitx5-qt | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index bc4b446f9..6f9faf41a 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -90,6 +90,7 @@ if (LINUX) PRIVATE desktop-app::external_statusnotifieritem desktop-app::external_dbusmenu_qt + desktop-app::external_fcitx_qt5 desktop-app::external_fcitx5_qt5 desktop-app::external_hime_qt ) diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp index f3522641b..4174957d3 100644 --- a/Telegram/SourceFiles/qt_static_plugins.cpp +++ b/Telegram/SourceFiles/qt_static_plugins.cpp @@ -53,6 +53,7 @@ Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin) Q_IMPORT_PLUGIN(NimfInputContextPlugin) #ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) +Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) #endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY diff --git a/Telegram/ThirdParty/fcitx5-qt b/Telegram/ThirdParty/fcitx5-qt index 7561f994a..b7bdd8aec 160000 --- a/Telegram/ThirdParty/fcitx5-qt +++ b/Telegram/ThirdParty/fcitx5-qt @@ -1 +1 @@ -Subproject commit 7561f994a79320a4940a1f95c884004c4dd178f4 +Subproject commit b7bdd8aec2dcb44dc792fedec89d67be0c527ca1 From 735164103465a498a4ff8d6aaf426786ecba3898 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 24 May 2020 11:59:19 +0400 Subject: [PATCH 15/23] Version 2.1.7. - Fix the Fcitx input method plugin. --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/build/version | 8 ++++---- Telegram/lib_ui | 2 +- changelog.txt | 4 ++++ cmake | 2 +- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 5a33266bd..17ae248a0 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="2.1.7.0" /> Telegram Desktop Telegram FZ-LLC diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index c3e1d417f..9831bdbb6 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,6,0 - PRODUCTVERSION 2,1,6,0 + FILEVERSION 2,1,7,0 + PRODUCTVERSION 2,1,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "2.1.6.0" + VALUE "FileVersion", "2.1.7.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.6.0" + VALUE "ProductVersion", "2.1.7.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 0a9fdd05d..f23946b71 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,6,0 - PRODUCTVERSION 2,1,6,0 + FILEVERSION 2,1,7,0 + PRODUCTVERSION 2,1,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "2.1.6.0" + VALUE "FileVersion", "2.1.7.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.6.0" + VALUE "ProductVersion", "2.1.7.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 84afb131f..f76aff1d2 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs; constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs; constexpr auto AppName = "Telegram Desktop"_cs; constexpr auto AppFile = "Telegram"_cs; -constexpr auto AppVersion = 2001006; -constexpr auto AppVersionStr = "2.1.6"; +constexpr auto AppVersion = 2001007; +constexpr auto AppVersionStr = "2.1.7"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index d3e7a2eaf..e2838af08 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 2001006 +AppVersion 2001007 AppVersionStrMajor 2.1 -AppVersionStrSmall 2.1.6 -AppVersionStr 2.1.6 +AppVersionStrSmall 2.1.7 +AppVersionStr 2.1.7 BetaChannel 0 AlphaVersion 0 -AppVersionOriginal 2.1.6 +AppVersionOriginal 2.1.7 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 8e2cfbf30..db2a1279d 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 8e2cfbf303a43bbd946279dd2cb394be82a782a0 +Subproject commit db2a1279d69b37a509e9b7855530abf2a5a2c6f9 diff --git a/changelog.txt b/changelog.txt index 6036949fe..6fd363d75 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +2.1.7 (24.05.20) + +- Fix the Fcitx input method plugin. + 2.1.6 (14.05.20) - Bug fixes and other minor improvements. diff --git a/cmake b/cmake index 4ea254886..f4271f2cd 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 4ea254886efd273cd4b01eb5128fe67d47959e4e +Subproject commit f4271f2cd44b66b042a076ef1e2fa0d442c33afe From cd81fc67277cbef8f35371605fec98713bd8ba05 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 20 May 2020 04:10:21 +0400 Subject: [PATCH 16/23] Don't lose -freetype argument on restart --- Telegram/SourceFiles/_other/updater_osx.m | 5 ++++- Telegram/SourceFiles/_other/updater_win.cpp | 5 ++++- Telegram/SourceFiles/platform/mac/launcher_mac.mm | 1 + Telegram/SourceFiles/platform/win/launcher_win.cpp | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/_other/updater_osx.m b/Telegram/SourceFiles/_other/updater_osx.m index cf471db1e..24bbe3092 100644 --- a/Telegram/SourceFiles/_other/updater_osx.m +++ b/Telegram/SourceFiles/_other/updater_osx.m @@ -90,7 +90,7 @@ int main(int argc, const char * argv[]) { openLog(); pid_t procId = 0; - BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, externalUpdater = NO; + BOOL update = YES, toSettings = NO, autoStart = NO, startInTray = NO, testMode = NO, freeType = NO, externalUpdater = NO; BOOL customWorkingDir = NO; NSString *key = nil; for (int i = 0; i < argc; ++i) { @@ -116,6 +116,8 @@ int main(int argc, const char * argv[]) { startInTray = YES; } else if ([@"-testmode" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { testMode = YES; + } else if ([@"-freetype" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { + freeType = YES; } else if ([@"-externalupdater" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { externalUpdater = YES; } else if ([@"-workdir_custom" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) { @@ -255,6 +257,7 @@ int main(int argc, const char * argv[]) { if (_debug) [args addObject:@"-debug"]; if (startInTray) [args addObject:@"-startintray"]; if (testMode) [args addObject:@"-testmode"]; + if (freeType) [args addObject:@"-freetype"]; if (externalUpdater) [args addObject:@"-externalupdater"]; if (autoStart) [args addObject:@"-autostart"]; if (key) { diff --git a/Telegram/SourceFiles/_other/updater_win.cpp b/Telegram/SourceFiles/_other/updater_win.cpp index 50779423a..41d23ead6 100644 --- a/Telegram/SourceFiles/_other/updater_win.cpp +++ b/Telegram/SourceFiles/_other/updater_win.cpp @@ -339,7 +339,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara LPWSTR *args; int argsCount; - bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, externalupdater = false; + bool needupdate = false, autostart = false, debug = false, writeprotected = false, startintray = false, testmode = false, freetype = false, externalupdater = false; args = CommandLineToArgvW(GetCommandLine(), &argsCount); if (args) { for (int i = 1; i < argsCount; ++i) { @@ -355,6 +355,8 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara startintray = true; } else if (equal(args[i], L"-testmode")) { testmode = true; + } else if (equal(args[i], L"-freetype")) { + freetype = true; } else if (equal(args[i], L"-externalupdater")) { externalupdater = true; } else if (equal(args[i], L"-writeprotected") && ++i < argsCount) { @@ -427,6 +429,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR cmdPara if (debug) targs += L" -debug"; if (startintray) targs += L" -startintray"; if (testmode) targs += L" -testmode"; + if (freetype) targs += L" -freetype"; if (externalupdater) targs += L" -externalupdater"; if (!customWorkingDir.empty()) { targs += L" -workdir \"" + customWorkingDir + L"\""; diff --git a/Telegram/SourceFiles/platform/mac/launcher_mac.mm b/Telegram/SourceFiles/platform/mac/launcher_mac.mm index 28da1bf59..080f7471b 100644 --- a/Telegram/SourceFiles/platform/mac/launcher_mac.mm +++ b/Telegram/SourceFiles/platform/mac/launcher_mac.mm @@ -64,6 +64,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) { if (Logs::DebugEnabled()) [args addObject:@"-debug"]; if (cStartInTray()) [args addObject:@"-startintray"]; if (cTestMode()) [args addObject:@"-testmode"]; + if (cUseFreeType()) [args addObject:@"-freetype"]; #ifndef TDESKTOP_DISABLE_AUTOUPDATE if (Core::UpdaterDisabled()) [args addObject:@"-externalupdater"]; #endif // !TDESKTOP_DISABLE_AUTOUPDATE diff --git a/Telegram/SourceFiles/platform/win/launcher_win.cpp b/Telegram/SourceFiles/platform/win/launcher_win.cpp index 176dd041a..b2584cd0c 100644 --- a/Telegram/SourceFiles/platform/win/launcher_win.cpp +++ b/Telegram/SourceFiles/platform/win/launcher_win.cpp @@ -71,6 +71,9 @@ bool Launcher::launchUpdater(UpdaterLaunch action) { if (cTestMode()) { pushArgument(qsl("-testmode")); } + if (cUseFreeType()) { + pushArgument(qsl("-freetype")); + } #ifndef TDESKTOP_DISABLE_AUTOUPDATE if (Core::UpdaterDisabled()) { pushArgument(qsl("-externalupdater")); From bdf28370f971aad15742c2f813dfb407e0e825b4 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 14 May 2020 20:27:51 +0400 Subject: [PATCH 17/23] Fix call window size on Sway --- Telegram/SourceFiles/calls/calls_panel.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 3156242a2..59e7bc53b 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -299,7 +299,8 @@ QImage Panel::Button::prepareRippleMask() const { } Panel::Panel(not_null call) -: _call(call) +:RpWidget(App::wnd()) +, _call(call) , _user(call->user()) , _answerHangupRedial(this, st::callAnswer, &st::callHangup) , _decline(this, object_ptr