Compare commits

...

15 Commits

Author SHA1 Message Date
John Preston
f75429cbaa Version 5.2.1: Shorten webview socket path.
Fixes #28106.
2024-07-01 21:35:39 +04:00
John Preston
dc8c4a8332 Version 5.2.1: No auto-enable system password unlock on macOS. 2024-07-01 21:03:05 +04:00
John Preston
096530c96a Version 5.2.1: Fix drafts / translations crash on macOS. 2024-07-01 19:21:27 +04:00
23rd
ed0850d823 Renamed files for bot and channel earn sections with different names. 2024-07-01 15:40:39 +03:00
John Preston
4a2173deaf Version 5.2.1.
- Fix crash when opening topic in a new window.
- Fix crash in topic search scope dropdown.
- Fix crash in video player.
- Fix feeze and crash in Instant View (Windows).
- Allow unlock by Apple Watch or System Password (macOS).
2024-07-01 15:01:35 +04:00
John Preston
f40a584905 Support unlock with Watch/SystemPassword. 2024-07-01 15:01:35 +04:00
John Preston
e54204b136 Don't allow forwarding local items by drag. 2024-07-01 13:20:45 +04:00
John Preston
715dff0a3e Fix a crash and a memory leak in video player.
Fixes #28104.
2024-07-01 11:03:19 +04:00
23rd
558daa3382 Fixed align of icons in list of top-up credit options. 2024-07-01 10:50:52 +04:00
GitHub Action
7265297b19 Update User-Agent for DNS to Chrome 126.0.0.0. 2024-07-01 10:49:45 +04:00
John Preston
1fac6db8bd Fix crash in topic search context menu destruction. 2024-07-01 10:46:34 +04:00
John Preston
c9bd776d1e Fix freeze in IV due to cyclic focus request. 2024-07-01 10:38:41 +04:00
John Preston
179e81478e Ignore filter switching in separate window archive. 2024-07-01 09:21:18 +04:00
John Preston
9ef74c510c Fix crash in opening topics in a new window. 2024-07-01 09:07:45 +04:00
Ilya Fedin
36f6917bd3 Query QWindow::windowState in media viewer 2024-07-01 07:56:55 +04:00
39 changed files with 272 additions and 133 deletions

View File

@@ -890,10 +890,10 @@ PRIVATE
history/history_view_highlight_manager.h
history/history_widget.cpp
history/history_widget.h
info/bot/earn/info_earn_inner_widget.cpp
info/bot/earn/info_earn_inner_widget.h
info/bot/earn/info_earn_widget.cpp
info/bot/earn/info_earn_widget.h
info/bot/earn/info_bot_earn_list.cpp
info/bot/earn/info_bot_earn_list.h
info/bot/earn/info_bot_earn_widget.cpp
info/bot/earn/info_bot_earn_widget.h
info/channel_statistics/boosts/create_giveaway_box.cpp
info/channel_statistics/boosts/create_giveaway_box.h
info/channel_statistics/boosts/giveaway/giveaway_list_controllers.cpp
@@ -902,10 +902,10 @@ PRIVATE
info/channel_statistics/boosts/info_boosts_inner_widget.h
info/channel_statistics/boosts/info_boosts_widget.cpp
info/channel_statistics/boosts/info_boosts_widget.h
info/channel_statistics/earn/info_earn_inner_widget.cpp
info/channel_statistics/earn/info_earn_inner_widget.h
info/channel_statistics/earn/info_earn_widget.cpp
info/channel_statistics/earn/info_earn_widget.h
info/channel_statistics/earn/info_channel_earn_list.cpp
info/channel_statistics/earn/info_channel_earn_list.h
info/channel_statistics/earn/info_channel_earn_widget.cpp
info/channel_statistics/earn/info_channel_earn_widget.h
info/common_groups/info_common_groups_inner_widget.cpp
info/common_groups/info_common_groups_inner_widget.h
info/common_groups/info_common_groups_widget.cpp

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

View File

