Compare commits

..

10 Commits

Author SHA1 Message Date
John Preston
b0981ea8e3 Beta version 5.2.6.
- Fix launching on X11. (Linux)
2024-07-29 11:02:25 +03:00
Ilya Fedin
a141d01a23 Fix macOS packaged action 2024-07-27 22:59:48 +02:00
John Preston
6a000207ee Beta version 5.2.5.
- Fix media viewer context menu.
- Fix blockquotes layout in messages.
2024-07-27 07:48:35 +02:00
John Preston
ee6edf9caa Force venue icon format. 2024-07-27 07:45:59 +02:00
John Preston
37907636e6 Fix build with Xcode. 2024-07-27 07:44:51 +02:00
John Preston
3f0f3a3c11 Focus existing location picker. 2024-07-26 17:28:04 +02:00
John Preston
db0856f71c Support t.me/username?profile links. 2024-07-26 17:28:03 +02:00
John Preston
86cdda2277 Fix text with blockquotes geometry counting. 2024-07-26 17:28:03 +02:00
John Preston
3888e8084a Update tg_owt, lib_webrtc and patches. 2024-07-26 13:02:38 +02:00
Ilya Fedin
517b456670 Add hit test for window context menu 2024-07-26 10:19:55 +02:00
31 changed files with 359 additions and 74 deletions

View File

@@ -69,7 +69,7 @@ jobs:
run: |
brew update
brew upgrade || true
brew install autoconf automake boost cmake ffmpeg@6 openal-soft openssl opus ninja pkg-config python qt yasm xz
brew install autoconf automake boost cmake ffmpeg@6 openal-soft openh264 openssl opus ninja pkg-config python qt yasm xz
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
xcodebuild -version > CACHE_KEY.txt
@@ -108,7 +108,7 @@ jobs:
run: |
cd $LibrariesPath
git clone --recursive --depth=1 $GIT/desktop-app/tg_owt.git
git clone --depth=1 --recursive --shallow-submodules $GIT/desktop-app/tg_owt.git
cd tg_owt
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=Debug

View File

@@ -475,6 +475,8 @@ PRIVATE
data/business/data_shortcut_messages.h
data/components/factchecks.cpp
data/components/factchecks.h
data/components/location_pickers.cpp
data/components/location_pickers.h
data/components/recent_peers.cpp
data/components/recent_peers.h
data/components/scheduled_messages.cpp

View File

@@ -3197,6 +3197,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_unread_bar_some" = "Unread messages";
"lng_maps_point" = "Location";
"lng_maps_select_on_map" = "Select on the Map";
"lng_maps_point_send" = "Send This Location";
"lng_maps_point_set" = "Set This Location";
"lng_maps_or_choose" = "Or choose a venue";

View File

@@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="5.2.4.0" />
Version="5.2.6.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,2,4,0
PRODUCTVERSION 5,2,4,0
FILEVERSION 5,2,6,0
PRODUCTVERSION 5,2,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "5.2.4.0"
VALUE "FileVersion", "5.2.6.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.2.4.0"
VALUE "ProductVersion", "5.2.6.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,2,4,0
PRODUCTVERSION 5,2,4,0
FILEVERSION 5,2,6,0
PRODUCTVERSION 5,2,6,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", "5.2.4.0"
VALUE "FileVersion", "5.2.6.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.2.4.0"
VALUE "ProductVersion", "5.2.6.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -30,6 +30,10 @@ struct SendOptions {
bool invertCaption = false;
bool hideViaBot = false;
crl::time ttlSeconds = 0;
friend inline bool operator==(
const SendOptions &,
const SendOptions &) = default;
};
[[nodiscard]] SendOptions DefaultSendWhenOnlineOptions();
@@ -52,6 +56,10 @@ struct SendAction {
MsgId replaceMediaOf = 0;
[[nodiscard]] MTPInputReplyTo mtpReplyTo() const;
friend inline bool operator==(
const SendAction &,
const SendAction &) = default;
};
struct MessageToSend {

View File

@@ -215,7 +215,7 @@ void Panel::initWindow() {
}
const auto shown = _layerBg->topShownLayer();
return (!shown || !shown->geometry().contains(widgetPoint))
? (Flag::Move | Flag::FullScreen)
? (Flag::Move | Flag::Menu | Flag::FullScreen)
: Flag::None;
});

