From 36f6917bd349b376c0808be33f4870afb9a8d4ea Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 1 Jul 2024 07:23:57 +0400 Subject: [PATCH 01/22] Query QWindow::windowState in media viewer --- .../SourceFiles/media/view/media_view_overlay_widget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index a6320b61ea..d8e474e525 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -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 { From 9ef74c510c2f24a7ca03de6a8a2156bf39a59bef Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 09:07:45 +0400 Subject: [PATCH 02/22] Fix crash in opening topics in a new window. --- Telegram/SourceFiles/window/window_peer_menu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 712e022b08..19b2d2580e 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -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); From 179e81478e09246146c1966b7d6a206431ebe080 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 09:21:18 +0400 Subject: [PATCH 03/22] Ignore filter switching in separate window archive. --- Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 1ac569e9cc..cb33e8a9a2 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -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) From c9bd776d1e854da24fdf7477fa5a296e0e4389eb Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 10:38:41 +0400 Subject: [PATCH 04/22] Fix freeze in IV due to cyclic focus request. --- Telegram/SourceFiles/iv/iv_controller.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/iv/iv_controller.cpp b/Telegram/SourceFiles/iv/iv_controller.cpp index baad49dd18..3b30dc6dbb 100644 --- a/Telegram/SourceFiles/iv/iv_controller.cpp +++ b/Telegram/SourceFiles/iv/iv_controller.cpp @@ -342,9 +342,11 @@ void Controller::createWindow() { _window = std::make_unique(); 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()); From 1fac6db8bd94aa9b7ac1f6e669c9ada5973973fd Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 10:46:34 +0400 Subject: [PATCH 05/22] Fix crash in topic search context menu destruction. --- Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp b/Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp index 5fcc8f78b6..42e8c33d78 100644 --- a/Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp +++ b/Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp @@ -29,6 +29,7 @@ public: std::shared_ptr icon, const QString &label, bool chosen); + ~Action(); bool isEnabled() const override; not_null 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 From 7265297b197e152102491057d066e04e992e667b Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 1 Jul 2024 00:28:25 +0000 Subject: [PATCH 06/22] Update User-Agent for DNS to Chrome 126.0.0.0. --- .../SourceFiles/mtproto/details/mtproto_domain_resolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp b/Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp index 93865a5874..4ab0ce8399 100644 --- a/Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp +++ b/Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp @@ -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; } From 558daa3382312525f52ac952fa6d76a85f5e8227 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 1 Jul 2024 08:20:45 +0300 Subject: [PATCH 07/22] Fixed align of icons in list of top-up credit options. --- Telegram/SourceFiles/settings/settings_credits_graphics.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index 3e720ba59c..648a649003 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -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); From 715dff0a3ebf6de3e0d3242b2ce97c071380eeae Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 11:03:19 +0400 Subject: [PATCH 08/22] Fix a crash and a memory leak in video player. Fixes #28104. --- .../media/view/media_view_overlay_widget.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index d8e474e525..c6a7e9c6e6 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -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 { From e54204b136f87cec93ce2fc021ae8cb231646cba Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 13:20:08 +0400 Subject: [PATCH 09/22] Don't allow forwarding local items by drag. --- .../history/history_inner_widget.cpp | 35 +++++++++++++------ .../history/view/history_view_list_widget.cpp | 22 +++++++----- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 69268f05e2..1a302bd10c 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -1731,7 +1731,9 @@ std::unique_ptr 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 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(); - result->setData(u"application/x-td-forward"_q, "1"); + if (pressedHandler) { const auto lnkDocument = reinterpret_cast( pressedHandler->property( @@ -1774,12 +1776,23 @@ std::unique_ptr HistoryInner::prepareDrag() { if (lnkDocument) { const auto filepath = lnkDocument->filepath(true); if (!filepath.isEmpty()) { - QList urls; urls.push_back(QUrl::fromLocalFile(filepath)); - result->setUrls(urls); } } } + + if (forwardIds.empty() && urls.isEmpty()) { + return nullptr; + } + + auto result = std::make_unique(); + 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; diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 2c99c6343a..4155adf9b8 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -3778,12 +3778,7 @@ std::unique_ptr ListWidget::prepareDrag() { forwardIds = MessageIdsList(1, exactItem->fullId()); } } - if (forwardIds.empty()) { - return nullptr; - } - session().data().setMimeForwardIds(std::move(forwardIds)); - auto result = std::make_unique(); - result->setData(u"application/x-td-forward"_q, "1"); + if (pressedHandler) { const auto lnkDocument = reinterpret_cast( pressedHandler->property( @@ -3791,12 +3786,23 @@ std::unique_ptr ListWidget::prepareDrag() { if (lnkDocument) { const auto filepath = lnkDocument->filepath(true); if (!filepath.isEmpty()) { - QList urls; urls.push_back(QUrl::fromLocalFile(filepath)); - result->setUrls(urls); } } } + + if (forwardIds.empty() && urls.isEmpty()) { + return nullptr; + } + + auto result = std::make_unique(); + 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; From f40a58490583fb1e819377bfa2bedd51c5091c20 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 14:58:23 +0400 Subject: [PATCH 10/22] Support unlock with Watch/SystemPassword. --- .../Resources/icons/menu/passcode_watch.png | Bin 0 -> 438 bytes .../icons/menu/passcode_watch@2x.png | Bin 0 -> 631 bytes .../icons/menu/passcode_watch@3x.png | Bin 0 -> 886 bytes Telegram/Resources/langs/lang.strings | 6 ++ Telegram/SourceFiles/boxes/boxes.style | 13 +-- .../settings/settings_local_passcode.cpp | 97 ++++++++++++------ Telegram/SourceFiles/ui/menu_icons.style | 2 + .../window/window_lock_widgets.cpp | 54 ++++++++-- .../SourceFiles/window/window_lock_widgets.h | 11 +- Telegram/lib_base | 2 +- 10 files changed, 134 insertions(+), 51 deletions(-) create mode 100644 Telegram/Resources/icons/menu/passcode_watch.png create mode 100644 Telegram/Resources/icons/menu/passcode_watch@2x.png create mode 100644 Telegram/Resources/icons/menu/passcode_watch@3x.png diff --git a/Telegram/Resources/icons/menu/passcode_watch.png b/Telegram/Resources/icons/menu/passcode_watch.png new file mode 100644 index 0000000000000000000000000000000000000000..161da4e870802ecd30683d3a25f6bc47ca7482ba GIT binary patch literal 438 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1SIoCSFHz9jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(-uv49!D1}S`GTDlgfOu^H|F~maf z?G)Rt76*Y=cS!>?Q68Q>Ee{xdSbG0j_C7HE!^!Gw+ciUiqfKh|j_BRC2Ys#=r$tUn zZGL;=*S*#5<;h>4e!4!5$$Uv>l!)uHOs`iq=SySX|JM6>c~j=B?UP-Fa&|lIT9-XZ z<@PquRqI}_d+il4#bQP7ZHqqM!xO5erD~oIYFfln?jqf`~(oq0tSm;!h z#v+L}oAZqyIz5yQ&-`_u|M7>~|BQD3sx(rOl(}8aBY*$V!@5MzfX32Q23BN@#N<{>dv>n z+wwD6D+&9iT`&D0$$40S?c)pnPrdED@^6pNi`sMk{=)ZBhZhHKubUSM3NuevKbLh* G2~7a^3Zkt5 literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/menu/passcode_watch@2x.png b/Telegram/Resources/icons/menu/passcode_watch@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..516e313b7f5d145c4a12d99e2221860d122968c2 GIT binary patch literal 631 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1SD@Hh<<9ZiwNiJb`vKvI3TA#qxr50OrSCayngq7#Xsy|hpxk@!x4JU# zD&usi+^XW`+?mh++<*D9-p$B()-t`P2lkg8FyOhpt$g=g{)bIGNeYFLZCBb4HwK)X z%;FJa`mlI@oNFC}hxyBHJy&k8rI(6!#;m`-{IVy9SohJWwbwFC`i>`WjS_vel(qTb zf*8HiNe&E`G&$QRm`p!iYBjfNZ=8lm%X^FY=T~3NvYH#WK764?*Mh5A3nQP*EEZ>C zlz3WOv+Vx+>UrwXyqB3-&Ygen?x}0+Tf8yi$>+-JrS6L_rWhS$`5xSIH$e&L!iNPj z&Zg;4?@o=JeOAp!$J|b?|K|2@RkoHvmm3VkJX3B4{4Lw{Bx1QfWrs8mJ0E(x_hvu8c9x=_oEI@M#vu5D~@mV{rStRYfnFxw>Pgg&ebxsLQ08Bdd?f?J) literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/menu/passcode_watch@3x.png b/Telegram/Resources/icons/menu/passcode_watch@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..2b5f71f725d7bef72725ae4810525fe53582e542 GIT binary patch literal 886 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY1SD_us|Wxo#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyz1|Sip>6gA`6MbbHUh!1Tb=#W5s< z_3do?^@ffj$MicpoSdHLFI*Vlv4yKd$cwYrZBf`OlYJfj3nss)VbK`;5Unldou6}3C zxwOp(69O74_r{5LA1$$}wUJ|bIG;;Xto!xXU;MvWIRfU-S{jz_1B_Ytr;e-K5|&KITpKyxllNcpv>$Fhn6NYEQ@Ef*1JeiVnJ+?t zj(u73X!#O#297mxu4TJ#zrFS2;+pfk5eF=PcHB>%>Xm9E_d1-fW&_Z>haV~!ER4{Z zcK-R-@9IUX!&Xl|>C&Jk_vrJ_u+^fKH9KRh=JtJvT7Q=LVFQC}golGi%`~QoYs0#q ze5|#Zewx$4$GL%N!UF*#*>5Y)UCeN~^|$VRoFoG$pJMgH{TIw;^JXr;{4(Ax`cJXi zWJQY>9k|>-gXUqtd{P{RE>67hq%~f3=|4f!&tEG0oc;2E_66fuIUR*_tgl>ePRd3_+xAQCh zxbc7V^q6FNu0BC4V&l&mKQXh}zFD^~Wtd1ExyT*(oLzd|-6;kC%qHFXVZ3|Y+&!V$ zX7Sp!@9xB0mnnEw$nmlIOhkCNY{J1~`~E#>FpO@LV`voR*kXKSWBZXE(;t=X_Eix| znOfcV)$*HyTBYudg0~kVe>^;Q_*~RN@1>J2_bo3L=ik+I_a{H=lzCYikmT23Ec=6- XH}(4*u`@rvg3`RFtDnm{r-UW|$bgLV literal 0 HcmV?d00001 diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index b517e1f8df..db9afbe0e0 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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"; diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index fbe98a496f..c3cad02eb4 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -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; diff --git a/Telegram/SourceFiles/settings/settings_local_passcode.cpp b/Telegram/SourceFiles/settings/settings_local_passcode.cpp index db21f717bc..01562905a6 100644 --- a/Telegram/SourceFiles/settings/settings_local_passcode.cpp +++ b/Telegram/SourceFiles/settings/settings_local_passcode.cpp @@ -518,38 +518,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 + >(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); } diff --git a/Telegram/SourceFiles/ui/menu_icons.style b/Telegram/SourceFiles/ui/menu_icons.style index ce16702037..96838e8a5b 100644 --- a/Telegram/SourceFiles/ui/menu_icons.style +++ b/Telegram/SourceFiles/ui/menu_icons.style @@ -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); diff --git a/Telegram/SourceFiles/window/window_lock_widgets.cpp b/Telegram/SourceFiles/window/window_lock_widgets.cpp index e6453fbf2e..02350886e1 100644 --- a/Telegram/SourceFiles/window/window_lock_widgets.cpp +++ b/Telegram/SourceFiles/window/window_lock_widgets.cpp @@ -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( 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( _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) { diff --git a/Telegram/SourceFiles/window/window_lock_widgets.h b/Telegram/SourceFiles/window/window_lock_widgets.h index 8c48850fb2..03c6b59b3b 100644 --- a/Telegram/SourceFiles/window/window_lock_widgets.h +++ b/Telegram/SourceFiles/window/window_lock_widgets.h @@ -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 _systemUnlockAvailable = false; - rpl::variable _systemUnlockAllowed = false; + rpl::variable _systemUnlockAvailable; + rpl::variable _systemUnlockAllowed; object_ptr _passcode; object_ptr _submit; object_ptr _logout; diff --git a/Telegram/lib_base b/Telegram/lib_base index b512eead30..f30400147d 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit b512eead302cb7b509869778348d60fef64bc19b +Subproject commit f30400147d997fedc787e214467d305db6c159e7 From 4a2173deaf85e30fa539138ca9936acee8124f04 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 15:00:09 +0400 Subject: [PATCH 11/22] 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). --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/build/version | 8 ++++---- changelog.txt | 8 ++++++++ 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 6358fd7a85..5e91070905 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="5.2.1.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 8a7d5a43ab..b08e52bf99 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 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" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index d66689ed43..a62f79c3b4 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 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" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 2c230be0fd..994bba9688 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs; constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs; constexpr auto AppName = "Telegram Desktop"_cs; constexpr auto AppFile = "Telegram"_cs; -constexpr auto AppVersion = 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; diff --git a/Telegram/build/version b/Telegram/build/version index fdada4a89b..7e6b267c08 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -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 diff --git a/changelog.txt b/changelog.txt index ad1f99ab15..7cc1ef676d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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. From ed0850d8237a2dc054efbda62b99480aecb8a05d Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 1 Jul 2024 15:40:39 +0300 Subject: [PATCH 12/22] Renamed files for bot and channel earn sections with different names. --- Telegram/CMakeLists.txt | 16 ++++++++-------- .../boxes/peers/edit_peer_info_box.cpp | 2 +- ...n_inner_widget.cpp => info_bot_earn_list.cpp} | 4 ++-- ..._earn_inner_widget.h => info_bot_earn_list.h} | 0 ..._earn_widget.cpp => info_bot_earn_widget.cpp} | 4 ++-- ...info_earn_widget.h => info_bot_earn_widget.h} | 0 ...ner_widget.cpp => info_channel_earn_list.cpp} | 4 ++-- ...n_inner_widget.h => info_channel_earn_list.h} | 2 +- ...n_widget.cpp => info_channel_earn_widget.cpp} | 4 ++-- ..._earn_widget.h => info_channel_earn_widget.h} | 0 Telegram/SourceFiles/window/window_peer_menu.cpp | 2 +- .../window/window_session_controller.cpp | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) rename Telegram/SourceFiles/info/bot/earn/{info_earn_inner_widget.cpp => info_bot_earn_list.cpp} (99%) rename Telegram/SourceFiles/info/bot/earn/{info_earn_inner_widget.h => info_bot_earn_list.h} (100%) rename Telegram/SourceFiles/info/bot/earn/{info_earn_widget.cpp => info_bot_earn_widget.cpp} (96%) rename Telegram/SourceFiles/info/bot/earn/{info_earn_widget.h => info_bot_earn_widget.h} (100%) rename Telegram/SourceFiles/info/channel_statistics/earn/{info_earn_inner_widget.cpp => info_channel_earn_list.cpp} (99%) rename Telegram/SourceFiles/info/channel_statistics/earn/{info_earn_inner_widget.h => info_channel_earn_list.h} (95%) rename Telegram/SourceFiles/info/channel_statistics/earn/{info_earn_widget.cpp => info_channel_earn_widget.cpp} (95%) rename Telegram/SourceFiles/info/channel_statistics/earn/{info_earn_widget.h => info_channel_earn_widget.h} (100%) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index e3051087ec..6528a858e0 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -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 diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 5623bea94a..b27665ac88 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -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" diff --git a/Telegram/SourceFiles/info/bot/earn/info_earn_inner_widget.cpp b/Telegram/SourceFiles/info/bot/earn/info_bot_earn_list.cpp similarity index 99% rename from Telegram/SourceFiles/info/bot/earn/info_earn_inner_widget.cpp rename to Telegram/SourceFiles/info/bot/earn/info_bot_earn_list.cpp index 2b152ad6f8..169fe8883b 100644 --- a/Telegram/SourceFiles/info/bot/earn/info_earn_inner_widget.cpp +++ b/Telegram/SourceFiles/info/bot/earn/info_bot_earn_list.cpp @@ -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. diff --git a/Telegram/SourceFiles/info/bot/earn/info_earn_inner_widget.h b/Telegram/SourceFiles/info/bot/earn/info_bot_earn_list.h similarity index 100% rename from Telegram/SourceFiles/info/bot/earn/info_earn_inner_widget.h rename to Telegram/SourceFiles/info/bot/earn/info_bot_earn_list.h diff --git a/Telegram/SourceFiles/info/bot/earn/info_earn_widget.cpp b/Telegram/SourceFiles/info/bot/earn/info_bot_earn_widget.cpp similarity index 96% rename from Telegram/SourceFiles/info/bot/earn/info_earn_widget.cpp rename to Telegram/SourceFiles/info/bot/earn/info_bot_earn_widget.cpp index 59ddb37aaa..03ad190ce5 100644 --- a/Telegram/SourceFiles/info/bot/earn/info_earn_widget.cpp +++ b/Telegram/SourceFiles/info/bot/earn/info_bot_earn_widget.cpp @@ -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" diff --git a/Telegram/SourceFiles/info/bot/earn/info_earn_widget.h b/Telegram/SourceFiles/info/bot/earn/info_bot_earn_widget.h similarity index 100% rename from Telegram/SourceFiles/info/bot/earn/info_earn_widget.h rename to Telegram/SourceFiles/info/bot/earn/info_bot_earn_widget.h diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp similarity index 99% rename from Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp rename to Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp index 9fea4508c7..84ad81390f 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp @@ -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. diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.h b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.h similarity index 95% rename from Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.h rename to Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.h index d9f43192eb..061d69b7ed 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.h +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.h @@ -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" diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_widget.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_widget.cpp similarity index 95% rename from Telegram/SourceFiles/info/channel_statistics/earn/info_earn_widget.cpp rename to Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_widget.cpp index b0c38e1ade..dabd5e6eaa 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_widget.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_widget.cpp @@ -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" diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_widget.h b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_widget.h similarity index 100% rename from Telegram/SourceFiles/info/channel_statistics/earn/info_earn_widget.h rename to Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_widget.h diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 19b2d2580e..bce7a9ab1a 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -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" diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 34d3bf4890..017fb7fd0f 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -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" From 096530c96ad622f9a60f86b06eee655a539cbf5c Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 19:21:27 +0400 Subject: [PATCH 13/22] Version 5.2.1: Fix drafts / translations crash on macOS. --- Telegram/lib_spellcheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/lib_spellcheck b/Telegram/lib_spellcheck index 59d9226178..0b7622ff38 160000 --- a/Telegram/lib_spellcheck +++ b/Telegram/lib_spellcheck @@ -1 +1 @@ -Subproject commit 59d92261783ae403e8708f972c36be3d21ab064d +Subproject commit 0b7622ff38778e9cd03d3997de59351973480a1f From dc8c4a8332482bf6682dd601ac3b5a02e16c7285 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 21:03:05 +0400 Subject: [PATCH 14/22] Version 5.2.1: No auto-enable system password unlock on macOS. --- Telegram/SourceFiles/main/main_domain.cpp | 2 ++ .../settings/settings_local_passcode.cpp | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/main/main_domain.cpp b/Telegram/SourceFiles/main/main_domain.cpp index 9b4b120674..714f7e2919 100644 --- a/Telegram/SourceFiles/main/main_domain.cpp +++ b/Telegram/SourceFiles/main/main_domain.cpp @@ -403,6 +403,8 @@ bool Domain::removePasscodeIfEmpty() { return false; } _local->setPasscode(QByteArray()); + Core::App().settings().setSystemUnlockEnabled(false); + Core::App().saveSettingsDelayed(); return true; } diff --git a/Telegram/SourceFiles/settings/settings_local_passcode.cpp b/Telegram/SourceFiles/settings/settings_local_passcode.cpp index 01562905a6..193445caf3 100644 --- a/Telegram/SourceFiles/settings/settings_local_passcode.cpp +++ b/Telegram/SourceFiles/settings/settings_local_passcode.cpp @@ -80,6 +80,7 @@ private: rpl::event_stream<> _setInnerFocus; rpl::event_stream _showOther; rpl::event_stream<> _showBack; + bool _systemUnlockWithBiometric = false; }; @@ -97,6 +98,13 @@ rpl::producer LocalPasscodeEnter::title() { void LocalPasscodeEnter::setupContent() { const auto content = Ui::CreateChild(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({}); @@ -601,6 +611,8 @@ QPointer LocalPasscodeManage::createPinnedToBottom( .text = tr::lng_settings_passcode_disable_sure(), .confirmed = [=](Fn &&close) { SetPasscode(_controller, QString()); + Core::App().settings().setSystemUnlockEnabled(false); + Core::App().saveSettingsDelayed(); close(); _showBack.fire({}); From f75429cbaa29fced007fabd2facc8541470fb40d Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 1 Jul 2024 21:35:28 +0400 Subject: [PATCH 15/22] Version 5.2.1: Shorten webview socket path. Fixes #28106. --- .../SourceFiles/platform/linux/specific_linux.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 474f47746a..6d8a8ec54d 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -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(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(); From ab20f8eb315900492dbd40eeba4f123731e2747c Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 2 Jul 2024 09:53:56 +0400 Subject: [PATCH 16/22] Fix topics search in topic groups. Fixes #28110. --- Telegram/SourceFiles/dialogs/dialogs_key.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/dialogs/dialogs_key.cpp b/Telegram/SourceFiles/dialogs/dialogs_key.cpp index 544c48cca8..db5df96270 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_key.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_key.cpp @@ -100,7 +100,9 @@ ChatSearchTab SearchState::defaultTabForMe() const { } bool SearchState::filterChatsList() const { - return !inChat && (tab == ChatSearchTab::MyMessages); + using Tab = ChatSearchTab; + return !inChat // ThisPeer can be in opened forum. + && (tab == Tab::MyMessages || tab == Tab::ThisPeer); } } // namespace Dialogs From ad7d1fddf08b6fb5345a3e88566127a5873e2725 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 2 Jul 2024 10:27:26 +0400 Subject: [PATCH 17/22] Reload IV on each open, take hash into account. Fixes #28111. --- Telegram/SourceFiles/iv/iv_instance.cpp | 68 ++++++++++++++++--------- Telegram/SourceFiles/iv/iv_instance.h | 13 ++++- 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/Telegram/SourceFiles/iv/iv_instance.cpp b/Telegram/SourceFiles/iv/iv_instance.cpp index 69df5f772a..4482cb4764 100644 --- a/Telegram/SourceFiles/iv/iv_instance.cpp +++ b/Telegram/SourceFiles/iv/iv_instance.cpp @@ -57,6 +57,7 @@ constexpr auto kGeoPointScale = 1; constexpr auto kGeoPointZoomMin = 13; constexpr auto kMaxLoadParts = 5; constexpr auto kKeepLoadingParts = 8; +constexpr auto kAllowPageReloadAfter = 3 * crl::time(1000); } // namespace @@ -815,19 +816,19 @@ void Instance::show( } break; case Type::OpenPage: - case Type::OpenLink: + case Type::OpenLink: { if (!urlChecked) { break; } - _fullRequested[_shownSession].emplace(event.url); - _shownSession->api().request(MTPmessages_GetWebPage( - MTP_string(event.url), - MTP_int(0) + const auto session = _shownSession; + const auto url = event.url; + auto &requested = _fullRequested[session][url]; + requested.lastRequestedAt = crl::now(); + session->api().request(MTPmessages_GetWebPage( + MTP_string(url), + MTP_int(requested.hash) )).done([=](const MTPmessages_WebPage &result) { - _shownSession->data().processUsers(result.data().vusers()); - _shownSession->data().processChats(result.data().vchats()); - const auto page = _shownSession->data().processWebpage( - result.data().vwebpage()); + const auto page = processReceivedPage(session, url, result); if (page && page->iv) { const auto parts = event.url.split('#'); const auto hash = (parts.size() > 1) ? parts[1] : u""_q; @@ -838,7 +839,7 @@ void Instance::show( }).fail([=] { UrlClickHandler::Open(event.url); }).send(); - break; + } break; case Type::Report: if (const auto controller = _shownSession->tryResolveWindow()) { controller->window().activate(); @@ -954,15 +955,13 @@ void Instance::openWithIvPreferred( }; _ivRequestSession = session; _ivRequestUri = uri; - _fullRequested[session].emplace(url); + auto &requested = _fullRequested[session][url]; + requested.lastRequestedAt = crl::now(); _ivRequestId = session->api().request(MTPmessages_GetWebPage( MTP_string(url), - MTP_int(0) + MTP_int(requested.hash) )).done([=](const MTPmessages_WebPage &result) { - const auto &data = result.data(); - session->data().processUsers(data.vusers()); - session->data().processChats(data.vchats()); - finish(session->data().processWebpage(data.vwebpage())); + finish(processReceivedPage(session, url, result)); }).fail([=] { finish(nullptr); }).send(); @@ -971,24 +970,47 @@ void Instance::openWithIvPreferred( void Instance::requestFull( not_null session, const QString &id) { - if (!_tracking.contains(session) - || !_fullRequested[session].emplace(id).second) { + if (!_tracking.contains(session)) { return; } + auto &requested = _fullRequested[session][id]; + const auto last = requested.lastRequestedAt; + const auto now = crl::now(); + if (last && (now - last) < kAllowPageReloadAfter) { + return; + } + requested.lastRequestedAt = now; session->api().request(MTPmessages_GetWebPage( MTP_string(id), - MTP_int(0) + MTP_int(requested.hash) )).done([=](const MTPmessages_WebPage &result) { - session->data().processUsers(result.data().vusers()); - session->data().processChats(result.data().vchats()); - const auto page = session->data().processWebpage( - result.data().vwebpage()); + const auto page = processReceivedPage(session, id, result); if (page && page->iv && _shown && _shownSession == session) { _shown->update(page->iv.get()); } }).send(); } +WebPageData *Instance::processReceivedPage( + not_null session, + const QString &url, + const MTPmessages_WebPage &result) { + const auto &data = result.data(); + const auto owner = &session->data(); + owner->processUsers(data.vusers()); + owner->processChats(data.vchats()); + auto &requested = _fullRequested[session][url]; + const auto &mtp = data.vwebpage(); + return mtp.match([&](const MTPDwebPageNotModified &data) { + return requested.page; + }, [&](const MTPDwebPage &data) { + requested.hash = data.vhash().v; + return owner->processWebpage(data).get(); + }, [&](const auto &) { + return owner->processWebpage(mtp).get(); + }); +} + void Instance::processOpenChannel(const QString &context) { if (!_shownSession) { return; diff --git a/Telegram/SourceFiles/iv/iv_instance.h b/Telegram/SourceFiles/iv/iv_instance.h index 1299bbdddb..9083734adf 100644 --- a/Telegram/SourceFiles/iv/iv_instance.h +++ b/Telegram/SourceFiles/iv/iv_instance.h @@ -61,12 +61,23 @@ public: [[nodiscard]] rpl::lifetime &lifetime(); private: + struct FullResult { + crl::time lastRequestedAt = 0; + WebPageData *page = nullptr; + int32 hash = 0; + }; + void processOpenChannel(const QString &context); void processJoinChannel(const QString &context); void requestFull(not_null session, const QString &id); void trackSession(not_null session); + WebPageData *processReceivedPage( + not_null session, + const QString &url, + const MTPmessages_WebPage &result); + const not_null _delegate; std::unique_ptr _shown; @@ -77,7 +88,7 @@ private: base::flat_set>> _joining; base::flat_map< not_null, - base::flat_set> _fullRequested; + base::flat_map> _fullRequested; base::flat_map< not_null, From 3947056654537bb42db2f3ca38369ce9b52b3297 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 2 Jul 2024 10:40:39 +0400 Subject: [PATCH 18/22] Use cached views count from not modified page. --- Telegram/SourceFiles/iv/iv_data.cpp | 6 ++++++ Telegram/SourceFiles/iv/iv_data.h | 2 ++ Telegram/SourceFiles/iv/iv_instance.cpp | 14 ++++++++++---- Telegram/SourceFiles/iv/iv_prepare.cpp | 4 +++- Telegram/SourceFiles/iv/iv_prepare.h | 1 + 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/iv/iv_data.cpp b/Telegram/SourceFiles/iv/iv_data.cpp index 5258e6c9f1..16f9c0d519 100644 --- a/Telegram/SourceFiles/iv/iv_data.cpp +++ b/Telegram/SourceFiles/iv/iv_data.cpp @@ -71,6 +71,12 @@ bool Data::partial() const { Data::~Data() = default; +void Data::updateCachedViews(int cachedViews) { + _source->updatedCachedViews = std::max( + _source->updatedCachedViews, + cachedViews); +} + void Data::prepare(const Options &options, Fn done) const { crl::async([source = *_source, options, done = std::move(done)] { done(Prepare(source, options)); diff --git a/Telegram/SourceFiles/iv/iv_data.h b/Telegram/SourceFiles/iv/iv_data.h index 87900bce37..cdb2d87089 100644 --- a/Telegram/SourceFiles/iv/iv_data.h +++ b/Telegram/SourceFiles/iv/iv_data.h @@ -45,6 +45,8 @@ public: [[nodiscard]] QString id() const; [[nodiscard]] bool partial() const; + void updateCachedViews(int cachedViews); + void prepare(const Options &options, Fn done) const; private: diff --git a/Telegram/SourceFiles/iv/iv_instance.cpp b/Telegram/SourceFiles/iv/iv_instance.cpp index 4482cb4764..d070c93d2a 100644 --- a/Telegram/SourceFiles/iv/iv_instance.cpp +++ b/Telegram/SourceFiles/iv/iv_instance.cpp @@ -1001,14 +1001,20 @@ WebPageData *Instance::processReceivedPage( owner->processChats(data.vchats()); auto &requested = _fullRequested[session][url]; const auto &mtp = data.vwebpage(); - return mtp.match([&](const MTPDwebPageNotModified &data) { - return requested.page; + mtp.match([&](const MTPDwebPageNotModified &data) { + const auto page = requested.page; + if (const auto views = data.vcached_page_views()) { + if (page && page->iv) { + page->iv->updateCachedViews(views->v); + } + } }, [&](const MTPDwebPage &data) { requested.hash = data.vhash().v; - return owner->processWebpage(data).get(); + requested.page = owner->processWebpage(data).get(); }, [&](const auto &) { - return owner->processWebpage(mtp).get(); + requested.page = owner->processWebpage(mtp).get(); }); + return requested.page; } void Instance::processOpenChannel(const QString &context) { diff --git a/Telegram/SourceFiles/iv/iv_prepare.cpp b/Telegram/SourceFiles/iv/iv_prepare.cpp index d5f5375247..15d5edaa73 100644 --- a/Telegram/SourceFiles/iv/iv_prepare.cpp +++ b/Telegram/SourceFiles/iv/iv_prepare.cpp @@ -229,7 +229,9 @@ Parser::Parser(const Source &source, const Options &options) _result.name = source.name; _result.rtl = source.page.data().is_rtl(); - const auto views = source.page.data().vviews().value_or_empty(); + const auto views = std::max( + source.page.data().vviews().value_or_empty(), + source.updatedCachedViews); const auto content = list(source.page.data().vblocks()); _result.content = wrap(content, views); } diff --git a/Telegram/SourceFiles/iv/iv_prepare.h b/Telegram/SourceFiles/iv/iv_prepare.h index a896c79e03..ef919db2f7 100644 --- a/Telegram/SourceFiles/iv/iv_prepare.h +++ b/Telegram/SourceFiles/iv/iv_prepare.h @@ -18,6 +18,7 @@ struct Source { std::optional webpagePhoto; std::optional webpageDocument; QString name; + int updatedCachedViews = 0; }; [[nodiscard]] Prepared Prepare(const Source &source, const Options &options); From 8cbeadc68a88acb207305ad02e6c01df3a80b690 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 2 Jul 2024 13:22:33 +0400 Subject: [PATCH 19/22] Register tg:// scheme on initial launch. --- Telegram/SourceFiles/core/application.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 21d3aa7ca3..c33b24c2af 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -261,9 +261,14 @@ void Application::run() { refreshGlobalProxy(); // Depends on app settings being read. - if (const auto old = Local::oldSettingsVersion(); old < AppVersion) { + if (const auto old = Local::oldSettingsVersion()) { + if (old < AppVersion) { + InvokeQueued(this, [] { RegisterUrlScheme(); }); + Platform::NewVersionLaunched(old); + } + } else { + // Initial launch. InvokeQueued(this, [] { RegisterUrlScheme(); }); - Platform::NewVersionLaunched(old); } if (cAutoStart() && !Platform::AutostartSupported()) { From 17bb430006c155305dbb5407fd3d081326af9b1b Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 2 Jul 2024 13:34:52 +0400 Subject: [PATCH 20/22] Register tg:// scheme on first launch. Also, allow disabling tg:// re-registration on update. --- Telegram/SourceFiles/core/application.cpp | 19 +++++++++++++++++-- Telegram/SourceFiles/core/application.h | 3 +++ .../settings/settings_experimental.cpp | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index c33b24c2af..e3e0de6c6e 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/battery_saving.h" #include "base/event_filter.h" #include "base/concurrent_timer.h" +#include "base/options.h" #include "base/qt_signal_producer.h" #include "base/timer.h" #include "base/unixtime.h" @@ -140,10 +141,18 @@ void SetCrashAnnotationsGL() { #endif // DESKTOP_APP_USE_ANGLE } +base::options::toggle OptionSkipUrlSchemeRegister({ + .id = kOptionSkipUrlSchemeRegister, + .name = "Skip URL scheme register", + .description = "Don't re-register tg:// URL scheme on autoupdate.", +}); + } // namespace Application *Application::Instance = nullptr; +const char kOptionSkipUrlSchemeRegister[] = "skip-url-scheme-register"; + struct Application::Private { base::Timer quitTimer; UiIntegration uiIntegration; @@ -263,12 +272,12 @@ void Application::run() { if (const auto old = Local::oldSettingsVersion()) { if (old < AppVersion) { - InvokeQueued(this, [] { RegisterUrlScheme(); }); + autoRegisterUrlScheme(); Platform::NewVersionLaunched(old); } } else { // Initial launch. - InvokeQueued(this, [] { RegisterUrlScheme(); }); + autoRegisterUrlScheme(); } if (cAutoStart() && !Platform::AutostartSupported()) { @@ -410,6 +419,12 @@ void Application::run() { processCreatedWindow(_lastActivePrimaryWindow); } +void Application::autoRegisterUrlScheme() { + if (!OptionSkipUrlSchemeRegister.value()) { + InvokeQueued(this, [] { RegisterUrlScheme(); }); + } +} + void Application::showAccount(not_null account) { if (const auto separate = separateWindowFor(account)) { _lastActivePrimaryWindow = separate; diff --git a/Telegram/SourceFiles/core/application.h b/Telegram/SourceFiles/core/application.h index 77fe09b7ff..eca07e7519 100644 --- a/Telegram/SourceFiles/core/application.h +++ b/Telegram/SourceFiles/core/application.h @@ -126,6 +126,8 @@ enum class QuitReason { QtQuitEvent, }; +extern const char kOptionSkipUrlSchemeRegister[]; + class Application final : public QObject { public: struct ProxyChange { @@ -349,6 +351,7 @@ private: friend bool IsAppLaunched(); friend Application &App(); + void autoRegisterUrlScheme(); void clearEmojiSourceImages(); [[nodiscard]] auto prepareEmojiSourceImages() -> std::shared_ptr; diff --git a/Telegram/SourceFiles/settings/settings_experimental.cpp b/Telegram/SourceFiles/settings/settings_experimental.cpp index 93e9e74dc2..f578bce829 100644 --- a/Telegram/SourceFiles/settings/settings_experimental.cpp +++ b/Telegram/SourceFiles/settings/settings_experimental.cpp @@ -152,6 +152,7 @@ void SetupExperimental( addToggle(kOptionAutoScrollInactiveChat); addToggle(Window::Notifications::kOptionGNotification); addToggle(Core::kOptionFreeType); + addToggle(Core::kOptionSkipUrlSchemeRegister); addToggle(Data::kOptionExternalVideoPlayer); addToggle(Window::kOptionNewWindowsSizeAsFirst); } From ec2faca14502fa907b503ecba7834ccf5419ad82 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 2 Jul 2024 18:08:24 +0400 Subject: [PATCH 21/22] Fix couple of crashes in secondary windows. --- .../boxes/peers/edit_peer_info_box.cpp | 5 ++++- Telegram/SourceFiles/mainwidget.cpp | 19 +++++++++++-------- Telegram/SourceFiles/mainwidget.h | 3 +-- .../window/window_session_controller.cpp | 13 ++++++++++--- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index b27665ac88..0ba6354f99 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -2200,8 +2200,11 @@ void Controller::saveForum() { channel->inputChannel, MTP_bool(*_savingData.forum) )).done([=](const MTPUpdates &result) { + const auto weak = base::make_weak(this); channel->session().api().applyUpdates(result); - continueSave(); + if (weak) { // todo better to be able to save in closed already box. + continueSave(); + } }).fail([=](const MTP::Error &error) { if (error.type() == u"CHAT_NOT_MODIFIED"_q) { continueSave(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 45ad3ef62f..854441b8c2 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1192,9 +1192,11 @@ void MainWidget::setInnerFocus() { _mainSection->setInnerFocus(); } else if (!_hider && _thirdSection) { _thirdSection->setInnerFocus(); - } else { - Assert(_dialogs != nullptr); + } else if (_dialogs) { _dialogs->setInnerFocus(); + } else { + // Maybe we're just closing a child window, content is destroyed. + _history->setFocus(); } } else if (_mainSection) { _mainSection->setInnerFocus(); @@ -1293,8 +1295,9 @@ void MainWidget::showHistory( } const auto unavailable = peer->computeUnavailableReason(); if (!unavailable.isEmpty()) { - Assert(isPrimary()); // windows todo - if (params.activation != anim::activation::background) { + if (!isPrimary()) { + _controller->window().close(); + } else if (params.activation != anim::activation::background) { _controller->show(Ui::MakeInformBox(unavailable)); _controller->window().activate(); } @@ -1950,10 +1953,9 @@ void MainWidget::showNonPremiumLimitToast(bool download) { }); } -void MainWidget::showBackFromStack( - const SectionShow ¶ms) { +bool MainWidget::showBackFromStack(const SectionShow ¶ms) { if (preventsCloseSection([=] { showBackFromStack(params); }, params)) { - return; + return false; } if (_stack.empty()) { @@ -1963,7 +1965,7 @@ void MainWidget::showBackFromStack( crl::on_main(this, [=] { _controller->widget()->setInnerFocus(); }); - return; + return (_dialogs != nullptr); } auto item = std::move(_stack.back()); _stack.pop_back(); @@ -1995,6 +1997,7 @@ void MainWidget::showBackFromStack( anim::activation::background)); } + return true; } void MainWidget::orderWidgets() { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index b97c7f98fb..7acbbead4e 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -152,8 +152,7 @@ public: const SectionShow ¶ms); void updateColumnLayout(); bool stackIsEmpty() const; - void showBackFromStack( - const SectionShow ¶ms); + bool showBackFromStack(const SectionShow ¶ms); void orderWidgets(); QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms); void checkMainSectionToLayer(); diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 017fb7fd0f..8380e458a1 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -1660,8 +1660,9 @@ void SessionController::showForum( ) | rpl::start_with_next([=, history = forum->history()] { const auto now = activeChatCurrent().owningHistory(); const auto showHistory = !now || (now == history); + const auto weak = base::make_weak(this); closeForum(); - if (showHistory) { + if (weak && showHistory) { showPeerHistory(history, { SectionShow::Way::Backward, anim::type::normal, @@ -1676,7 +1677,7 @@ void SessionController::closeForum() { if (const auto forum = _shownForum.current()) { const auto id = windowId(); if (id.type == SeparateType::Forum) { - const auto initial = id.thread->asForum(); + const auto initial = id.forum(); if (!initial || initial == forum) { Core::App().closeWindow(_window); } else { @@ -2529,7 +2530,13 @@ void SessionController::showBackFromStack(const SectionShow ¶ms) { return topic && topic->forum()->topicDeleted(topic->rootId()); }; do { - content()->showBackFromStack(params); + const auto empty = content()->stackIsEmpty(); + const auto shown = content()->showBackFromStack(params); + if (empty && !shown && content()->stackIsEmpty() && bad()) { + clearSectionStack(anim::type::instant); + window().close(); + break; + } } while (bad()); } From a507d28b49d8fabdb15a75790822f00133de7099 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 2 Jul 2024 19:03:07 +0400 Subject: [PATCH 22/22] Version 5.2.2. - Fix topics search in topic groups. - Fix Instant View pages content updating. --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/build/version | 8 ++++---- changelog.txt | 5 +++++ 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 5e91070905..53203464b9 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="5.2.2.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index b08e52bf99..2d9446598c 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,2,1,0 - PRODUCTVERSION 5,2,1,0 + FILEVERSION 5,2,2,0 + PRODUCTVERSION 5,2,2,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.1.0" + VALUE "FileVersion", "5.2.2.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.2.1.0" + VALUE "ProductVersion", "5.2.2.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index a62f79c3b4..abd5f4d0e0 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,2,1,0 - PRODUCTVERSION 5,2,1,0 + FILEVERSION 5,2,2,0 + PRODUCTVERSION 5,2,2,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.1.0" + VALUE "FileVersion", "5.2.2.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.2.1.0" + VALUE "ProductVersion", "5.2.2.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 994bba9688..57252c888c 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs; constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs; constexpr auto AppName = "Telegram Desktop"_cs; constexpr auto AppFile = "Telegram"_cs; -constexpr auto AppVersion = 5002001; -constexpr auto AppVersionStr = "5.2.1"; +constexpr auto AppVersion = 5002002; +constexpr auto AppVersionStr = "5.2.2"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index 7e6b267c08..5531916133 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 5002001 +AppVersion 5002002 AppVersionStrMajor 5.2 -AppVersionStrSmall 5.2.1 -AppVersionStr 5.2.1 +AppVersionStrSmall 5.2.2 +AppVersionStr 5.2.2 BetaChannel 0 AlphaVersion 0 -AppVersionOriginal 5.2.1 +AppVersionOriginal 5.2.2 diff --git a/changelog.txt b/changelog.txt index 7cc1ef676d..6e398bcc66 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +5.2.2 (02.07.24) + +- Fix topics search in topic groups. +- Fix Instant View pages content updating. + 5.2.1 (01.07.24) - Fix crash when opening topic in a new window.