From 65b5a2928876c34bb395e0567715793c602741f8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Oct 2019 11:09:45 +0300 Subject: [PATCH 01/18] Fix local url handling. Regression was introduced in 849deb57e2. Fixes #6622. --- Telegram/SourceFiles/core/core_ui_integration.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/core/core_ui_integration.cpp b/Telegram/SourceFiles/core/core_ui_integration.cpp index a05808707..a8011bd4a 100644 --- a/Telegram/SourceFiles/core/core_ui_integration.cpp +++ b/Telegram/SourceFiles/core/core_ui_integration.cpp @@ -47,7 +47,7 @@ void UiIntegration::textActionsUpdated() { window->updateGlobalMenu(); } } - + void UiIntegration::activationFromTopPanel() { Platform::IgnoreApplicationActivationRightNow(); } @@ -115,7 +115,7 @@ std::shared_ptr UiIntegration::createLinkHandler( bool UiIntegration::handleUrlClick( const QString &url, const QVariant &context) { - auto local = Core::TryConvertUrlToLocal(url); + const auto local = Core::TryConvertUrlToLocal(url); if (Core::InternalPassportLink(local)) { return true; } @@ -123,8 +123,8 @@ bool UiIntegration::handleUrlClick( if (UrlClickHandler::IsEmail(url)) { File::OpenEmailLink(url); return true; - } else if (url.startsWith(qstr("tg://"), Qt::CaseInsensitive)) { - Core::App().openLocalUrl(url, context); + } else if (local.startsWith(qstr("tg://"), Qt::CaseInsensitive)) { + Core::App().openLocalUrl(local, context); return true; } return false; From 489bd22828257ad44af39e1ac79da80f763ff331 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Oct 2019 11:18:23 +0300 Subject: [PATCH 02/18] Version 1.8.12. - Bug fixes and other minor improvements. --- 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 | 6 +++--- changelog.txt | 4 ++++ 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 9b0c0ae89..c8751a93b 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="1.8.12.0" /> Telegram Desktop Telegram FZ-LLC diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 588cd595e..bebd6b9dc 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -33,8 +33,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,8,11,0 - PRODUCTVERSION 1,8,11,0 + FILEVERSION 1,8,12,0 + PRODUCTVERSION 1,8,12,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "1.8.11.0" + VALUE "FileVersion", "1.8.12.0" VALUE "LegalCopyright", "Copyright (C) 2014-2019" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.8.11.0" + VALUE "ProductVersion", "1.8.12.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 124149faf..cdc81116a 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -24,8 +24,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,8,11,0 - PRODUCTVERSION 1,8,11,0 + FILEVERSION 1,8,12,0 + PRODUCTVERSION 1,8,12,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -42,10 +42,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "1.8.11.0" + VALUE "FileVersion", "1.8.12.0" VALUE "LegalCopyright", "Copyright (C) 2014-2019" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.8.11.0" + VALUE "ProductVersion", "1.8.12.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 3465541ca..8580d1d5e 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #define TDESKTOP_ALPHA_VERSION (0ULL) #endif // TDESKTOP_OFFICIAL_TARGET -constexpr auto AppVersion = 1008011; -constexpr auto AppVersionStr = "1.8.11"; +constexpr auto AppVersion = 1008012; +constexpr auto AppVersionStr = "1.8.12"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index 79c72f46d..2d9a30cb5 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 1008011 +AppVersion 1008012 AppVersionStrMajor 1.8 -AppVersionStrSmall 1.8.11 -AppVersionStr 1.8.11 +AppVersionStrSmall 1.8.12 +AppVersionStr 1.8.12 BetaChannel 0 AlphaVersion 0 diff --git a/changelog.txt b/changelog.txt index 650a00b43..6a79a1504 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +1.8.12 (02.10.19) + +- Bug fixes and other minor improvements. + 1.8.11 (01.10.19) - Bug fixes and other minor improvements. From 718f862be0acd137763c6b6f5a7dd6a368a38458 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Oct 2019 11:21:02 +0300 Subject: [PATCH 03/18] Version 1.8.12: Fix build for Mac App Store. --- Telegram/SourceFiles/platform/mac/specific_mac_p.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/SourceFiles/platform/mac/specific_mac_p.mm b/Telegram/SourceFiles/platform/mac/specific_mac_p.mm index cbf4f5529..76f3a2792 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac_p.mm +++ b/Telegram/SourceFiles/platform/mac/specific_mac_p.mm @@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "platform/platform_info.h" #include "lang/lang_keys.h" #include "base/timer.h" +#include "facades.h" #include "styles/style_window.h" #include From 664162982c586f0347e0938ec63c2d6f5a063c6a Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Oct 2019 11:21:56 +0300 Subject: [PATCH 04/18] Version 1.8.12: Fix build for old OS X. --- Telegram/gyp/lib_ui.gyp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Telegram/gyp/lib_ui.gyp b/Telegram/gyp/lib_ui.gyp index 81810062e..fa6bd4ea3 100644 --- a/Telegram/gyp/lib_ui.gyp +++ b/Telegram/gyp/lib_ui.gyp @@ -45,6 +45,14 @@ }, 'defines': [ ], + 'conditions': [[ 'build_macold', { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ], + }, + 'include_dirs': [ + '/usr/local/macold/include/c++/v1', + ], + }]], 'include_dirs': [ '<(src_loc)', '<(SHARED_INTERMEDIATE_DIR)', From 9bf8b619fe85cc683ccded1335be9e4d11795569 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 11 Sep 2019 16:34:38 +0300 Subject: [PATCH 05/18] Refactored ability to display media preview from touchbar. --- .../SourceFiles/platform/mac/mac_touchbar.mm | 136 ++++++++++-------- 1 file changed, 74 insertions(+), 62 deletions(-) diff --git a/Telegram/SourceFiles/platform/mac/mac_touchbar.mm b/Telegram/SourceFiles/platform/mac/mac_touchbar.mm index 23c818846..8467d04a0 100644 --- a/Telegram/SourceFiles/platform/mac/mac_touchbar.mm +++ b/Telegram/SourceFiles/platform/mac/mac_touchbar.mm @@ -74,6 +74,17 @@ constexpr auto kArchiveId = -1; constexpr auto kMaxStickerSets = 5; +constexpr auto kGestureStateProcessed = { + NSGestureRecognizerStateChanged, + NSGestureRecognizerStateBegan, +}; + +constexpr auto kGestureStateFinished = { + NSGestureRecognizerStateEnded, + NSGestureRecognizerStateCancelled, + NSGestureRecognizerStateFailed, +}; + NSString *const kTypePinned = @"pinned"; NSString *const kTypeSlider = @"slider"; NSString *const kTypeButton = @"button"; @@ -641,9 +652,11 @@ void AppendEmojiPacks(std::vector &to) { @end // @interface PickerScrubberItemView @implementation PickerScrubberItemView { rpl::lifetime _lifetime; - Data::FileOrigin _origin; QSize _dimensions; Image *_image; + @public + Data::FileOrigin fileOrigin; + DocumentData *documentData; } - (instancetype)initWithFrame:(NSRect)frameRect { @@ -667,9 +680,10 @@ void AppendEmojiPacks(std::vector &to) { if (!_image) { return; } + fileOrigin = document->stickerSetOrigin(); + documentData = std::move(document); _dimensions = document->dimensions; - _origin = document->stickerSetOrigin(); - _image->load(_origin); + _image->load(fileOrigin); if (_image->loaded()) { [self updateImage]; return; @@ -689,7 +703,7 @@ void AppendEmojiPacks(std::vector &to) { .scaled(kCircleDiameter, kCircleDiameter, Qt::KeepAspectRatio); _imageView.image = [qt_mac_create_nsimage( _image->pixSingle( - _origin, + fileOrigin, size.width(), size.height(), kCircleDiameter, @@ -711,9 +725,7 @@ void AppendEmojiPacks(std::vector &to) { @implementation PickerCustomTouchBarItem { std::vector _stickers; NSPopoverTouchBarItem *_parentPopover; - std::unique_ptr _previewTimer; - int _highlightedIndex; - bool _previewShown; + DocumentId _lastPreviewedSticker; } - (id) init:(ScrubberItemType)type popover:(NSPopoverTouchBarItem *)popover { @@ -739,18 +751,65 @@ void AppendEmojiPacks(std::vector &to) { [scrubber registerClass:[NSScrubberTextItemView class] forItemIdentifier:kPickerTitleItemIdentifier]; [scrubber registerClass:[NSScrubberImageItemView class] forItemIdentifier:kEmojiItemIdentifier]; - _previewShown = false; - _highlightedIndex = 0; - _previewTimer = !IsSticker(type) - ? nullptr - : std::make_unique([=] { - [self showPreview]; - }); + if (IsSticker(type)) { + auto *gesture = [[NSPressGestureRecognizer alloc] + initWithTarget:self + action:@selector(gesturePreviewHandler:)]; + gesture.allowedTouchTypes = NSTouchTypeMaskDirect; + gesture.minimumPressDuration = QApplication::startDragTime() / 1000.; + gesture.allowableMovement = 0; + [scrubber addGestureRecognizer:gesture]; + } + _lastPreviewedSticker = 0; self.view = scrubber; return self; } +- (void)gesturePreviewHandler:(NSPressGestureRecognizer *)gesture { + const auto customEnter = [](const auto callback) { + Core::Sandbox::Instance().customEnterFromEventLoop([=] { + if (App::wnd()) { + callback(); + } + }); + }; + + const auto checkState = [&](const auto &states) { + return ranges::find(states, gesture.state) != end(states); + }; + + if (checkState(kGestureStateProcessed)) { + NSScrollView *scrollView = self.view; + auto *container = scrollView.documentView.subviews.firstObject; + if (!container) { + return; + } + const auto point = [gesture locationInView:(std::move(container))]; + + for (PickerScrubberItemView *item in container.subviews) { + const auto &doc = item->documentData; + const auto &origin = item->fileOrigin + ? item->fileOrigin + : Data::FileOrigin(); + if (![item isMemberOfClass:[PickerScrubberItemView class]] + || !doc + || (doc->id == _lastPreviewedSticker) + || !NSPointInRect(point, item.frame)) { + continue; + } + _lastPreviewedSticker = doc->id; + customEnter([origin = std::move(origin), doc = std::move(doc)] { + App::wnd()->showMediaPreview(origin, doc); + }); + break; + } + } else if (checkState(kGestureStateFinished)) { + customEnter([] { App::wnd()->hideMediaPreview(); }); + _lastPreviewedSticker = 0; + } +} + - (void)encodeWithCoder:(nonnull NSCoder *)aCoder { // Has not been implemented. } @@ -765,7 +824,7 @@ void AppendEmojiPacks(std::vector &to) { const auto item = _stickers[index]; if (const auto document = item.document) { PickerScrubberItemView *itemView = [scrubber makeItemWithIdentifier:kStickerItemIdentifier owner:nil]; - [itemView addDocument:document]; + [itemView addDocument:(std::move(document))]; return itemView; } else if (const auto emoji = item.emoji) { NSScrubberImageItemView *itemView = [scrubber makeItemWithIdentifier:kEmojiItemIdentifier owner:nil]; @@ -791,12 +850,6 @@ void AppendEmojiPacks(std::vector &to) { return; } scrubber.selectedIndex = -1; - if (_previewShown && [self hidePreview]) { - return; - } - if (_previewTimer) { - _previewTimer->cancel(); - } const auto chat = GetActiveChat(); const auto callback = [&]() -> bool { @@ -828,47 +881,6 @@ void AppendEmojiPacks(std::vector &to) { } } -- (void)scrubber:(NSScrubber *)scrubber didHighlightItemAtIndex:(NSInteger)index { - if (_previewTimer) { - _previewTimer->callOnce(QApplication::startDragTime()); - _highlightedIndex = index; - } -} - -- (void)scrubber:(NSScrubber *)scrubber didChangeVisibleRange:(NSRange)visibleRange { - [self didCancelInteractingWithScrubber:scrubber]; -} - -- (void)didCancelInteractingWithScrubber:(NSScrubber *)scrubber { - if (_previewTimer) { - _previewTimer->cancel(); - } - if (_previewShown) { - [self hidePreview]; - } -} - -- (void)showPreview { - if (const auto document = _stickers[_highlightedIndex].document) { - if (const auto w = App::wnd()) { - w->showMediaPreview(document->stickerSetOrigin(), document); - _previewShown = true; - } - } -} - -- (bool)hidePreview { - if (const auto w = App::wnd()) { - Core::Sandbox::Instance().customEnterFromEventLoop([=] { - w->hideMediaPreview(); - }); - _previewShown = false; - _highlightedIndex = 0; - return true; - } - return false; -} - - (void)updateStickers { std::vector temp; if (const auto error = RestrictionToSendStickers()) { From 2cb7d764174cd028a887a0981de24fe6fc999d49 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Oct 2019 11:14:38 +0300 Subject: [PATCH 06/18] Optimize unixtime refresh. --- .../SourceFiles/mtproto/config_loader.cpp | 6 ++- .../mtproto/special_config_request.cpp | 40 ++++++++++++------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/Telegram/SourceFiles/mtproto/config_loader.cpp b/Telegram/SourceFiles/mtproto/config_loader.cpp index 76536dd56..7abc822cc 100644 --- a/Telegram/SourceFiles/mtproto/config_loader.cpp +++ b/Telegram/SourceFiles/mtproto/config_loader.cpp @@ -129,7 +129,11 @@ void ConfigLoader::createSpecialLoader() { const std::string &ip, int port, bytes::const_span secret) { - addSpecialEndpoint(dcId, ip, port, secret); + if (ip.empty()) { + _specialLoader = nullptr; + } else { + addSpecialEndpoint(dcId, ip, port, secret); + } }, _phone); } diff --git a/Telegram/SourceFiles/mtproto/special_config_request.cpp b/Telegram/SourceFiles/mtproto/special_config_request.cpp index 39f9304fa..264fa8fa7 100644 --- a/Telegram/SourceFiles/mtproto/special_config_request.cpp +++ b/Telegram/SourceFiles/mtproto/special_config_request.cpp @@ -374,19 +374,22 @@ SpecialConfigRequest::SpecialConfigRequest( while (!domains.empty()) { _attempts.push_back({ Type::Google, takeDomain(), "dns" }); } - _attempts.push_back({ Type::Realtime, "firebaseio.com" }); - _attempts.push_back({ Type::FireStore, "firestore" }); - for (const auto &domain : DnsDomains()) { - _attempts.push_back({ Type::FireStore, domain, "firestore" }); + if (!_timeDoneCallback) { + _attempts.push_back({ Type::Realtime, "firebaseio.com" }); + _attempts.push_back({ Type::FireStore, "firestore" }); + for (const auto &domain : DnsDomains()) { + _attempts.push_back({ Type::FireStore, domain, "firestore" }); + } } shuffle(0, 2); shuffle(2, 4); - shuffle( - _attempts.size() - (2 + domainsCount), - _attempts.size() - domainsCount); - shuffle(_attempts.size() - domainsCount, _attempts.size()); - + if (!_timeDoneCallback) { + shuffle( + _attempts.size() - (2 + domainsCount), + _attempts.size() - domainsCount); + shuffle(_attempts.size() - domainsCount, _attempts.size()); + } ranges::reverse(_attempts); // We go from last to first. sendNextRequest(); @@ -666,20 +669,27 @@ void SpecialConfigRequest::handleResponse(const QByteArray &bytes) { switch (address.type()) { case mtpc_ipPort: { const auto &fields = address.c_ipPort(); - _callback(dcId, parseIp(fields.vipv4()), fields.vport().v, {}); + const auto ip = parseIp(fields.vipv4()); + if (!ip.empty()) { + _callback(dcId, ip, fields.vport().v, {}); + } } break; case mtpc_ipPortSecret: { const auto &fields = address.c_ipPortSecret(); - _callback( - dcId, - parseIp(fields.vipv4()), - fields.vport().v, - bytes::make_span(fields.vsecret().v)); + const auto ip = parseIp(fields.vipv4()); + if (!ip.empty()) { + _callback( + dcId, + ip, + fields.vport().v, + bytes::make_span(fields.vsecret().v)); + } } break; default: Unexpected("Type in simpleConfig ips."); } } } + _callback(0, std::string(), 0, {}); } DomainResolver::DomainResolver(Fn Date: Tue, 1 Oct 2019 18:47:53 +0300 Subject: [PATCH 07/18] Do not show edit timer for supergroup admins --- Telegram/SourceFiles/history/history_widget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index b02b41f62..d7de50fde 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -6685,6 +6685,12 @@ void HistoryWidget::paintEditHeader(Painter &p, const QRect &rect, int left, int if (!_replyEditMsg || _replyEditMsg->history()->peer->isSelf()) return; + if (const auto megagroup = _replyEditMsg->history()->peer->asMegagroup()) { + if (megagroup->amCreator() || megagroup->hasAdminRights()) { + return; + } + } + QString editTimeLeftText; int updateIn = -1; auto timeSinceMessage = ItemDateTime(_replyEditMsg).msecsTo(QDateTime::currentDateTime()); From 9d850b71e75b5a552534e1a971e1217ee38f3320 Mon Sep 17 00:00:00 2001 From: Jiachen YANG Date: Sun, 8 Sep 2019 00:13:40 +0900 Subject: [PATCH 08/18] be compatible with range-v3 0.9.x/1.0 branch This made 2 changes to the current code base to be compatible with higher versions of range-v3 library. 1. ranges::iterator_range was renamed to subrange, see https://github.com/ericniebler/range-v3/issues/766 2. PercentCounterItem need an operator== for ranges::sort for some reason --- Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp | 2 +- Telegram/SourceFiles/data/data_channel.cpp | 2 +- Telegram/SourceFiles/history/history_inner_widget.cpp | 2 +- .../SourceFiles/history/view/media/history_view_poll.cpp | 4 ++++ .../media/streaming/media_streaming_reader.cpp | 8 ++++---- Telegram/SourceFiles/ui/text/text_entity.cpp | 4 ++-- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp index 7773fd310..afde3180c 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp @@ -449,7 +449,7 @@ std::vector EmojiKeywords::LangPack::query( } const auto from = _data.emoji.lower_bound(normalized); - auto &&chosen = ranges::make_iterator_range( + auto &&chosen = ranges::subrange( from, end(_data.emoji) ) | ranges::view::take_while([&](const auto &pair) { diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index e4496e01d..129a7e028 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -764,7 +764,7 @@ void ApplyMegagroupAdmins( } auto adding = base::flat_map(); - auto admins = ranges::make_iterator_range( + auto admins = ranges::subrange( list.begin(), list.end() ) | ranges::view::transform([](const MTPChannelParticipant &p) { const auto userId = p.match([](const auto &data) { diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index abf6b33a7..f485726c9 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -2444,7 +2444,7 @@ MessageIdsList HistoryInner::getSelectedItems() const { return {}; } - auto result = make_iterator_range( + auto result = ranges::subrange( _selected.begin(), _selected.end() ) | view::filter([](const auto &selected) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp index 886440199..87e1ca4d0 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp @@ -34,6 +34,10 @@ struct PercentCounterItem { int percent = 0; int remainder = 0; + inline bool operator==(const PercentCounterItem &o) const { + return remainder == o.remainder && percent == o.percent; + } + inline bool operator<(const PercentCounterItem &other) const { if (remainder > other.remainder) { return true; diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp index c1e1705d5..4eaf64887 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp @@ -291,7 +291,7 @@ auto Reader::Slice::prepareFill(int from, int till) -> PrepareFillResult { ranges::less(), &PartsMap::value_type::first); const auto haveTill = FindNotLoadedStart( - ranges::make_iterator_range(start, finish), + ranges::subrange(start, finish), fromOffset); if (haveTill < till) { result.offsetsFromLoader = offsetsFromLoader( @@ -607,14 +607,14 @@ auto Reader::Slices::fill(int offset, bytes::span buffer) -> FillResult { markSliceUsed(fromSlice); CopyLoaded( buffer, - ranges::make_iterator_range(first.start, first.finish), + ranges::subrange(first.start, first.finish), firstFrom, firstTill); if (fromSlice + 1 < tillSlice) { markSliceUsed(fromSlice + 1); CopyLoaded( buffer.subspan(firstTill - firstFrom), - ranges::make_iterator_range(second.start, second.finish), + ranges::subrange(second.start, second.finish), secondFrom, secondTill); } @@ -644,7 +644,7 @@ auto Reader::Slices::fillFromHeader(int offset, bytes::span buffer) if (prepared.ready) { CopyLoaded( buffer, - ranges::make_iterator_range(prepared.start, prepared.finish), + ranges::subrange(prepared.start, prepared.finish), from, till); result.filled = true; diff --git a/Telegram/SourceFiles/ui/text/text_entity.cpp b/Telegram/SourceFiles/ui/text/text_entity.cpp index 4f3378fcb..0b6a6f71a 100644 --- a/Telegram/SourceFiles/ui/text/text_entity.cpp +++ b/Telegram/SourceFiles/ui/text/text_entity.cpp @@ -1141,7 +1141,7 @@ const QRegularExpression &RegExpWordSplit() { [[nodiscard]] QString ExpandCustomLinks(const TextWithTags &text) { const auto entities = ConvertTextTagsToEntities(text.tags); - auto &&urls = ranges::make_iterator_range( + auto &&urls = ranges::subrange( entities.begin(), entities.end() ) | ranges::view::filter([](const EntityInText &entity) { @@ -2098,7 +2098,7 @@ EntityInText::EntityInText( int EntityInText::FirstMonospaceOffset( const EntitiesInText &entities, int textLength) { - auto &&monospace = ranges::make_iterator_range( + auto &&monospace = ranges::subrange( entities.begin(), entities.end() ) | ranges::view::filter([](const EntityInText & entity) { From d7489f8e6729f50d2ed360d138e3a9c6dceef42e Mon Sep 17 00:00:00 2001 From: Jiachen YANG Date: Sun, 8 Sep 2019 00:53:25 +0900 Subject: [PATCH 09/18] Revert "Use 0.5.0 version of range-v3." This reverts commit 3355e6da0c2883f33992c4b2bcac7ce3067a529b. --- .appveyor/install.bat | 5 ++++- .travis/build.sh | 4 ++-- snap/snapcraft.yaml | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.appveyor/install.bat b/.appveyor/install.bat index c143e93a2..c42e30570 100644 --- a/.appveyor/install.bat +++ b/.appveyor/install.bat @@ -28,7 +28,10 @@ GOTO:EOF git clone -q --depth 1 --branch master https://github.com/telegramdesktop/dependencies_windows.git %LIB_DIR% cd %LIB_DIR% - git clone --depth 1 --branch 0.5.0 https://github.com/ericniebler/range-v3 + git clone https://github.com/ericniebler/range-v3 + cd range-v3 + git checkout 0.5.0 + cd .. if exist prepare.bat ( call prepare.bat diff --git a/.travis/build.sh b/.travis/build.sh index 25daad443..ac04dab46 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -28,7 +28,7 @@ GYP_CACHE_VERSION="3" GYP_PATCH="$UPSTREAM/Telegram/Patches/gyp.diff" RANGE_PATH="$BUILD/range-v3" -RANGE_CACHE_VERSION="4" +RANGE_CACHE_VERSION="3" VA_PATH="$BUILD/libva" VA_CACHE_VERSION="3" @@ -217,7 +217,7 @@ buildRange() { rm -rf * cd "$EXTERNAL" - git clone --depth 1 --branch 0.5.0 https://github.com/ericniebler/range-v3 + git clone --depth=1 https://github.com/ericniebler/range-v3 cd "$EXTERNAL/range-v3" cp -r * "$RANGE_PATH/" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index bc61fef9a..4a4cf5b18 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -393,7 +393,6 @@ parts: range-v3: source: https://github.com/ericniebler/range-v3.git source-depth: 1 - source-tag: 0.5.0 plugin: nil override-build: | set -x From d78716d7d40991a6afbe58229ba6a47ea23e1813 Mon Sep 17 00:00:00 2001 From: Jiachen YANG Date: Tue, 10 Sep 2019 10:14:37 +0900 Subject: [PATCH 10/18] appveyor use range-v3 latest branch --- .appveyor/install.bat | 3 --- 1 file changed, 3 deletions(-) diff --git a/.appveyor/install.bat b/.appveyor/install.bat index c42e30570..062d87a85 100644 --- a/.appveyor/install.bat +++ b/.appveyor/install.bat @@ -29,9 +29,6 @@ GOTO:EOF cd %LIB_DIR% git clone https://github.com/ericniebler/range-v3 - cd range-v3 - git checkout 0.5.0 - cd .. if exist prepare.bat ( call prepare.bat From 8abeb4a9dbfa1bfcd509bb789d4dc47757198800 Mon Sep 17 00:00:00 2001 From: Jiachen YANG Date: Tue, 10 Sep 2019 10:14:55 +0900 Subject: [PATCH 11/18] include range/v3/range/conversion.hpp instead of range/v3/to_container.hpp --- Telegram/SourceFiles/export/data/export_data_types.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp index 62a5d47aa..aab49845e 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.cpp +++ b/Telegram/SourceFiles/export/data/export_data_types.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include -#include +#include namespace App { // Hackish.. QString formatPhone(QString phone); From 56aab1aa075946c2ed895619007049c721989a1e Mon Sep 17 00:00:00 2001 From: Jiachen YANG Date: Tue, 10 Sep 2019 11:03:18 +0900 Subject: [PATCH 12/18] explicitly specify the upper bound in ranges::view::ints --- Telegram/SourceFiles/boxes/single_choice_box.cpp | 2 +- Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp | 4 ++-- Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp | 2 +- Telegram/SourceFiles/history/view/media/history_view_poll.cpp | 2 +- Telegram/SourceFiles/ui/image/image_prepare.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/boxes/single_choice_box.cpp b/Telegram/SourceFiles/boxes/single_choice_box.cpp index f617a5fca..f40c82eef 100644 --- a/Telegram/SourceFiles/boxes/single_choice_box.cpp +++ b/Telegram/SourceFiles/boxes/single_choice_box.cpp @@ -38,7 +38,7 @@ void SingleChoiceBox::prepare() { content->add(object_ptr( content, st::boxOptionListPadding.top() + st::autolockButton.margin.top())); - auto &&ints = ranges::view::ints(0); + auto &&ints = ranges::view::ints(0, ranges::unreachable); for (const auto &[i, text] : ranges::view::zip(ints, _optionTexts)) { content->add( object_ptr( diff --git a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp index 09fd1dc95..f3b6635e2 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp @@ -367,7 +367,7 @@ void Row::paintPreview(Painter &p) const { const auto y = st::manageEmojiPreviewPadding.top(); const auto width = st::manageEmojiPreviewWidth; const auto height = st::manageEmojiPreviewWidth; - auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0)); + auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0, int(_preview.size()))); for (const auto &[pixmap, index] : preview) { const auto row = (index / 2); const auto column = (index % 2); @@ -570,7 +570,7 @@ void Row::setupPreview(const Set &set) { const auto size = st::manageEmojiPreview * cIntRetinaFactor(); const auto original = QImage(set.previewPath); const auto full = original.height(); - auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0)); + auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0, int(_preview.size()))); for (auto &&[pixmap, index] : preview) { pixmap = App::pixmapFromImageInPlace(original.copy( { full * index, 0, full, full } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 6f71c940a..a0de1069c 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -2962,7 +2962,7 @@ void InnerWidget::setupShortcuts() { Command::ChatPinned4, Command::ChatPinned5, }; - auto &&pinned = ranges::view::zip(kPinned, ranges::view::ints(0)); + auto &&pinned = ranges::view::zip(kPinned, ranges::view::ints(0, ranges::unreachable)); for (const auto [command, index] : pinned) { request->check(command) && request->handle([=, index = index] { const auto list = session().data().chatsList()->indexed(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp index 87e1ca4d0..d095ad661 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp @@ -91,7 +91,7 @@ void CountNicePercent( auto &&zipped = ranges::view::zip( votes, items, - ranges::view::ints(0)); + ranges::view::ints(0, int(items.size()))); for (auto &&[votes, item, index] : zipped) { item.index = index; item.percent = (votes * 100) / total; diff --git a/Telegram/SourceFiles/ui/image/image_prepare.cpp b/Telegram/SourceFiles/ui/image/image_prepare.cpp index ea011b0d0..52631dd93 100644 --- a/Telegram/SourceFiles/ui/image/image_prepare.cpp +++ b/Telegram/SourceFiles/ui/image/image_prepare.cpp @@ -262,7 +262,7 @@ QImage BlurLargeImage(QImage image, int radius) { const auto dvs = take(dvcount); auto &&ints = ranges::view::ints; - for (auto &&[value, index] : ranges::view::zip(dvs, ints(0))) { + for (auto &&[value, index] : ranges::view::zip(dvs, ints(0, ranges::unreachable))) { value = (index / divsum); } const auto dv = dvs.data(); From 497df7f4b23a6464a7a23e512f41fa77d7f9caac Mon Sep 17 00:00:00 2001 From: Jiachen YANG Date: Tue, 10 Sep 2019 14:40:08 +0900 Subject: [PATCH 13/18] change deprecated ranges::to_ to ranges::to (no underscore) --- Telegram/SourceFiles/ui/grouped_layout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/grouped_layout.cpp b/Telegram/SourceFiles/ui/grouped_layout.cpp index 8cd1a3bd8..7b98af8b3 100644 --- a/Telegram/SourceFiles/ui/grouped_layout.cpp +++ b/Telegram/SourceFiles/ui/grouped_layout.cpp @@ -117,7 +117,7 @@ std::string Layouter::CountProportions(const std::vector &ratios) { ratios ) | ranges::view::transform([](float64 ratio) { return (ratio > 1.2) ? 'w' : (ratio < 0.8) ? 'n' : 'q'; - }) | ranges::to_(); + }) | ranges::to(); } std::vector Layouter::layout() const { From c164985233ca5aa55a5e02ac51312fe809b8ed4c Mon Sep 17 00:00:00 2001 From: Jiachen YANG Date: Thu, 12 Sep 2019 16:18:06 +0900 Subject: [PATCH 14/18] tweak vs2019 compiler settings to be compatible with newer range-v3 --- Telegram/gyp/common/win.gypi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Telegram/gyp/common/win.gypi b/Telegram/gyp/common/win.gypi index 3d2c779c5..e1d9df16d 100644 --- a/Telegram/gyp/common/win.gypi +++ b/Telegram/gyp/common/win.gypi @@ -33,6 +33,8 @@ '/w14834', # [[nodiscard]] '/w15038', # wrong initialization order '/w14265', # class has virtual functions, but destructor is not virtual + '/experimental:preprocessor', # need for range-v3 see https://github.com/ericniebler/range-v3#supported-compilers + '/wd5105', # needed for `/experimental:preprocessor`, suppressing C5105 "macro expansion producing 'defined' has undefined behavior" ], 'TreatWChar_tAsBuiltInType': 'false', }, From 4669c07dc5335cbf4795bbbe5b0ab7c007b9aee2 Mon Sep 17 00:00:00 2001 From: Jiachen YANG Date: Fri, 13 Sep 2019 11:40:40 +0900 Subject: [PATCH 15/18] fix range-v3 version to 0.9.1 --- .appveyor/install.bat | 2 +- .travis/build.sh | 2 +- docs/building-cmake.md | 2 +- docs/building-msvc.md | 2 +- docs/building-xcode.md | 2 +- snap/snapcraft.yaml | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.appveyor/install.bat b/.appveyor/install.bat index 062d87a85..590d1e0f5 100644 --- a/.appveyor/install.bat +++ b/.appveyor/install.bat @@ -28,7 +28,7 @@ GOTO:EOF git clone -q --depth 1 --branch master https://github.com/telegramdesktop/dependencies_windows.git %LIB_DIR% cd %LIB_DIR% - git clone https://github.com/ericniebler/range-v3 + git clone --depth 1 --branch 0.9.1 https://github.com/ericniebler/range-v3 if exist prepare.bat ( call prepare.bat diff --git a/.travis/build.sh b/.travis/build.sh index ac04dab46..4b6d05ff8 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -217,7 +217,7 @@ buildRange() { rm -rf * cd "$EXTERNAL" - git clone --depth=1 https://github.com/ericniebler/range-v3 + git clone --depth 1 --branch 0.9.1 https://github.com/ericniebler/range-v3 cd "$EXTERNAL/range-v3" cp -r * "$RANGE_PATH/" diff --git a/docs/building-cmake.md b/docs/building-cmake.md index ce59fd5f7..efc27ec3b 100644 --- a/docs/building-cmake.md +++ b/docs/building-cmake.md @@ -38,7 +38,7 @@ Go to ***BuildPath*** and run mkdir Libraries cd Libraries - git clone --branch 0.5.0 https://github.com/ericniebler/range-v3 + git clone --branch 0.9.1 https://github.com/ericniebler/range-v3 git clone https://github.com/telegramdesktop/zlib.git cd zlib diff --git a/docs/building-msvc.md b/docs/building-msvc.md index f233105c7..74e513eba 100644 --- a/docs/building-msvc.md +++ b/docs/building-msvc.md @@ -55,7 +55,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** mkdir Libraries cd Libraries - git clone --branch 0.5.0 https://github.com/ericniebler/range-v3 range-v3 + git clone --branch 0.9.1 https://github.com/ericniebler/range-v3 range-v3 git clone https://github.com/telegramdesktop/lzma.git cd lzma\C\Util\LzmaLib diff --git a/docs/building-xcode.md b/docs/building-xcode.md index 90132d111..8dfec1897 100644 --- a/docs/building-xcode.md +++ b/docs/building-xcode.md @@ -30,7 +30,7 @@ Go to ***BuildPath*** and run cd Libraries - git clone --branch 0.5.0 https://github.com/ericniebler/range-v3 + git clone --branch 0.9.1 https://github.com/ericniebler/range-v3 cd xz-5.0.5 CFLAGS="-mmacosx-version-min=10.8" LDFLAGS="-mmacosx-version-min=10.8" ./configure diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 4a4cf5b18..1adc7047f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -393,6 +393,7 @@ parts: range-v3: source: https://github.com/ericniebler/range-v3.git source-depth: 1 + source-tag: 0.9.1 plugin: nil override-build: | set -x From 982edcb310e4e90c8870806c609ba7e0ebabe472 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Mon, 30 Sep 2019 11:46:52 +0300 Subject: [PATCH 16/18] Resize message with photo when bubbled --- Telegram/SourceFiles/history/history.style | 1 + .../SourceFiles/history/view/media/history_view_photo.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index ec5b9c2ea..1f5d6feef 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -371,6 +371,7 @@ botKbScroll: defaultSolidScroll; historyDateFadeDuration: 200; historyPhotoLeft: 14px; +historyPhotoBubbleMinWidth: 200px; historyMessageRadius: roundRadiusLarge; historyBubbleTailInLeft: icon {{ "bubble_tail", msgInBg }}; historyBubbleTailInLeftSelected: icon {{ "bubble_tail", msgInBgSelected }}; diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index e96f81098..9d7e1b6d4 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -87,7 +87,7 @@ QSize Photo::countOptimalSize() { if (_serviceWidth > 0) { return { _serviceWidth, _serviceWidth }; } - const auto minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); + const auto minWidth = qMax((_parent->hasBubble() ? st::historyPhotoBubbleMinWidth : st::minPhotoSize), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); const auto maxActualWidth = qMax(tw, minWidth); maxWidth = qMax(maxActualWidth, th); minHeight = qMax(th, st::minPhotoSize); @@ -127,7 +127,7 @@ QSize Photo::countCurrentSize(int newWidth) { if (_pixw < 1) _pixw = 1; if (_pixh < 1) _pixh = 1; - auto minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); + auto minWidth = qMax((_parent->hasBubble() ? st::historyPhotoBubbleMinWidth : st::minPhotoSize), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); newWidth = qMax(_pixw, minWidth); auto newHeight = qMax(_pixh, st::minPhotoSize); if (_parent->hasBubble() && !_caption.isEmpty()) { From 60640c708769af6dec7707bb25cc91df82a70120 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Oct 2019 12:00:16 +0300 Subject: [PATCH 17/18] Version 1.8.12: Fix 'edited' badge display. --- Telegram/SourceFiles/history/history_message.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index e4f3633da..e6f756616 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -1041,6 +1041,9 @@ void HistoryMessage::applyEdition(const MTPDmessage &message) { // } //} + const auto copyFlags = MTPDmessage::Flag::f_edit_hide; + _flags = (_flags & ~copyFlags) | (message.vflags().v & copyFlags); + if (const auto editDate = message.vedit_date()) { _flags |= MTPDmessage::Flag::f_edit_date; if (!Has()) { From ecfe1dacb23d7402255e310cec422b4f9d9a3cc0 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Oct 2019 12:54:29 +0300 Subject: [PATCH 18/18] Version 1.8.12: Fix build for Xcode. --- Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp | 2 +- Telegram/SourceFiles/data/data_channel.cpp | 2 +- Telegram/SourceFiles/history/history_inner_widget.cpp | 2 +- .../media/streaming/media_streaming_reader.cpp | 8 ++++---- Telegram/SourceFiles/ui/text/text_entity.cpp | 4 ++-- Telegram/gyp/common/mac.gypi | 2 ++ 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp index afde3180c..92653bcac 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp @@ -449,7 +449,7 @@ std::vector EmojiKeywords::LangPack::query( } const auto from = _data.emoji.lower_bound(normalized); - auto &&chosen = ranges::subrange( + auto &&chosen = ranges::make_subrange( from, end(_data.emoji) ) | ranges::view::take_while([&](const auto &pair) { diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index 129a7e028..2435a1631 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -764,7 +764,7 @@ void ApplyMegagroupAdmins( } auto adding = base::flat_map(); - auto admins = ranges::subrange( + auto admins = ranges::make_subrange( list.begin(), list.end() ) | ranges::view::transform([](const MTPChannelParticipant &p) { const auto userId = p.match([](const auto &data) { diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index f485726c9..305f9c71d 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -2444,7 +2444,7 @@ MessageIdsList HistoryInner::getSelectedItems() const { return {}; } - auto result = ranges::subrange( + auto result = ranges::make_subrange( _selected.begin(), _selected.end() ) | view::filter([](const auto &selected) { diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp index 4eaf64887..79bdfcdd1 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp @@ -291,7 +291,7 @@ auto Reader::Slice::prepareFill(int from, int till) -> PrepareFillResult { ranges::less(), &PartsMap::value_type::first); const auto haveTill = FindNotLoadedStart( - ranges::subrange(start, finish), + ranges::make_subrange(start, finish), fromOffset); if (haveTill < till) { result.offsetsFromLoader = offsetsFromLoader( @@ -607,14 +607,14 @@ auto Reader::Slices::fill(int offset, bytes::span buffer) -> FillResult { markSliceUsed(fromSlice); CopyLoaded( buffer, - ranges::subrange(first.start, first.finish), + ranges::make_subrange(first.start, first.finish), firstFrom, firstTill); if (fromSlice + 1 < tillSlice) { markSliceUsed(fromSlice + 1); CopyLoaded( buffer.subspan(firstTill - firstFrom), - ranges::subrange(second.start, second.finish), + ranges::make_subrange(second.start, second.finish), secondFrom, secondTill); } @@ -644,7 +644,7 @@ auto Reader::Slices::fillFromHeader(int offset, bytes::span buffer) if (prepared.ready) { CopyLoaded( buffer, - ranges::subrange(prepared.start, prepared.finish), + ranges::make_subrange(prepared.start, prepared.finish), from, till); result.filled = true; diff --git a/Telegram/SourceFiles/ui/text/text_entity.cpp b/Telegram/SourceFiles/ui/text/text_entity.cpp index 0b6a6f71a..c2c08a6cd 100644 --- a/Telegram/SourceFiles/ui/text/text_entity.cpp +++ b/Telegram/SourceFiles/ui/text/text_entity.cpp @@ -1141,7 +1141,7 @@ const QRegularExpression &RegExpWordSplit() { [[nodiscard]] QString ExpandCustomLinks(const TextWithTags &text) { const auto entities = ConvertTextTagsToEntities(text.tags); - auto &&urls = ranges::subrange( + auto &&urls = ranges::make_subrange( entities.begin(), entities.end() ) | ranges::view::filter([](const EntityInText &entity) { @@ -2098,7 +2098,7 @@ EntityInText::EntityInText( int EntityInText::FirstMonospaceOffset( const EntitiesInText &entities, int textLength) { - auto &&monospace = ranges::subrange( + auto &&monospace = ranges::make_subrange( entities.begin(), entities.end() ) | ranges::view::filter([](const EntityInText & entity) { diff --git a/Telegram/gyp/common/mac.gypi b/Telegram/gyp/common/mac.gypi index 659527825..781cb69b7 100644 --- a/Telegram/gyp/common/mac.gypi +++ b/Telegram/gyp/common/mac.gypi @@ -64,6 +64,7 @@ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', 'GCC_OPTIMIZATION_LEVEL': '0', + 'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'NO', # temp for range-v3 'ALWAYS_SEARCH_USER_PATHS': 'NO', }, 'configurations': { @@ -88,6 +89,7 @@ 'OTHER_LDFLAGS': [ '-w', # Suppress 'libstdc++ is deprecated' warning. ], + 'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'NO', # temp for range-v3 }, 'defines': [ 'OS_MAC_OLD',