@@ -687,6 +687,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_use_winhello_about" = "You need to enter your passcode once before unlocking Telegram with Windows Hello.";
"lng_settings_use_touchid" = "Unlock with Touch ID";
"lng_settings_use_touchid_about" = "You need to enter your passcode once before unlocking Telegram with Touch ID.";
"lng_settings_use_applewatch" = "Unlock with Apple Watch";
"lng_settings_use_applewatch_about" = "You need to enter your passcode once before unlocking Telegram with Apple Watch.";
"lng_settings_use_systempwd" = "Unlock with System Password";
"lng_settings_use_systempwd_about" = "You need to enter your passcode once before unlocking Telegram with System Password.";
"lng_settings_password_disable" = "Disable Cloud Password";
"lng_settings_password_abort" = "Abort two-step verification setup";
"lng_settings_about_bio" = "Any details such as age, occupation or city.\nExample: 23 y.o. designer from San Francisco";
@@ -998,6 +1002,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_passcode_logout" = "Log out";
"lng_passcode_winhello" = "You need to enter your passcode\nbefore you can use Windows Hello.";
"lng_passcode_touchid" = "You need to enter your passcode\nbefore you can use Touch ID.";
"lng_passcode_applewatch" = "You need to enter your passcode\nbefore you can use Watch to unlock.";
"lng_passcode_systempwd" = "You need to enter your passcode\nbefore you can use system password.";
"lng_passcode_winhello_unlock" = "Telegram wants to unlock with Windows Hello.";
"lng_passcode_touchid_unlock" = "unlock";
"lng_passcode_create_button" = "Save Passcode";

View File

@@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="5.2.0.0" />
Version="5.2.1.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,0,0
PRODUCTVERSION 5,2,0,0
FILEVERSION 5,2,1,0
PRODUCTVERSION 5,2,1,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.0.0"
VALUE "FileVersion", "5.2.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.2.0.0"
VALUE "ProductVersion", "5.2.1.0"
END
END
BLOCK "VarFileInfo"

View File

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

View File