View File

@@ -410,7 +410,7 @@ void Panel::initWindow() {
}
const auto shown = _layerBg->topShownLayer();
return (!shown || !shown->geometry().contains(widgetPoint))
? (Flag::Move | Flag::Maximize)
? (Flag::Move | Flag::Menu | Flag::Maximize)
: Flag::None;
});

View File

@@ -1475,3 +1475,9 @@ pickLocationLoading: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
thickness: 4px;
}
pickLocationPromoHeight: 32px;
pickLocationChooseOnMap: RoundButton(defaultActiveButton) {
height: 44px;
textTop: 11px;
width: -96px;
font: font(15px semibold);
}

View File

@@ -503,7 +503,9 @@ bool ResolveUsernameOrPhone(
return false;
}
using ResolveType = Window::ResolveType;
auto resolveType = ResolveType::Default;
auto resolveType = params.contains(u"profile"_q)
? ResolveType::Profile
: ResolveType::Default;
auto startToken = params.value(u"start"_q);
if (!startToken.isEmpty()) {
resolveType = ResolveType::BotStart;

View File

@@ -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 = 5002004;
constexpr auto AppVersionStr = "5.2.4";
constexpr auto AppVersion = 5002006;
constexpr auto AppVersionStr = "5.2.6";
constexpr auto AppBetaVersion = true;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -0,0 +1,44 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "data/components/location_pickers.h"
#include "api/api_common.h"
#include "ui/controls/location_picker.h"
namespace Data {
struct LocationPickers::Entry {
Api::SendAction action;
base::weak_ptr<Ui::LocationPicker> picker;
};
LocationPickers::LocationPickers() = default;
LocationPickers::~LocationPickers() = default;
Ui::LocationPicker *LocationPickers::lookup(const Api::SendAction &action) {
for (auto i = begin(_pickers); i != end(_pickers);) {
if (const auto strong = i->picker.get()) {
if (i->action == action) {
return i->picker.get();
}
++i;
} else {
i = _pickers.erase(i);
}
}
return nullptr;
}
void LocationPickers::emplace(
const Api::SendAction &action,
not_null<Ui::LocationPicker*> picker) {
_pickers.push_back({ action, picker });
}
} // namespace Data

View File

@@ -0,0 +1,39 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "base/weak_ptr.h"
namespace Api {
struct SendAction;
} // namespace Api
namespace Ui {
class LocationPicker;
} // namespace Ui
namespace Data {
class LocationPickers final {
public:
LocationPickers();
~LocationPickers();
Ui::LocationPicker *lookup(const Api::SendAction &action);
void emplace(
const Api::SendAction &action,
not_null<Ui::LocationPicker*> picker);
private:
struct Entry;
std::vector<Entry> _pickers;
};
} // namespace Data

View File

@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/share_box.h"
#include "core/click_handler_types.h"
#include "core/shortcuts.h"
#include "data/components/location_pickers.h"
#include "data/data_bot_app.h"
#include "data/data_changes.h"
#include "data/data_user.h"
@@ -1776,6 +1777,11 @@ void ChooseAndSendLocation(
not_null<Window::SessionController*> controller,
const Ui::LocationPickerConfig &config,
Api::SendAction action) {
const auto session = &controller->session();
if (const auto picker = session->locationPickers().lookup(action)) {
picker->activate();
return;
}
const auto callback = [=](Data::InputVenue venue) {
if (venue.justLocation()) {
Api::SendLocation(action, venue.lat, venue.lon);
@@ -1783,17 +1789,18 @@ void ChooseAndSendLocation(
Api::SendVenue(action, venue);
}
};
Ui::LocationPicker::Show({
const auto picker = Ui::LocationPicker::Show({
.parent = controller->widget(),
.config = config,
.chooseLabel = tr::lng_maps_point_send(),
.recipient = action.history->peer,
.session = &controller->session(),
.callback = crl::guard(controller, callback),
.session = session,
.callback = crl::guard(session, callback),
.quit = [] { Shortcuts::Launch(Shortcuts::Command::Quit); },
.storageId = controller->session().local().resolveStorageIdBots(),
.storageId = session->local().resolveStorageIdBots(),
.closeRequests = controller->content()->death(),
});
session->locationPickers().emplace(action, picker);
}
std::unique_ptr<Ui::DropdownMenu> MakeAttachBotsMenu(

View File

@@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/storage_account.h"
#include "storage/storage_facade.h"
#include "data/components/factchecks.h"
#include "data/components/location_pickers.h"
#include "data/components/recent_peers.h"
#include "data/components/scheduled_messages.h"
#include "data/components/sponsored_messages.h"
@@ -111,6 +112,7 @@ Session::Session(
, _sponsoredMessages(std::make_unique<Data::SponsoredMessages>(this))
, _topPeers(std::make_unique<Data::TopPeers>(this))
, _factchecks(std::make_unique<Data::Factchecks>(this))
, _locationPickers(std::make_unique<Data::LocationPickers>())
, _cachedReactionIconFactory(std::make_unique<ReactionIconFactory>())
, _supportHelper(Support::Helper::Create(this))
, _saveSettingsTimer([=] { saveSettings(); }) {

View File

@@ -36,6 +36,7 @@ class ScheduledMessages;
class SponsoredMessages;
class TopPeers;
class Factchecks;
class LocationPickers;
} // namespace Data
namespace HistoryView::Reactions {
@@ -131,6 +132,9 @@ public:
[[nodiscard]] Data::Factchecks &factchecks() const {
return *_factchecks;
}
[[nodiscard]] Data::LocationPickers &locationPickers() const {
return *_locationPickers;
}
[[nodiscard]] Api::Updates &updates() const {
return *_updates;
}
@@ -259,6 +263,7 @@ private:
const std::unique_ptr<Data::SponsoredMessages> _sponsoredMessages;
const std::unique_ptr<Data::TopPeers> _topPeers;
const std::unique_ptr<Data::Factchecks> _factchecks;
const std::unique_ptr<Data::LocationPickers> _locationPickers;
using ReactionIconFactory = HistoryView::Reactions::CachedIconFactory;
const std::unique_ptr<ReactionIconFactory> _cachedReactionIconFactory;

View File

@@ -729,25 +729,27 @@ void OverlayWidget::orderWidgets() {
void OverlayWidget::setupWindow() {
_window->setBodyTitleArea([=](QPoint widgetPoint) {
using Flag = Ui::WindowTitleHitTestFlag;
if (!_windowed
|| !_widget->rect().contains(widgetPoint)
Ui::WindowTitleHitTestFlags result;
if (!_widget->rect().contains(widgetPoint)
|| _helper->skipTitleHitTest(widgetPoint)) {
return Flag::None | Flag(0);
return result;
}
const auto inControls = (_over != Over::None) && (_over != Over::Video);
if (widgetPoint.y() <= st::mediaviewTitleButton.height) {
result |= Flag::Menu;
}
const auto inControls = ((_over != Over::None) && (_over != Over::Video));
if (inControls
|| (_streamed
&& _streamed->controls
&& _streamed->controls->dragging())) {
return Flag::None | Flag(0);
} else if ((_w > _widget->width() || _h > _maxUsedHeight)
&& (widgetPoint.y() > st::mediaviewHeaderTop)
&& QRect(_x, _y, _w, _h).contains(widgetPoint)) {
return Flag::None | Flag(0);
} else if (_stories && _stories->ignoreWindowMove(widgetPoint)) {
return Flag::None | Flag(0);
} else if (_windowed) {
result |= Flag::Move;
}
return Flag::Move | Flag(0);
return result;
});
_window->setAttribute(Qt::WA_NoSystemBackground, true);
@@ -5926,8 +5928,11 @@ void OverlayWidget::handleMouseRelease(
}
bool OverlayWidget::handleContextMenu(std::optional<QPoint> position) {
if (position && !QRect(_x, _y, _w, _h).contains(*position)) {
return false;
if (position) {
if (!QRect(_x, _y, _w, _h).contains(*position)
|| position->y() <= st::mediaviewTitleButton.height) {
return false;
}
}
_menu = base::make_unique_q<Ui::PopupMenu>(
_window,

View File

@@ -63,6 +63,7 @@ private:
const Ui::LocationPickerConfig _config;
rpl::variable<Data::BusinessLocation> _data;
rpl::variable<Data::CloudImage*> _map = nullptr;
base::weak_ptr<Ui::LocationPicker> _picker;
std::shared_ptr<QImage> _view;
Ui::RoundRect _bottomSkipRounding;
@@ -232,6 +233,10 @@ void Location::setupPicker(not_null<Ui::VerticalLayout*> content) {
}
void Location::chooseOnMap() {
if (const auto strong = _picker.get()) {
strong->activate();
return;
}
const auto callback = [=](Data::InputVenue venue) {
auto copy = _data.current();
copy.point = Data::LocationPoint(
@@ -249,7 +254,7 @@ void Location::chooseOnMap() {
.accuracy = Core::GeoLocationAccuracy::Exact,
}
: Core::GeoLocation();
Ui::LocationPicker::Show({
_picker = Ui::LocationPicker::Show({
.parent = controller()->widget(),
.config = _config,
.chooseLabel = tr::lng_maps_point_set(),
@@ -258,7 +263,7 @@ void Location::chooseOnMap() {
.callback = crl::guard(this, callback),
.quit = [] { Shortcuts::Launch(Shortcuts::Command::Quit); },
.storageId = session->local().resolveStorageIdBots(),
.closeRequests = controller()->content()->death(),
.closeRequests = death(),
});
}

View File

@@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "dialogs/ui/chat_search_empty.h" // Dialogs::SearchEmpty.
#include "lang/lang_instance.h"
#include "lang/lang_keys.h"
#include "lottie/lottie_icon.h"
#include "main/session/session_show.h"
#include "main/main_session.h"
#include "mtproto/mtproto_config.h"
@@ -41,6 +42,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_chat_helpers.h"
#include "styles/style_dialogs.h"
#include "styles/style_window.h"
#include "styles/style_settings.h" // settingsCloudPasswordIconSize
#include "styles/style_layers.h" // boxDividerHeight
#include <QtCore/QFile>
#include <QtCore/QJsonDocument>
@@ -185,11 +188,12 @@ private:
[[nodiscard]] object_ptr<RpWidget> MakeFoursquarePromo() {
auto result = object_ptr<RpWidget>((QWidget*)nullptr);
const auto skip = st::defaultVerticalListSkip;
const auto raw = result.data();
raw->resize(0, st::pickLocationPromoHeight);
raw->resize(0, skip + st::pickLocationPromoHeight);
const auto shadow = CreateChild<PlainShadow>(raw);
raw->widthValue() | rpl::start_with_next([=](int width) {
shadow->setGeometry(0, 0, width, st::lineWidth);
shadow->setGeometry(0, skip, width, st::lineWidth);
}, raw->lifetime());
raw->paintRequest() | rpl::start_with_next([=](QRect clip) {
auto p = QPainter(raw);
@@ -197,7 +201,7 @@ private:
p.setPen(st::windowSubTextFg);
p.setFont(st::normalFont);
p.drawText(
raw->rect(),
raw->rect().marginsRemoved({ 0, skip, 0, 0 }),
tr::lng_maps_venues_source(tr::now),
style::al_center);
}, raw->lifetime());
@@ -294,6 +298,10 @@ void VenuesController::rowPaintIcon(
QSize(inner, inner) * ratio,
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation);
if (!data.icon.isNull()) {
data.icon = data.icon.convertToFormat(
QImage::Format_ARGB32_Premultiplied);
}
}
}
@@ -544,7 +552,7 @@ void SetupEmptyView(
(query ? Icon::NoResults : Icon::Search),
(query
? tr::lng_maps_no_places
: tr::lng_maps_choose_to_search)(Ui::Text::WithEntities));
: tr::lng_maps_choose_to_search)(Text::WithEntities));
view->setMinimalHeight(st::recentPeersEmptyHeightMin);
view->show();
@@ -636,6 +644,96 @@ void SetupVenues(
return result;
}
not_null<RpWidget*> SetupMapPlaceholder(
not_null<RpWidget*> parent,
int minHeight,
int maxHeight,
Fn<void()> choose) {
const auto result = CreateChild<RpWidget>(parent);
const auto top = CreateChild<BoxContentDivider>(result);
const auto bottom = CreateChild<BoxContentDivider>(result);
const auto icon = CreateChild<RpWidget>(result);
const auto iconSize = st::settingsCloudPasswordIconSize;
auto ownedLottie = Lottie::MakeIcon({
.name = u"location"_q,
.sizeOverride = { iconSize, iconSize },
.limitFps = true,
});
const auto lottie = ownedLottie.get();
icon->lifetime().add([kept = std::move(ownedLottie)] {});
icon->paintRequest(
) | rpl::start_with_next([=] {
auto p = QPainter(icon);
const auto left = (icon->width() - iconSize) / 2;
const auto scale = icon->height() / float64(iconSize);
auto hq = std::optional<PainterHighQualityEnabler>();
if (scale < 1.) {
const auto center = QPointF(
icon->width() / 2.,
icon->height() / 2.);
hq.emplace(p);
p.translate(center);
p.scale(scale, scale);
p.translate(-center);
p.setOpacity(scale);
}
lottie->paint(p, left, 0);
}, icon->lifetime());
InvokeQueued(icon, [=] {
const auto till = lottie->framesCount() - 1;
lottie->animate([=] { icon->update(); }, 0, till);
});
const auto button = CreateChild<RoundButton>(
result,
tr::lng_maps_select_on_map(),
st::pickLocationChooseOnMap);
button->setFullRadius(true);
button->setTextTransform(RoundButton::TextTransform::NoTransform);
button->setClickedCallback(choose);
parent->sizeValue() | rpl::start_with_next([=](QSize size) {
result->setGeometry(QRect(QPoint(), size));
const auto width = size.width();
top->setGeometry(0, 0, width, top->height());
bottom->setGeometry(QRect(
QPoint(0, size.height() - bottom->height()),
QSize(width, bottom->height())));
const auto dividers = top->height() + bottom->height();
const auto ratio = (size.height() - minHeight)
/ float64(maxHeight - minHeight);
const auto iconHeight = int(base::SafeRound(ratio * iconSize));
const auto available = size.height() - dividers;
const auto maxDelta = (maxHeight
- dividers
- iconSize
- button->height()) / 2;
const auto minDelta = (minHeight - dividers - button->height()) / 2;
const auto delta = anim::interpolate(minDelta, maxDelta, ratio);
button->move(
(width - button->width()) / 2,
size.height() - bottom->height() - delta - button->height());
const auto wide = available - delta - button->height();
const auto skip = (wide - iconHeight) / 2;
icon->setGeometry(0, top->height() + skip, width, iconHeight);
}, result->lifetime());
top->show();
icon->show();
bottom->show();
result->show();
return result;
}
} // namespace
LocationPicker::LocationPicker(Descriptor &&descriptor)
@@ -646,6 +744,8 @@ LocationPicker::LocationPicker(Descriptor &&descriptor)
, _body((_window->setInnerSize(st::pickLocationWindow)
, _window->showInner(base::make_unique_q<RpWidget>(_window.get()))
, _window->inner()))
, _chooseButtonLabel(std::move(descriptor.chooseLabel))
, _webviewStorageId(descriptor.storageId)
, _updateStyles([=] {
const auto str = EscapeForScriptString(ComputeStyles());
if (_webview) {
@@ -684,7 +784,6 @@ bool LocationPicker::Available(const LocationPickerConfig &config) {
void LocationPicker::setup(const Descriptor &descriptor) {
setupWindow(descriptor);
setupWebview(descriptor);
_initialProvided = descriptor.initial;
const auto initial = _initialProvided.exact()
@@ -695,6 +794,9 @@ void LocationPicker::setup(const Descriptor &descriptor) {
resolveAddress(initial);
venuesSearchEnableAt(initial);
}
if (!_initialProvided) {
resolveCurrentLocation();
}
}
void LocationPicker::setupWindow(const Descriptor &descriptor) {
@@ -714,6 +816,15 @@ void LocationPicker::setupWindow(const Descriptor &descriptor) {
parent.y() + (parent.height() - window->height()) / 2);
_container = CreateChild<RpWidget>(_body.get());
_mapPlaceholderAdded = st::pickLocationButtonSkip
+ st::pickLocationButton.height
+ st::pickLocationButtonSkip
+ st::boxDividerHeight;
const auto min = st::pickLocationCollapsedHeight + _mapPlaceholderAdded;
const auto max = st::pickLocationMapHeight + _mapPlaceholderAdded;
_mapPlaceholder = SetupMapPlaceholder(_container, min, max, [=] {
setupWebview();
});
_scroll = CreateChild<ScrollArea>(_body.get());
const auto controls = _scroll->setOwnedWidget(
object_ptr<VerticalLayout>(_scroll));
@@ -727,17 +838,6 @@ void LocationPicker::setupWindow(const Descriptor &descriptor) {
const auto toppad = mapControls->add(object_ptr<RpWidget>(controls));
const auto button = mapControls->add(
MakeChooseLocationButton(
mapControls,
std::move(descriptor.chooseLabel),
_geocoderAddress.value()),
{ 0, st::pickLocationButtonSkip, 0, st::pickLocationButtonSkip });
button->setClickedCallback([=] {
_webview->eval("LocationPicker.send();");
});
AddDivider(mapControls);
AddSkip(mapControls);
AddSubsectionTitle(mapControls, tr::lng_maps_or_choose());
@@ -757,7 +857,9 @@ void LocationPicker::setupWindow(const Descriptor &descriptor) {
const auto sub = std::min(
(st::pickLocationMapHeight - st::pickLocationCollapsedHeight),
scrollTop);
const auto mapHeight = st::pickLocationMapHeight - sub;
const auto mapHeight = st::pickLocationMapHeight
- sub
+ (_mapPlaceholder ? _mapPlaceholderAdded : 0);
_container->setGeometry(0, 0, width, mapHeight);
const auto scrollWidgetTop = search ? 0 : mapHeight;
const auto scrollHeight = height - scrollWidgetTop;
@@ -771,21 +873,52 @@ void LocationPicker::setupWindow(const Descriptor &descriptor) {
}, _container->lifetime());
_container->show();
_scroll->hide();
_scroll->show();
controls->show();
button->show();
window->show();
}
void LocationPicker::setupWebview(const Descriptor &descriptor) {
void LocationPicker::setupWebview() {
Expects(!_webview);
delete base::take(_mapPlaceholder);
const auto mapControls = _mapControlsWrap->entity();
mapControls->insert(
1,
object_ptr<BoxContentDivider>(mapControls)
)->show();
_mapButton = mapControls->insert(
1,
MakeChooseLocationButton(
mapControls,
_chooseButtonLabel.value(),
_geocoderAddress.value()),
{ 0, st::pickLocationButtonSkip, 0, st::pickLocationButtonSkip });
_mapButton->setClickedCallback([=] {
_webview->eval("LocationPicker.send();");
});
_mapButton->hide();
_scroll->scrollToY(0);
_venuesSearchShown.force_assign(_venuesSearchShown.current());
_mapLoading = CreateChild<RpWidget>(_body.get());
_container->geometryValue() | rpl::start_with_next([=](QRect rect) {
_mapLoading->setGeometry(rect);
}, _mapLoading->lifetime());
SetupLoadingView(_mapLoading);
_mapLoading->show();
const auto window = _window.get();
_webview = std::make_unique<Webview::Window>(
_container,
Webview::WindowConfig{
.opaqueBg = st::windowBg->c,
.storageId = descriptor.storageId,
.storageId = _webviewStorageId,
.dataProtocolOverride = kProtocolOverride,
});
const auto raw = _webview.get();
@@ -823,12 +956,6 @@ void LocationPicker::setupWebview(const Descriptor &descriptor) {
const auto event = object.value("event").toString();
if (event == u"ready"_q) {
mapReady();
if (!_initialProvided) {
resolveCurrentLocation();
}
if (_webview) {
_webview->focus();
}
} else if (event == u"keydown"_q) {
const auto key = object.value("key").toString();
const auto modifier = object.value("modifier").toString();
@@ -968,6 +1095,8 @@ void LocationPicker::resolveAddress(Core::GeoLocation location) {
void LocationPicker::mapReady() {
Expects(_scroll != nullptr);
delete base::take(_mapLoading);
const auto token = _config.mapsToken.toUtf8();
const auto center = DefaultCenter(_initialProvided);
const auto bounds = DefaultBounds();
@@ -980,7 +1109,11 @@ void LocationPicker::mapReady() {
+ ", protocol: " + protocol;
_webview->eval("LocationPicker.init({ " + params + " });");
_scroll->show();
const auto handle = _window->window()->windowHandle();
if (handle && QGuiApplication::focusWindow() == handle) {
_webview->focus();
}
_mapButton->show();
}
bool LocationPicker::venuesFromCache(
@@ -1163,6 +1296,12 @@ void LocationPicker::processKey(
}
}
void LocationPicker::activate() {
if (_window) {
_window->activateWindow();
}
}
void LocationPicker::close() {
crl::on_main(this, [=] {
_window = nullptr;

View File

@@ -29,6 +29,7 @@ class Window;
namespace Ui {
class AbstractButton;
class SeparatePanel;
class RpWidget;
class ScrollArea;
@@ -93,6 +94,7 @@ public:
[[nodiscard]] static bool Available(const LocationPickerConfig &config);
static not_null<LocationPicker*> Show(Descriptor &&descriptor);
void activate();
void close();
void minimize();
void quit();
@@ -109,7 +111,7 @@ private:
void setup(const Descriptor &descriptor);
void setupWindow(const Descriptor &descriptor);
void setupWebview(const Descriptor &descriptor);
void setupWebview();
void processKey(const QString &key, const QString &modifier);
void resolveCurrentLocation();
void resolveAddressByTimer();
@@ -129,11 +131,17 @@ private:
std::unique_ptr<SeparatePanel> _window;
not_null<RpWidget*> _body;
RpWidget *_container = nullptr;
RpWidget *_mapPlaceholder = nullptr;
RpWidget *_mapLoading = nullptr;
AbstractButton *_mapButton = nullptr;
SlideWrap<VerticalLayout> *_mapControlsWrap = nullptr;
rpl::variable<QString> _chooseButtonLabel;
ScrollArea *_scroll = nullptr;
Webview::StorageId _webviewStorageId;
std::unique_ptr<Webview::Window> _webview;
SingleQueuedInvokation _updateStyles;
Core::GeoLocation _initialProvided;
int _mapPlaceholderAdded = 0;
bool _subscribedToColors = false;
base::Timer _geocoderResolveTimer;

View File

@@ -577,6 +577,8 @@ void SessionNavigation::showPeerByLinkResolved(
info.messageId,
commentId->id,
params);
} else if (resolveType == ResolveType::Profile) {
showPeerInfo(peer, params);
} else if (peer->isForum() && resolveType != ResolveType::Boost) {
const auto itemId = info.messageId;
if (!itemId) {

View File

@@ -22,6 +22,7 @@ enum class ResolveType {
ShareGame,
Mention,
Boost,
Profile,
};
struct CommentId {

View File

@@ -42,7 +42,7 @@ FROM builder AS patches
RUN git init patches \
&& cd patches \
&& git remote add origin {{ GIT }}/desktop-app/patches.git \
&& git fetch --depth=1 origin 6898f0d215f249917c076f00d3fc954a43f35e6a \
&& git fetch --depth=1 origin 85a1c4ec327ed390a27e85f2162c31525220a50d \
&& git reset --hard FETCH_HEAD \
&& rm -rf .git
@@ -771,7 +771,7 @@ COPY --link --from=pipewire {{ LibrariesPath }}/pipewire-cache /
RUN git init tg_owt \
&& cd tg_owt \
&& git remote add origin {{ GIT }}/desktop-app/tg_owt.git \
&& git fetch --depth=1 origin 996dbe2c83b5a71d9045ce47960b8432e223dbb3 \
&& git fetch --depth=1 origin 4a60ce1ab9fdb962004c6a959f682ace3db50cbd \
&& git reset --hard FETCH_HEAD \
&& git submodule update --init --recursive --depth=1 \
&& rm -rf .git \

View File

@@ -457,7 +457,7 @@ if customRunCommand:
stage('patches', """
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 6898f0d215
git checkout 85a1c4ec32
""")
stage('msys64', """
@@ -1718,7 +1718,7 @@ win:
stage('tg_owt', """
git clone https://github.com/desktop-app/tg_owt.git
cd tg_owt
git checkout 996dbe2c83
git checkout 4a60ce1ab9
git submodule init
git submodule update
win:

View File

@@ -1,7 +1,7 @@
AppVersion 5002004
AppVersion 5002006
AppVersionStrMajor 5.2
AppVersionStrSmall 5.2.4
AppVersionStr 5.2.4
AppVersionStrSmall 5.2.6
AppVersionStr 5.2.6
BetaChannel 1
AlphaVersion 0
AppVersionOriginal 5.2.4.beta
AppVersionOriginal 5.2.6.beta

View File

@@ -1,3 +1,12 @@
5.2.6 beta (29.07.24)
- Fix launching on X11. (Linux)
5.2.5 beta (27.07.24)
- Fix media viewer context menu.
- Fix blockquotes layout in messages.
5.2.4 beta (24.07.24)
- Allow opening several web apps.

View File

@@ -165,7 +165,7 @@ parts:
patches:
source: https://github.com/desktop-app/patches.git
source-depth: 1
source-commit: 6898f0d215f249917c076f00d3fc954a43f35e6a
source-commit: 85a1c4ec327ed390a27e85f2162c31525220a50d
plugin: dump
override-pull: |
craftctl default
@@ -433,7 +433,7 @@ parts:
webrtc:
source: https://github.com/desktop-app/tg_owt.git
source-depth: 1
source-commit: 996dbe2c83b5a71d9045ce47960b8432e223dbb3
source-commit: 4a60ce1ab9fdb962004c6a959f682ace3db50cbd
plugin: cmake
build-environment:
- LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s