diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index 4d4b3d3687..42354fdc37 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -242,7 +242,7 @@ infoTopBarMenuPosition: point(-2px, 35px); infoLayerTopBarMenuPosition: point(40px, 37px); infoMinimalWidth: 324px; -infoDesiredWidth: 430px; +infoDesiredWidth: 392px; infoMinimalLayerMargin: 48px; infoTabs: SettingsSlider(defaultTabsSlider) { diff --git a/Telegram/SourceFiles/info/info_layer_widget.cpp b/Telegram/SourceFiles/info/info_layer_widget.cpp index 38b4abbbac..6f912ae6a6 100644 --- a/Telegram/SourceFiles/info/info_layer_widget.cpp +++ b/Telegram/SourceFiles/info/info_layer_widget.cpp @@ -111,7 +111,13 @@ bool LayerWidget::takeToThirdSection() { bool LayerWidget::showSectionInternal( not_null memento, const Window::SectionShow ¶ms) { - return _content->showInternal(memento, params); + if (_content->showInternal(memento, params)) { + if (params.activation != anim::activation::background) { + Ui::hideLayer(); + } + return true; + } + return false; } int LayerWidget::MinimalSupportedWidth() { diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index c11f3f5e64..673e14cca6 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -518,18 +518,17 @@ void ActionsFiller::addBlockAction(not_null user) { auto text = Notify::PeerUpdateValue( user, Notify::PeerUpdate::Flag::UserIsBlocked) - | rpl::map([user]() -> rpl::producer { + | rpl::map([user] { switch (user->blockStatus()) { case UserData::BlockStatus::Blocked: return Lang::Viewer(user->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user); case UserData::BlockStatus::NotBlocked: + default: return Lang::Viewer(user->botInfo ? lng_profile_block_bot : lng_profile_block_user); - default: - return rpl::single(QString()); } }) | rpl::flatten_latest() diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp index ad1d011ca0..c55d33b663 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp @@ -69,8 +69,10 @@ InnerWidget::InnerWidget( , _content(setupContent(this)) { _content->heightValue() | rpl::start_with_next([this](int height) { - resizeToWidth(width()); - _desiredHeight.fire(countDesiredHeight()); + if (!_inResize) { + resizeToWidth(width()); + updateDesiredHeight(); + } }, lifetime()); } @@ -259,8 +261,12 @@ void InnerWidget::restoreState(not_null memento) { } int InnerWidget::resizeGetHeight(int newWidth) { + _inResize = true; + auto guard = gsl::finally([&] { _inResize = false; }); + _content->resizeToWidth(newWidth); _content->moveToLeft(0, 0); + updateDesiredHeight(); return _content->heightNoMargins(); } diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.h b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.h index 38b63b9c7f..d1f4769cee 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.h +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.h @@ -77,6 +77,9 @@ private: object_ptr setupSharedMedia(not_null parent); int countDesiredHeight() const; + void updateDesiredHeight() { + _desiredHeight.fire(countDesiredHeight()); + } bool canHideDetailsEver() const; rpl::producer canHideDetails() const; @@ -93,6 +96,7 @@ private: Ui::SlideWrap *_sharedMediaWrap = nullptr; object_ptr _content; + bool _inResize = false; rpl::event_stream _scrollToRequests; rpl::event_stream _desiredHeight; diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index ac9f8f8423..1907eeaf20 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -675,7 +675,7 @@ bool MainWidget::onShareUrl(const PeerId &peer, const QString &url, const QStrin bool MainWidget::onInlineSwitchChosen(const PeerId &peer, const QString &botAndQuery) { PeerData *p = App::peer(peer); - if (!peer || p->canWrite()) { + if (!peer || !p->canWrite()) { Ui::show(Box(lang(lng_inline_switch_cant))); return false; } diff --git a/Telegram/SourceFiles/ui/wrap/vertical_layout.cpp b/Telegram/SourceFiles/ui/wrap/vertical_layout.cpp index 383c443435..1c0c86b98f 100644 --- a/Telegram/SourceFiles/ui/wrap/vertical_layout.cpp +++ b/Telegram/SourceFiles/ui/wrap/vertical_layout.cpp @@ -59,6 +59,9 @@ int VerticalLayout::naturalWidth() const { } int VerticalLayout::resizeGetHeight(int newWidth) { + _inResize = true; + auto guard = gsl::finally([&] { _inResize = false; }); + auto margins = getMargins(); auto result = 0; for (auto &row : _rows) { @@ -72,7 +75,7 @@ int VerticalLayout::resizeGetHeight(int newWidth) { + row.widget->heightNoMargins() + row.margin.bottom(); } - return height() - margins.top() - margins.bottom(); + return result - margins.bottom(); } void VerticalLayout::visibleTopBottomUpdated( @@ -116,7 +119,9 @@ RpWidget *VerticalLayout::addChild( height() - margins.top() - margins.bottom()); weak->heightValue() | rpl::start_with_next_done([this, weak] { - childHeightUpdated(weak); + if (!_inResize) { + childHeightUpdated(weak); + } }, [this, weak] { removeChild(weak); }, lifetime()); diff --git a/Telegram/SourceFiles/ui/wrap/vertical_layout.h b/Telegram/SourceFiles/ui/wrap/vertical_layout.h index a1f0cffdc2..0b177917b1 100644 --- a/Telegram/SourceFiles/ui/wrap/vertical_layout.h +++ b/Telegram/SourceFiles/ui/wrap/vertical_layout.h @@ -67,6 +67,7 @@ private: style::margins margin; }; std::vector _rows; + bool _inResize = false; }; diff --git a/Telegram/SourceFiles/window/window.style b/Telegram/SourceFiles/window/window.style index a6b898128d..54b44ec92d 100644 --- a/Telegram/SourceFiles/window/window.style +++ b/Telegram/SourceFiles/window/window.style @@ -34,8 +34,8 @@ columnMinimalWidthLeft: 260px; columnMaximalWidthLeft: 540px; columnMinimalWidthMain: 380px; columnDesiredWidthMain: 512px; -columnMinimalWidthThird: 292px;//345px; -columnMaximalWidthThird: 430px;//345px; +columnMinimalWidthThird: 292px; +columnMaximalWidthThird: 392px; adaptiveChatWideWidth: 880px; diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 4691db956a..853bad9f12 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -446,7 +446,6 @@ void PeerMenuDeleteContact(not_null user) { lt_contact, App::peerName(user)); auto deleteSure = [=] { - Ui::showChatsList(); Ui::hideLayer(); MTP::send( MTPcontacts_DeleteContact(user->inputUser),