@@ -293,6 +293,8 @@ passcodeSkip: 23px;
passcodeSystemUnlock: IconButton(defaultIconButton) {
width: 32px;
height: 36px;
icon: icon{{ "menu/passcode_winhello", lightButtonFg }};
iconOver: icon{{ "menu/passcode_winhello", lightButtonFg }};
iconPosition: point(4px, 4px);
rippleAreaSize: 32px;
rippleAreaPosition: point(0px, 0px);
@@ -300,14 +302,9 @@ passcodeSystemUnlock: IconButton(defaultIconButton) {
color: lightButtonBgOver;
}
}
passcodeSystemWinHello: IconButton(passcodeSystemUnlock) {
icon: icon{{ "menu/passcode_winhello", lightButtonFg }};
iconOver: icon{{ "menu/passcode_winhello", lightButtonFg }};
}
passcodeSystemTouchID: IconButton(passcodeSystemUnlock) {
icon: icon{{ "menu/passcode_finger", lightButtonFg }};
iconOver: icon{{ "menu/passcode_finger", lightButtonFg }};
}
passcodeSystemTouchID: icon{{ "menu/passcode_finger", lightButtonFg }};
passcodeSystemAppleWatch: icon{{ "menu/passcode_watch", lightButtonFg }};
passcodeSystemSystemPwd: icon{{ "menu/permissions", lightButtonFg }};
passcodeSystemUnlockLater: FlatLabel(defaultFlatLabel) {
align: align(top);
textFg: windowSubTextFg;

View File

@@ -43,7 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_premium_limits.h"
#include "data/data_user.h"
#include "history/admin_log/history_admin_log_section.h"
#include "info/bot/earn/info_earn_widget.h"
#include "info/bot/earn/info_bot_earn_widget.h"
#include "info/channel_statistics/boosts/info_boosts_widget.h"
#include "info/profile/info_profile_values.h"
#include "info/info_memento.h"

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 = 5002000;
constexpr auto AppVersionStr = "5.2";
constexpr auto AppVersion = 5002001;
constexpr auto AppVersionStr = "5.2.1";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -3690,6 +3690,9 @@ bool InnerWidget::chooseCollapsedRow(Qt::KeyboardModifiers modifiers) {
}
void InnerWidget::switchToFilter(FilterId filterId) {
if (_controller->windowId().type != Window::SeparateType::Primary) {
return;
}
const auto &list = session().data().chatsFilters().list();
const auto filterIt = filterId
? ranges::find(list, filterId, &Data::ChatFilter::id)

View File

@@ -29,6 +29,7 @@ public:
std::shared_ptr<Ui::DynamicImage> icon,
const QString &label,
bool chosen);
~Action();
bool isEnabled() const override;
not_null<QAction*> action() const override;
@@ -111,6 +112,10 @@ Action::Action(
enableMouseSelecting();
}
Action::~Action() {
_icon->subscribeToUpdates(nullptr);
}
void Action::resolveMinWidth() {
const auto maxWidth = st::dialogsSearchInPhotoPadding
+ st::dialogsSearchInPhotoSize

View File

@@ -1731,7 +1731,9 @@ std::unique_ptr<QMimeData> HistoryInner::prepareDrag() {
updateDragSelection(nullptr, nullptr, false);
_selectScroll.cancel();
if (!urls.isEmpty()) mimeData->setUrls(urls);
if (!urls.isEmpty()) {
mimeData->setUrls(urls);
}
if (uponSelected && !_controller->adaptive().isOneColumn()) {
auto selectedState = getSelectionState();
if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
@@ -1752,21 +1754,21 @@ std::unique_ptr<QMimeData> HistoryInner::prepareDrag() {
== forwardSelectionState.canForwardCount)) {
forwardIds = getSelectedItems();
} else if (_mouseCursorState == CursorState::Date) {
forwardIds = session().data().itemOrItsGroup(_mouseActionItem);
const auto item = _mouseActionItem;
if (item && item->allowsForward()) {
forwardIds = session().data().itemOrItsGroup(item);
}
} else if ((pressedView->isHiddenByGroup() && pressedHandler)
|| (pressedView->media()
&& pressedView->media()->dragItemByHandler(pressedHandler))) {
const auto item = _dragStateItem
? _dragStateItem
: _mouseActionItem;
forwardIds = MessageIdsList(1, item->fullId());
if (item && item->allowsForward()) {
forwardIds = MessageIdsList(1, item->fullId());
}
}
if (forwardIds.empty()) {
return nullptr;
}
session().data().setMimeForwardIds(std::move(forwardIds));
auto result = std::make_unique<QMimeData>();
result->setData(u"application/x-td-forward"_q, "1");
if (pressedHandler) {
const auto lnkDocument = reinterpret_cast<DocumentData*>(
pressedHandler->property(
@@ -1774,12 +1776,23 @@ std::unique_ptr<QMimeData> HistoryInner::prepareDrag() {
if (lnkDocument) {
const auto filepath = lnkDocument->filepath(true);
if (!filepath.isEmpty()) {
QList<QUrl> urls;
urls.push_back(QUrl::fromLocalFile(filepath));
result->setUrls(urls);
}
}
}
if (forwardIds.empty() && urls.isEmpty()) {
return nullptr;
}
auto result = std::make_unique<QMimeData>();
if (!forwardIds.empty()) {
session().data().setMimeForwardIds(std::move(forwardIds));
result->setData(u"application/x-td-forward"_q, "1");
}
if (!urls.isEmpty()) {
result->setUrls(urls);
}
return result;
}
return nullptr;

View File

@@ -3778,12 +3778,7 @@ std::unique_ptr<QMimeData> ListWidget::prepareDrag() {
forwardIds = MessageIdsList(1, exactItem->fullId());
}
}
if (forwardIds.empty()) {
return nullptr;
}
session().data().setMimeForwardIds(std::move(forwardIds));
auto result = std::make_unique<QMimeData>();
result->setData(u"application/x-td-forward"_q, "1");
if (pressedHandler) {
const auto lnkDocument = reinterpret_cast<DocumentData*>(
pressedHandler->property(
@@ -3791,12 +3786,23 @@ std::unique_ptr<QMimeData> ListWidget::prepareDrag() {
if (lnkDocument) {
const auto filepath = lnkDocument->filepath(true);
if (!filepath.isEmpty()) {
QList<QUrl> urls;
urls.push_back(QUrl::fromLocalFile(filepath));
result->setUrls(urls);
}
}
}
if (forwardIds.empty() && urls.isEmpty()) {
return nullptr;
}
auto result = std::make_unique<QMimeData>();
if (!forwardIds.empty()) {
session().data().setMimeForwardIds(std::move(forwardIds));
result->setData(u"application/x-td-forward"_q, "1");
}
if (!urls.isEmpty()) {
result->setUrls(urls);
}
return result;
}
return nullptr;

View File

@@ -5,7 +5,7 @@ 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 "info/bot/earn/info_earn_inner_widget.h"
#include "info/bot/earn/info_bot_earn_list.h"
#include "api/api_credits.h"
#include "api/api_filter_updates.h"
@@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_user.h"
#include "data/stickers/data_custom_emoji.h"
#include "info/bot/earn/info_earn_widget.h"
#include "info/bot/earn/info_bot_earn_widget.h"
#include "info/channel_statistics/earn/earn_format.h"
#include "info/info_controller.h"
#include "info/statistics/info_statistics_inner_widget.h" // FillLoading.

View File

@@ -5,9 +5,9 @@ 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 "info/bot/earn/info_earn_widget.h"
#include "info/bot/earn/info_bot_earn_widget.h"
#include "info/bot/earn/info_earn_inner_widget.h"
#include "info/bot/earn/info_bot_earn_list.h"
#include "info/info_controller.h"
#include "info/info_memento.h"
#include "lang/lang_keys.h"

View File

@@ -5,7 +5,7 @@ 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 "info/channel_statistics/earn/info_earn_inner_widget.h"
#include "info/channel_statistics/earn/info_channel_earn_list.h"
#include "api/api_credits.h"
#include "api/api_earn.h"
@@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/stickers/data_custom_emoji.h"
#include "history/view/controls/history_view_webpage_processor.h"
#include "info/channel_statistics/earn/earn_format.h"
#include "info/channel_statistics/earn/info_earn_widget.h"
#include "info/channel_statistics/earn/info_channel_earn_widget.h"
#include "info/info_controller.h"
#include "info/profile/info_profile_values.h" // Info::Profile::NameValue.
#include "info/statistics/info_statistics_inner_widget.h" // FillLoading.

View File

@@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "info/channel_statistics/earn/info_earn_widget.h"
#include "info/channel_statistics/earn/info_channel_earn_widget.h"
#include "ui/widgets/scroll_area.h"
#include "ui/wrap/vertical_layout.h"

View File

@@ -5,9 +5,9 @@ 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 "info/channel_statistics/earn/info_earn_widget.h"
#include "info/channel_statistics/earn/info_channel_earn_widget.h"
#include "info/channel_statistics/earn/info_earn_inner_widget.h"
#include "info/channel_statistics/earn/info_channel_earn_list.h"
#include "info/info_controller.h"
#include "info/info_memento.h"
#include "lang/lang_keys.h"

View File

@@ -342,9 +342,11 @@ void Controller::createWindow() {
_window = std::make_unique<Ui::RpWindow>();
const auto window = _window.get();
window->windowActiveValue(
) | rpl::filter([=](bool active) {
return _webview && active;
base::qt_signal_producer(
window->window()->windowHandle(),
&QWindow::activeChanged
) | rpl::filter([=] {
return _webview && window->window()->windowHandle()->isActive();
}) | rpl::start_with_next([=] {
setInnerFocus();
}, window->lifetime());

View File

@@ -403,6 +403,8 @@ bool Domain::removePasscodeIfEmpty() {
return false;
}
_local->setPasscode(QByteArray());
Core::App().settings().setSystemUnlockEnabled(false);
Core::App().saveSettingsDelayed();
return true;
}

View File

@@ -506,15 +506,15 @@ OverlayWidget::OverlayWidget()
return base::EventFilterResult::Cancel;
}
} else if (e->type() == QEvent::WindowStateChange) {
const auto state = _window->windowState();
if (state & Qt::WindowMinimized || Platform::IsMac()) {
} else if (state & Qt::WindowMaximized) {
const auto state = window()->windowState();
if (state == Qt::WindowMinimized || Platform::IsMac()) {
} else if (state == Qt::WindowMaximized) {
if (_fullscreen || _windowed) {
_fullscreen = _windowed = false;
savePosition();
}
} else if (_fullscreen || _windowed) {
} else if (state & Qt::WindowFullScreen) {
} else if (state == Qt::WindowFullScreen) {
_fullscreen = true;
savePosition();
} else {
@@ -3841,16 +3841,12 @@ void OverlayWidget::updatePowerSaveBlocker(
&& !IsPausedOrPausing(state.state)
&& !IsStoppedOrStopping(state.state);
_window->shownValue() | rpl::filter([=](bool shown) {
return shown;
}) | rpl::take(1) | rpl::start_with_next([=] {
base::UpdatePowerSaveBlocker(
_streamed->powerSaveBlocker,
block,
base::PowerSaveBlockType::PreventDisplaySleep,
[] { return u"Video playback is active"_q; },
[=] { return window(); });
}, lifetime());
base::UpdatePowerSaveBlocker(
_streamed->powerSaveBlocker,
block,
base::PowerSaveBlockType::PreventDisplaySleep,
[] { return u"Video playback is active"_q; },
[=] { return _window->windowHandle(); });
}
QImage OverlayWidget::transformedShownContent() const {

View File

@@ -65,7 +65,7 @@ QByteArray DnsUserAgent() {
static const auto kResult = QByteArray(
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/124.0.0.0 Safari/537.36");
"Chrome/126.0.0.0 Safari/537.36");
return kResult;
}

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/linux/specific_linux.h"
#include "base/openssl_help.h"
#include "base/random.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_dbus_utilities.h"
@@ -480,6 +481,16 @@ void InstallLauncher() {
});
}
[[nodiscard]] QByteArray HashForSocketPath(const QByteArray &data) {
constexpr auto kHashForSocketPathLength = 24;
const auto binary = openssl::Sha256(bytes::make_span(data));
const auto base64 = QByteArray(
reinterpret_cast<const char*>(binary.data()),
binary.size()).toBase64(QByteArray::Base64UrlEncoding);
return base64.mid(0, kHashForSocketPathLength);
}
} // namespace
namespace Platform {
@@ -686,8 +697,8 @@ void start() {
Webview::WebKitGTK::SetSocketPath(u"%1/%2-%3-webview-%4"_q.arg(
QDir::tempPath(),
h,
QCoreApplication::applicationName(),
HashForSocketPath(d),
u"TD"_q,//QCoreApplication::applicationName(), - make path smaller.
u"%1"_q).toStdString());
InstallLauncher();

View File

@@ -280,10 +280,7 @@ void FillCreditOptions(
inner->paintRequest(
) | rpl::start_with_next([=](const QRect &rect) {
auto p = QPainter(inner);
p.drawImage(
0,
(buttonHeight - stars.height()) / 2,
stars);
p.drawImage(0, 0, stars);
const auto textLeft = diffBetweenTextAndStar
+ stars.width() / style::DevicePixelRatio();
p.setPen(st.textFg);

View File

@@ -80,6 +80,7 @@ private:
rpl::event_stream<> _setInnerFocus;
rpl::event_stream<Type> _showOther;
rpl::event_stream<> _showBack;
bool _systemUnlockWithBiometric = false;
};
@@ -97,6 +98,13 @@ rpl::producer<QString> LocalPasscodeEnter::title() {
void LocalPasscodeEnter::setupContent() {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
base::SystemUnlockStatus(
true
) | rpl::start_with_next([=](base::SystemUnlockAvailability status) {
_systemUnlockWithBiometric = status.available
&& status.withBiometrics;
}, lifetime());
const auto isCreate = (enterType() == EnterType::Create);
const auto isCheck = (enterType() == EnterType::Check);
[[maybe_unused]] const auto isChange = (enterType() == EnterType::Change);
@@ -242,8 +250,10 @@ void LocalPasscodeEnter::setupContent() {
}
SetPasscode(_controller, newText);
if (isCreate) {
Core::App().settings().setSystemUnlockEnabled(true);
Core::App().saveSettingsDelayed();
if (Platform::IsWindows() || _systemUnlockWithBiometric) {
Core::App().settings().setSystemUnlockEnabled(true);
Core::App().saveSettingsDelayed();
}
_showOther.fire(LocalPasscodeManageId());
} else if (isChange) {
_showBack.fire({});
@@ -518,38 +528,77 @@ void LocalPasscodeManage::setupContent() {
)->setDuration(0);
const auto systemUnlockContent = systemUnlockWrap->entity();
Ui::AddSkip(systemUnlockContent);
enum class UnlockType {
None,
Default,
Biometrics,
Companion,
};
const auto unlockType = systemUnlockContent->lifetime().make_state<
rpl::variable<UnlockType>
>(base::SystemUnlockStatus(
true
) | rpl::map([](base::SystemUnlockAvailability status) {
return status.withBiometrics
? UnlockType::Biometrics
: status.withCompanion
? UnlockType::Companion
: status.available
? UnlockType::Default
: UnlockType::None;
}));
unlockType->value(
) | rpl::start_with_next([=](UnlockType type) {
while (systemUnlockContent->count()) {
delete systemUnlockContent->widgetAt(0);
}
Ui::AddSkip(systemUnlockContent);
AddButtonWithIcon(
systemUnlockContent,
(Platform::IsWindows()
? tr::lng_settings_use_winhello()
: (type == UnlockType::Biometrics)
? tr::lng_settings_use_touchid()
: (type == UnlockType::Companion)
? tr::lng_settings_use_applewatch()
: tr::lng_settings_use_systempwd()),
st::settingsButton,
{ Platform::IsWindows()
? &st::menuIconWinHello
: (type == UnlockType::Biometrics)
? &st::menuIconTouchID
: (type == UnlockType::Companion)
? &st::menuIconAppleWatch
: &st::menuIconSystemPwd }
)->toggleOn(
rpl::single(Core::App().settings().systemUnlockEnabled())
)->toggledChanges(
) | rpl::filter([=](bool value) {
return value != Core::App().settings().systemUnlockEnabled();
}) | rpl::start_with_next([=](bool value) {
Core::App().settings().setSystemUnlockEnabled(value);
Core::App().saveSettingsDelayed();
}, systemUnlockContent->lifetime());
Ui::AddSkip(systemUnlockContent);
Ui::AddDividerText(
systemUnlockContent,
(Platform::IsWindows()
? tr::lng_settings_use_winhello_about()
: (type == UnlockType::Biometrics)
? tr::lng_settings_use_touchid_about()
: (type == UnlockType::Companion)
? tr::lng_settings_use_applewatch_about()
: tr::lng_settings_use_systempwd_about()));
AddButtonWithIcon(
systemUnlockContent,
(Platform::IsWindows()
? tr::lng_settings_use_winhello()
: tr::lng_settings_use_touchid()),
st::settingsButton,
{ Platform::IsWindows()
? &st::menuIconWinHello
: &st::menuIconTouchID }
)->toggleOn(
rpl::single(Core::App().settings().systemUnlockEnabled())
)->toggledChanges(
) | rpl::filter([=](bool value) {
return value != Core::App().settings().systemUnlockEnabled();
}) | rpl::start_with_next([=](bool value) {
Core::App().settings().setSystemUnlockEnabled(value);
Core::App().saveSettingsDelayed();
}, systemUnlockContent->lifetime());
Ui::AddSkip(systemUnlockContent);
Ui::AddDividerText(
systemUnlockContent,
(Platform::IsWindows()
? tr::lng_settings_use_winhello_about()
: tr::lng_settings_use_touchid_about()));
using namespace rpl::mappers;
systemUnlockWrap->toggleOn(base::SystemUnlockStatus(
) | rpl::map(_1 == base::SystemUnlockAvailability::Available));
systemUnlockWrap->toggleOn(unlockType->value(
) | rpl::map(rpl::mappers::_1 != UnlockType::None));
Ui::ResizeFitChild(this, content);
}
@@ -562,6 +611,8 @@ QPointer<Ui::RpWidget> LocalPasscodeManage::createPinnedToBottom(
.text = tr::lng_settings_passcode_disable_sure(),
.confirmed = [=](Fn<void()> &&close) {
SetPasscode(_controller, QString());
Core::App().settings().setSystemUnlockEnabled(false);
Core::App().saveSettingsDelayed();
close();
_showBack.fire({});

View File

@@ -157,6 +157,8 @@ menuIconFont: icon {{ "menu/fonts", menuIconColor }};
menuIconFactcheck: icon {{ "menu/factcheck", menuIconColor }};
menuIconWinHello: icon {{ "menu/passcode_winhello", menuIconColor }};
menuIconTouchID: icon {{ "menu/passcode_finger", menuIconColor }};
menuIconAppleWatch: icon {{ "menu/passcode_watch", menuIconColor }};
menuIconSystemPwd: menuIconPermissions;
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};
menuIconTTLAnyTextPosition: point(11px, 22px);

View File

@@ -110,8 +110,17 @@ PasscodeLockWidget::PasscodeLockWidget(
using namespace rpl::mappers;
if (Core::App().settings().systemUnlockEnabled()) {
_systemUnlockAvailable = base::SystemUnlockStatus()
| rpl::map(_1 == base::SystemUnlockAvailability::Available);
_systemUnlockAvailable = base::SystemUnlockStatus(
true
) | rpl::map([](base::SystemUnlockAvailability status) {
return status.withBiometrics
? SystemUnlockType::Biometrics
: status.withCompanion
? SystemUnlockType::Companion
: status.available
? SystemUnlockType::Default
: SystemUnlockType::None;
});
if (Core::App().domain().started()) {
_systemUnlockAllowed = _systemUnlockAvailable.value();
setupSystemUnlock();
@@ -122,11 +131,22 @@ PasscodeLockWidget::PasscodeLockWidget(
}
void PasscodeLockWidget::setupSystemUnlockInfo() {
const auto macos = [&] {
return _systemUnlockAvailable.value(
) | rpl::map([](SystemUnlockType type) {
return (type == SystemUnlockType::Biometrics)
? tr::lng_passcode_touchid()
: (type == SystemUnlockType::Companion)
? tr::lng_passcode_applewatch()
: tr::lng_passcode_systempwd();
}) | rpl::flatten_latest();
};
auto text = Platform::IsWindows()
? tr::lng_passcode_winhello()
: macos();
const auto info = Ui::CreateChild<Ui::FlatLabel>(
this,
(Platform::IsWindows()
? tr::lng_passcode_winhello()
: tr::lng_passcode_touchid()),
std::move(text),
st::passcodeSystemUnlockLater);
_logout->geometryValue(
) | rpl::start_with_next([=](QRect logout) {
@@ -137,7 +157,8 @@ void PasscodeLockWidget::setupSystemUnlockInfo() {
st::boxRowPadding.left(),
logout.y() + logout.height() + st::passcodeSystemUnlockSkip);
}, info->lifetime());
info->showOn(_systemUnlockAvailable.value());
info->showOn(_systemUnlockAvailable.value(
) | rpl::map(rpl::mappers::_1 != SystemUnlockType::None));
}
void PasscodeLockWidget::setupSystemUnlock() {
@@ -152,10 +173,21 @@ void PasscodeLockWidget::setupSystemUnlock() {
const auto button = Ui::CreateChild<Ui::IconButton>(
_passcode.data(),
(Platform::IsWindows()
? st::passcodeSystemWinHello
: st::passcodeSystemTouchID));
button->showOn(_systemUnlockAllowed.value());
st::passcodeSystemUnlock);
if (!Platform::IsWindows()) {
using namespace base;
_systemUnlockAllowed.value(
) | rpl::start_with_next([=](SystemUnlockType type) {
const auto icon = (type == SystemUnlockType::Biometrics)
? &st::passcodeSystemTouchID
: (type == SystemUnlockType::Companion)
? &st::passcodeSystemAppleWatch
: &st::passcodeSystemSystemPwd;
button->setIconOverride(icon, icon);
}, button->lifetime());
}
button->showOn(_systemUnlockAllowed.value(
) | rpl::map(rpl::mappers::_1 != SystemUnlockType::None));
_passcode->sizeValue() | rpl::start_with_next([=](QSize size) {
button->moveToRight(0, size.height() - button->height());
}, button->lifetime());
@@ -177,7 +209,7 @@ void PasscodeLockWidget::suggestSystemUnlock() {
using namespace base;
_systemUnlockAllowed.value(
) | rpl::filter(
rpl::mappers::_1
rpl::mappers::_1 != SystemUnlockType::None
) | rpl::take(1) | rpl::start_with_next([=] {
const auto weak = Ui::MakeWeak(this);
const auto done = [weak](SystemUnlockResult result) {

View File

@@ -65,6 +65,13 @@ protected:
void resizeEvent(QResizeEvent *e) override;
private:
enum class SystemUnlockType : uchar {
None,
Default,
Biometrics,
Companion,
};
void paintContent(QPainter &p) override;
void setupSystemUnlockInfo();
@@ -75,8 +82,8 @@ private:
void submit();
void error();
rpl::variable<bool> _systemUnlockAvailable = false;
rpl::variable<bool> _systemUnlockAllowed = false;
rpl::variable<SystemUnlockType> _systemUnlockAvailable;
rpl::variable<SystemUnlockType> _systemUnlockAllowed;
object_ptr<Ui::PasswordInput> _passcode;
object_ptr<Ui::RoundButton> _submit;
object_ptr<Ui::LinkButton> _logout;

View File

@@ -67,7 +67,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/info_controller.h"
#include "info/info_memento.h"
#include "info/channel_statistics/boosts/info_boosts_widget.h"
#include "info/channel_statistics/earn/info_earn_widget.h"
#include "info/channel_statistics/earn/info_channel_earn_widget.h"
#include "info/profile/info_profile_values.h"
#include "info/statistics/info_statistics_widget.h"
#include "info/stories/info_stories_widget.h"
@@ -689,8 +689,9 @@ void Filler::addNewWindow() {
_addAction(tr::lng_context_new_window(tr::now), [=] {
Ui::PreventDelayedActivation();
if (const auto strong = weak.get()) {
const auto forum = !strong->asTopic() && peer->isForum();
controller->showInNewWindow(SeparateId(
peer->isForum() ? SeparateType::Forum : SeparateType::Chat,
forum ? SeparateType::Forum : SeparateType::Chat,
strong));
}
}, &st::menuIconNewWindow);

View File

@@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_controller.h"
#include "window/window_filters_menu.h"
#include "window/window_separate_id.h"
#include "info/channel_statistics/earn/info_earn_inner_widget.h"
#include "info/channel_statistics/earn/info_channel_earn_list.h"
#include "info/info_memento.h"
#include "info/info_controller.h"
#include "inline_bots/bot_attach_web_view.h"

View File

@@ -1,7 +1,7 @@
AppVersion 5002000
AppVersion 5002001
AppVersionStrMajor 5.2
AppVersionStrSmall 5.2
AppVersionStr 5.2.0
AppVersionStrSmall 5.2.1
AppVersionStr 5.2.1
BetaChannel 0
AlphaVersion 0
AppVersionOriginal 5.2
AppVersionOriginal 5.2.1

View File

@@ -1,3 +1,11 @@
5.2.1 (01.07.24)
- Fix crash when opening topic in a new window.
- Fix crash in topic search scope dropdown.
- Fix crash in video player.
- Fix feeze and crash in Instant View (Windows).
- Allow unlock by Apple Watch or System Password (macOS).
5.2 (30.06.24)
- Pay for content with Telegram Stars.