Updated to TD 1.8.12

This commit is contained in:
Eric Kotato 2019-10-02 16:09:50 +03:00
commit e89418482d
32 changed files with 164 additions and 114 deletions

View file

@ -28,7 +28,7 @@ GOTO:EOF
git clone -q --depth 1 --branch master https://github.com/telegramdesktop/dependencies_windows.git %LIB_DIR% git clone -q --depth 1 --branch master https://github.com/telegramdesktop/dependencies_windows.git %LIB_DIR%
cd %LIB_DIR% cd %LIB_DIR%
git clone --depth 1 --branch 0.5.0 https://github.com/ericniebler/range-v3 git clone --depth 1 --branch 0.9.1 https://github.com/ericniebler/range-v3
if exist prepare.bat ( if exist prepare.bat (
call prepare.bat call prepare.bat

View file

@ -28,7 +28,7 @@ GYP_CACHE_VERSION="3"
GYP_PATCH="$UPSTREAM/Telegram/Patches/gyp.diff" GYP_PATCH="$UPSTREAM/Telegram/Patches/gyp.diff"
RANGE_PATH="$BUILD/range-v3" RANGE_PATH="$BUILD/range-v3"
RANGE_CACHE_VERSION="4" RANGE_CACHE_VERSION="3"
VA_PATH="$BUILD/libva" VA_PATH="$BUILD/libva"
VA_CACHE_VERSION="3" VA_CACHE_VERSION="3"
@ -217,7 +217,7 @@ buildRange() {
rm -rf * rm -rf *
cd "$EXTERNAL" cd "$EXTERNAL"
git clone --depth 1 --branch 0.5.0 https://github.com/ericniebler/range-v3 git clone --depth 1 --branch 0.9.1 https://github.com/ericniebler/range-v3
cd "$EXTERNAL/range-v3" cd "$EXTERNAL/range-v3"
cp -r * "$RANGE_PATH/" cp -r * "$RANGE_PATH/"

View file

@ -9,7 +9,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop" <Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE" ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A" Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="1.8.11.0" /> Version="1.8.12.0" />
<Properties> <Properties>
<DisplayName>Telegram Desktop</DisplayName> <DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName> <PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName>

View file

@ -38,7 +38,7 @@ void SingleChoiceBox::prepare() {
content->add(object_ptr<Ui::FixedHeightWidget>( content->add(object_ptr<Ui::FixedHeightWidget>(
content, content,
st::boxOptionListPadding.top() + st::autolockButton.margin.top())); 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)) { for (const auto &[i, text] : ranges::view::zip(ints, _optionTexts)) {
content->add( content->add(
object_ptr<Ui::Radiobutton>( object_ptr<Ui::Radiobutton>(

View file

@ -449,7 +449,7 @@ std::vector<Result> EmojiKeywords::LangPack::query(
} }
const auto from = _data.emoji.lower_bound(normalized); const auto from = _data.emoji.lower_bound(normalized);
auto &&chosen = ranges::make_iterator_range( auto &&chosen = ranges::make_subrange(
from, from,
end(_data.emoji) end(_data.emoji)
) | ranges::view::take_while([&](const auto &pair) { ) | ranges::view::take_while([&](const auto &pair) {

View file

@ -367,7 +367,7 @@ void Row::paintPreview(Painter &p) const {
const auto y = st::manageEmojiPreviewPadding.top(); const auto y = st::manageEmojiPreviewPadding.top();
const auto width = st::manageEmojiPreviewWidth; const auto width = st::manageEmojiPreviewWidth;
const auto height = 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) { for (const auto &[pixmap, index] : preview) {
const auto row = (index / 2); const auto row = (index / 2);
const auto column = (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 size = st::manageEmojiPreview * cIntRetinaFactor();
const auto original = QImage(set.previewPath); const auto original = QImage(set.previewPath);
const auto full = original.height(); 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) { for (auto &&[pixmap, index] : preview) {
pixmap = App::pixmapFromImageInPlace(original.copy( pixmap = App::pixmapFromImageInPlace(original.copy(
{ full * index, 0, full, full } { full * index, 0, full, full }

View file

@ -115,7 +115,7 @@ std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(
bool UiIntegration::handleUrlClick( bool UiIntegration::handleUrlClick(
const QString &url, const QString &url,
const QVariant &context) { const QVariant &context) {
auto local = Core::TryConvertUrlToLocal(url); const auto local = Core::TryConvertUrlToLocal(url);
if (Core::InternalPassportLink(local)) { if (Core::InternalPassportLink(local)) {
return true; return true;
} }
@ -123,8 +123,8 @@ bool UiIntegration::handleUrlClick(
if (UrlClickHandler::IsEmail(url)) { if (UrlClickHandler::IsEmail(url)) {
File::OpenEmailLink(url); File::OpenEmailLink(url);
return true; return true;
} else if (url.startsWith(qstr("tg://"), Qt::CaseInsensitive)) { } else if (local.startsWith(qstr("tg://"), Qt::CaseInsensitive)) {
Core::App().openLocalUrl(url, context); Core::App().openLocalUrl(local, context);
return true; return true;
} }
return false; return false;

View file

@ -15,8 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#define TDESKTOP_ALPHA_VERSION (0ULL) #define TDESKTOP_ALPHA_VERSION (0ULL)
#endif // TDESKTOP_OFFICIAL_TARGET #endif // TDESKTOP_OFFICIAL_TARGET
constexpr auto AppVersion = 1008011; constexpr auto AppVersion = 1008012;
constexpr auto AppVersionStr = "1.8.11"; constexpr auto AppVersionStr = "1.8.12";
constexpr auto AppBetaVersion = false; constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
constexpr auto AppKotatoVersion = 1000003; constexpr auto AppKotatoVersion = 1000003;

View file

@ -764,7 +764,7 @@ void ApplyMegagroupAdmins(
} }
auto adding = base::flat_map<UserId, QString>(); auto adding = base::flat_map<UserId, QString>();
auto admins = ranges::make_iterator_range( auto admins = ranges::make_subrange(
list.begin(), list.end() list.begin(), list.end()
) | ranges::view::transform([](const MTPChannelParticipant &p) { ) | ranges::view::transform([](const MTPChannelParticipant &p) {
const auto userId = p.match([](const auto &data) { const auto userId = p.match([](const auto &data) {

View file

@ -2962,7 +2962,7 @@ void InnerWidget::setupShortcuts() {
Command::ChatPinned4, Command::ChatPinned4,
Command::ChatPinned5, 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) { for (const auto [command, index] : pinned) {
request->check(command) && request->handle([=, index = index] { request->check(command) && request->handle([=, index = index] {
const auto list = session().data().chatsList()->indexed(); const auto list = session().data().chatsList()->indexed();

View file

@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <range/v3/algorithm/max_element.hpp> #include <range/v3/algorithm/max_element.hpp>
#include <range/v3/view/all.hpp> #include <range/v3/view/all.hpp>
#include <range/v3/view/transform.hpp> #include <range/v3/view/transform.hpp>
#include <range/v3/to_container.hpp> #include <range/v3/range/conversion.hpp>
namespace App { // Hackish.. namespace App { // Hackish..
QString formatPhone(QString phone); QString formatPhone(QString phone);

View file

@ -2444,7 +2444,7 @@ MessageIdsList HistoryInner::getSelectedItems() const {
return {}; return {};
} }
auto result = make_iterator_range( auto result = ranges::make_subrange(
_selected.begin(), _selected.begin(),
_selected.end() _selected.end()
) | view::filter([](const auto &selected) { ) | view::filter([](const auto &selected) {

View file

@ -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()) { if (const auto editDate = message.vedit_date()) {
_flags |= MTPDmessage::Flag::f_edit_date; _flags |= MTPDmessage::Flag::f_edit_date;
if (!Has<HistoryMessageEdited>()) { if (!Has<HistoryMessageEdited>()) {

View file

@ -87,7 +87,7 @@ QSize Photo::countOptimalSize() {
if (_serviceWidth > 0) { if (_serviceWidth > 0) {
return { _serviceWidth, _serviceWidth }; return { _serviceWidth, _serviceWidth };
} }
const auto minWidth = qMax((!_parent->hasBubble() ? st::minPhotoSize : st::historyPhotoBubbleMinWidth), _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); const auto maxActualWidth = qMax(tw, minWidth);
maxWidth = qMax(maxActualWidth, th); maxWidth = qMax(maxActualWidth, th);
minHeight = qMax(th, st::minPhotoSize); minHeight = qMax(th, st::minPhotoSize);
@ -127,7 +127,7 @@ QSize Photo::countCurrentSize(int newWidth) {
if (_pixw < 1) _pixw = 1; if (_pixw < 1) _pixw = 1;
if (_pixh < 1) _pixh = 1; if (_pixh < 1) _pixh = 1;
auto minWidth = qMax((!_parent->hasBubble() ? st::minPhotoSize : st::historyPhotoBubbleMinWidth), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
newWidth = qMax(_pixw, minWidth); newWidth = qMax(_pixw, minWidth);
auto newHeight = qMax(_pixh, st::minPhotoSize); auto newHeight = qMax(_pixh, st::minPhotoSize);
if (_parent->hasBubble() && !_caption.isEmpty()) { if (_parent->hasBubble() && !_caption.isEmpty()) {

View file

@ -34,6 +34,10 @@ struct PercentCounterItem {
int percent = 0; int percent = 0;
int remainder = 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 { inline bool operator<(const PercentCounterItem &other) const {
if (remainder > other.remainder) { if (remainder > other.remainder) {
return true; return true;
@ -87,7 +91,7 @@ void CountNicePercent(
auto &&zipped = ranges::view::zip( auto &&zipped = ranges::view::zip(
votes, votes,
items, items,
ranges::view::ints(0)); ranges::view::ints(0, int(items.size())));
for (auto &&[votes, item, index] : zipped) { for (auto &&[votes, item, index] : zipped) {
item.index = index; item.index = index;
item.percent = (votes * 100) / total; item.percent = (votes * 100) / total;

View file

@ -291,7 +291,7 @@ auto Reader::Slice::prepareFill(int from, int till) -> PrepareFillResult {
ranges::less(), ranges::less(),
&PartsMap::value_type::first); &PartsMap::value_type::first);
const auto haveTill = FindNotLoadedStart( const auto haveTill = FindNotLoadedStart(
ranges::make_iterator_range(start, finish), ranges::make_subrange(start, finish),
fromOffset); fromOffset);
if (haveTill < till) { if (haveTill < till) {
result.offsetsFromLoader = offsetsFromLoader( result.offsetsFromLoader = offsetsFromLoader(
@ -607,14 +607,14 @@ auto Reader::Slices::fill(int offset, bytes::span buffer) -> FillResult {
markSliceUsed(fromSlice); markSliceUsed(fromSlice);
CopyLoaded( CopyLoaded(
buffer, buffer,
ranges::make_iterator_range(first.start, first.finish), ranges::make_subrange(first.start, first.finish),
firstFrom, firstFrom,
firstTill); firstTill);
if (fromSlice + 1 < tillSlice) { if (fromSlice + 1 < tillSlice) {
markSliceUsed(fromSlice + 1); markSliceUsed(fromSlice + 1);
CopyLoaded( CopyLoaded(
buffer.subspan(firstTill - firstFrom), buffer.subspan(firstTill - firstFrom),
ranges::make_iterator_range(second.start, second.finish), ranges::make_subrange(second.start, second.finish),
secondFrom, secondFrom,
secondTill); secondTill);
} }
@ -644,7 +644,7 @@ auto Reader::Slices::fillFromHeader(int offset, bytes::span buffer)
if (prepared.ready) { if (prepared.ready) {
CopyLoaded( CopyLoaded(
buffer, buffer,
ranges::make_iterator_range(prepared.start, prepared.finish), ranges::make_subrange(prepared.start, prepared.finish),
from, from,
till); till);
result.filled = true; result.filled = true;

View file

@ -129,7 +129,11 @@ void ConfigLoader::createSpecialLoader() {
const std::string &ip, const std::string &ip,
int port, int port,
bytes::const_span secret) { bytes::const_span secret) {
addSpecialEndpoint(dcId, ip, port, secret); if (ip.empty()) {
_specialLoader = nullptr;
} else {
addSpecialEndpoint(dcId, ip, port, secret);
}
}, _phone); }, _phone);
} }

View file

@ -374,19 +374,22 @@ SpecialConfigRequest::SpecialConfigRequest(
while (!domains.empty()) { while (!domains.empty()) {
_attempts.push_back({ Type::Google, takeDomain(), "dns" }); _attempts.push_back({ Type::Google, takeDomain(), "dns" });
} }
_attempts.push_back({ Type::Realtime, "firebaseio.com" }); if (!_timeDoneCallback) {
_attempts.push_back({ Type::FireStore, "firestore" }); _attempts.push_back({ Type::Realtime, "firebaseio.com" });
for (const auto &domain : DnsDomains()) { _attempts.push_back({ Type::FireStore, "firestore" });
_attempts.push_back({ Type::FireStore, domain, "firestore" }); for (const auto &domain : DnsDomains()) {
_attempts.push_back({ Type::FireStore, domain, "firestore" });
}
} }
shuffle(0, 2); shuffle(0, 2);
shuffle(2, 4); shuffle(2, 4);
shuffle( if (!_timeDoneCallback) {
_attempts.size() - (2 + domainsCount), shuffle(
_attempts.size() - domainsCount); _attempts.size() - (2 + domainsCount),
shuffle(_attempts.size() - domainsCount, _attempts.size()); _attempts.size() - domainsCount);
shuffle(_attempts.size() - domainsCount, _attempts.size());
}
ranges::reverse(_attempts); // We go from last to first. ranges::reverse(_attempts); // We go from last to first.
sendNextRequest(); sendNextRequest();
@ -666,20 +669,27 @@ void SpecialConfigRequest::handleResponse(const QByteArray &bytes) {
switch (address.type()) { switch (address.type()) {
case mtpc_ipPort: { case mtpc_ipPort: {
const auto &fields = address.c_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; } break;
case mtpc_ipPortSecret: { case mtpc_ipPortSecret: {
const auto &fields = address.c_ipPortSecret(); const auto &fields = address.c_ipPortSecret();
_callback( const auto ip = parseIp(fields.vipv4());
dcId, if (!ip.empty()) {
parseIp(fields.vipv4()), _callback(
fields.vport().v, dcId,
bytes::make_span(fields.vsecret().v)); ip,
fields.vport().v,
bytes::make_span(fields.vsecret().v));
}
} break; } break;
default: Unexpected("Type in simpleConfig ips."); default: Unexpected("Type in simpleConfig ips.");
} }
} }
} }
_callback(0, std::string(), 0, {});
} }
DomainResolver::DomainResolver(Fn<void( DomainResolver::DomainResolver(Fn<void(

View file

@ -74,6 +74,17 @@ constexpr auto kArchiveId = -1;
constexpr auto kMaxStickerSets = 5; constexpr auto kMaxStickerSets = 5;
constexpr auto kGestureStateProcessed = {
NSGestureRecognizerStateChanged,
NSGestureRecognizerStateBegan,
};
constexpr auto kGestureStateFinished = {
NSGestureRecognizerStateEnded,
NSGestureRecognizerStateCancelled,
NSGestureRecognizerStateFailed,
};
NSString *const kTypePinned = @"pinned"; NSString *const kTypePinned = @"pinned";
NSString *const kTypeSlider = @"slider"; NSString *const kTypeSlider = @"slider";
NSString *const kTypeButton = @"button"; NSString *const kTypeButton = @"button";
@ -641,9 +652,11 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
@end // @interface PickerScrubberItemView @end // @interface PickerScrubberItemView
@implementation PickerScrubberItemView { @implementation PickerScrubberItemView {
rpl::lifetime _lifetime; rpl::lifetime _lifetime;
Data::FileOrigin _origin;
QSize _dimensions; QSize _dimensions;
Image *_image; Image *_image;
@public
Data::FileOrigin fileOrigin;
DocumentData *documentData;
} }
- (instancetype)initWithFrame:(NSRect)frameRect { - (instancetype)initWithFrame:(NSRect)frameRect {
@ -667,9 +680,10 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
if (!_image) { if (!_image) {
return; return;
} }
fileOrigin = document->stickerSetOrigin();
documentData = std::move(document);
_dimensions = document->dimensions; _dimensions = document->dimensions;
_origin = document->stickerSetOrigin(); _image->load(fileOrigin);
_image->load(_origin);
if (_image->loaded()) { if (_image->loaded()) {
[self updateImage]; [self updateImage];
return; return;
@ -689,7 +703,7 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
.scaled(kCircleDiameter, kCircleDiameter, Qt::KeepAspectRatio); .scaled(kCircleDiameter, kCircleDiameter, Qt::KeepAspectRatio);
_imageView.image = [qt_mac_create_nsimage( _imageView.image = [qt_mac_create_nsimage(
_image->pixSingle( _image->pixSingle(
_origin, fileOrigin,
size.width(), size.width(),
size.height(), size.height(),
kCircleDiameter, kCircleDiameter,
@ -711,9 +725,7 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
@implementation PickerCustomTouchBarItem { @implementation PickerCustomTouchBarItem {
std::vector<PickerScrubberItem> _stickers; std::vector<PickerScrubberItem> _stickers;
NSPopoverTouchBarItem *_parentPopover; NSPopoverTouchBarItem *_parentPopover;
std::unique_ptr<base::Timer> _previewTimer; DocumentId _lastPreviewedSticker;
int _highlightedIndex;
bool _previewShown;
} }
- (id) init:(ScrubberItemType)type popover:(NSPopoverTouchBarItem *)popover { - (id) init:(ScrubberItemType)type popover:(NSPopoverTouchBarItem *)popover {
@ -739,18 +751,65 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
[scrubber registerClass:[NSScrubberTextItemView class] forItemIdentifier:kPickerTitleItemIdentifier]; [scrubber registerClass:[NSScrubberTextItemView class] forItemIdentifier:kPickerTitleItemIdentifier];
[scrubber registerClass:[NSScrubberImageItemView class] forItemIdentifier:kEmojiItemIdentifier]; [scrubber registerClass:[NSScrubberImageItemView class] forItemIdentifier:kEmojiItemIdentifier];
_previewShown = false; if (IsSticker(type)) {
_highlightedIndex = 0; auto *gesture = [[NSPressGestureRecognizer alloc]
_previewTimer = !IsSticker(type) initWithTarget:self
? nullptr action:@selector(gesturePreviewHandler:)];
: std::make_unique<base::Timer>([=] { gesture.allowedTouchTypes = NSTouchTypeMaskDirect;
[self showPreview]; gesture.minimumPressDuration = QApplication::startDragTime() / 1000.;
}); gesture.allowableMovement = 0;
[scrubber addGestureRecognizer:gesture];
}
_lastPreviewedSticker = 0;
self.view = scrubber; self.view = scrubber;
return self; 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 { - (void)encodeWithCoder:(nonnull NSCoder *)aCoder {
// Has not been implemented. // Has not been implemented.
} }
@ -765,7 +824,7 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
const auto item = _stickers[index]; const auto item = _stickers[index];
if (const auto document = item.document) { if (const auto document = item.document) {
PickerScrubberItemView *itemView = [scrubber makeItemWithIdentifier:kStickerItemIdentifier owner:nil]; PickerScrubberItemView *itemView = [scrubber makeItemWithIdentifier:kStickerItemIdentifier owner:nil];
[itemView addDocument:document]; [itemView addDocument:(std::move(document))];
return itemView; return itemView;
} else if (const auto emoji = item.emoji) { } else if (const auto emoji = item.emoji) {
NSScrubberImageItemView *itemView = [scrubber makeItemWithIdentifier:kEmojiItemIdentifier owner:nil]; NSScrubberImageItemView *itemView = [scrubber makeItemWithIdentifier:kEmojiItemIdentifier owner:nil];
@ -791,12 +850,6 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
return; return;
} }
scrubber.selectedIndex = -1; scrubber.selectedIndex = -1;
if (_previewShown && [self hidePreview]) {
return;
}
if (_previewTimer) {
_previewTimer->cancel();
}
const auto chat = GetActiveChat(); const auto chat = GetActiveChat();
const auto callback = [&]() -> bool { const auto callback = [&]() -> bool {
@ -828,47 +881,6 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &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 { - (void)updateStickers {
std::vector<PickerScrubberItem> temp; std::vector<PickerScrubberItem> temp;
if (const auto error = RestrictionToSendStickers()) { if (const auto error = RestrictionToSendStickers()) {

View file

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_info.h" #include "platform/platform_info.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "base/timer.h" #include "base/timer.h"
#include "facades.h"
#include "styles/style_window.h" #include "styles/style_window.h"
#include <QtGui/QWindow> #include <QtGui/QWindow>

View file

@ -117,7 +117,7 @@ std::string Layouter::CountProportions(const std::vector<float64> &ratios) {
ratios ratios
) | ranges::view::transform([](float64 ratio) { ) | ranges::view::transform([](float64 ratio) {
return (ratio > 1.2) ? 'w' : (ratio < 0.8) ? 'n' : 'q'; return (ratio > 1.2) ? 'w' : (ratio < 0.8) ? 'n' : 'q';
}) | ranges::to_<std::string>(); }) | ranges::to<std::string>();
} }
std::vector<GroupMediaLayout> Layouter::layout() const { std::vector<GroupMediaLayout> Layouter::layout() const {

View file

@ -262,7 +262,7 @@ QImage BlurLargeImage(QImage image, int radius) {
const auto dvs = take(dvcount); const auto dvs = take(dvcount);
auto &&ints = ranges::view::ints; 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); value = (index / divsum);
} }
const auto dv = dvs.data(); const auto dv = dvs.data();

View file

@ -1141,7 +1141,7 @@ const QRegularExpression &RegExpWordSplit() {
[[nodiscard]] QString ExpandCustomLinks(const TextWithTags &text) { [[nodiscard]] QString ExpandCustomLinks(const TextWithTags &text) {
const auto entities = ConvertTextTagsToEntities(text.tags); const auto entities = ConvertTextTagsToEntities(text.tags);
auto &&urls = ranges::make_iterator_range( auto &&urls = ranges::make_subrange(
entities.begin(), entities.begin(),
entities.end() entities.end()
) | ranges::view::filter([](const EntityInText &entity) { ) | ranges::view::filter([](const EntityInText &entity) {
@ -2098,7 +2098,7 @@ EntityInText::EntityInText(
int EntityInText::FirstMonospaceOffset( int EntityInText::FirstMonospaceOffset(
const EntitiesInText &entities, const EntitiesInText &entities,
int textLength) { int textLength) {
auto &&monospace = ranges::make_iterator_range( auto &&monospace = ranges::make_subrange(
entities.begin(), entities.begin(),
entities.end() entities.end()
) | ranges::view::filter([](const EntityInText & entity) { ) | ranges::view::filter([](const EntityInText & entity) {

View file

@ -1,6 +1,6 @@
AppVersion 1008011 AppVersion 1008012
AppVersionStrMajor 1.8 AppVersionStrMajor 1.8
AppVersionStrSmall 1.8.11 AppVersionStrSmall 1.8.12
AppVersionStr 1.8.11 AppVersionStr 1.8.12
BetaChannel 0 BetaChannel 0
AlphaVersion 0 AlphaVersion 0

View file

@ -64,6 +64,7 @@
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
'GCC_OPTIMIZATION_LEVEL': '0', 'GCC_OPTIMIZATION_LEVEL': '0',
'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'NO', # temp for range-v3
'ALWAYS_SEARCH_USER_PATHS': 'NO', 'ALWAYS_SEARCH_USER_PATHS': 'NO',
}, },
'configurations': { 'configurations': {
@ -88,6 +89,7 @@
'OTHER_LDFLAGS': [ 'OTHER_LDFLAGS': [
'-w', # Suppress 'libstdc++ is deprecated' warning. '-w', # Suppress 'libstdc++ is deprecated' warning.
], ],
'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'NO', # temp for range-v3
}, },
'defines': [ 'defines': [
'OS_MAC_OLD', 'OS_MAC_OLD',

View file

@ -33,6 +33,8 @@
'/w14834', # [[nodiscard]] '/w14834', # [[nodiscard]]
'/w15038', # wrong initialization order '/w15038', # wrong initialization order
'/w14265', # class has virtual functions, but destructor is not virtual '/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', 'TreatWChar_tAsBuiltInType': 'false',
}, },

View file

@ -45,6 +45,14 @@
}, },
'defines': [ 'defines': [
], ],
'conditions': [[ 'build_macold', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},
'include_dirs': [
'/usr/local/macold/include/c++/v1',
],
}]],
'include_dirs': [ 'include_dirs': [
'<(src_loc)', '<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)', '<(SHARED_INTERMEDIATE_DIR)',

View file

@ -1,3 +1,7 @@
1.8.12 (02.10.19)
- Bug fixes and other minor improvements.
1.8.11 (01.10.19) 1.8.11 (01.10.19)
- Bug fixes and other minor improvements. - Bug fixes and other minor improvements.

View file

@ -38,7 +38,7 @@ Go to ***BuildPath*** and run
mkdir Libraries mkdir Libraries
cd 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 git clone https://github.com/telegramdesktop/zlib.git
cd zlib cd zlib

View file

@ -55,7 +55,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
mkdir Libraries mkdir Libraries
cd 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 git clone https://github.com/telegramdesktop/lzma.git
cd lzma\C\Util\LzmaLib cd lzma\C\Util\LzmaLib

View file

@ -30,7 +30,7 @@ Go to ***BuildPath*** and run
cd 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
cd xz-5.0.5 cd xz-5.0.5
CFLAGS="-mmacosx-version-min=10.8" LDFLAGS="-mmacosx-version-min=10.8" ./configure CFLAGS="-mmacosx-version-min=10.8" LDFLAGS="-mmacosx-version-min=10.8" ./configure

View file

@ -393,7 +393,7 @@ parts:
range-v3: range-v3:
source: https://github.com/ericniebler/range-v3.git source: https://github.com/ericniebler/range-v3.git
source-depth: 1 source-depth: 1
source-tag: 0.5.0 source-tag: 0.9.1
plugin: nil plugin: nil
override-build: | override-build: |
set -x set -x