Remove Send Message animation in !Wrap::Side

This commit is contained in:
John Preston 2017-11-17 21:02:49 +04:00
parent 33ae4b176a
commit 15d2ce150d
6 changed files with 46 additions and 16 deletions

View File

@ -273,8 +273,11 @@ infoProfileStatusLabel: FlatLabel(defaultFlatLabel) {
linkFont: normalFont; linkFont: normalFont;
linkFontOver: normalFont; linkFontOver: normalFont;
} }
}
infoProfileMegagroupStatusLabel: FlatLabel(infoProfileStatusLabel) {
style: defaultTextStyle;
palette: TextPalette(defaultTextPalette) { palette: TextPalette(defaultTextPalette) {
linkFg: windowActiveTextFg; linkFg: windowSubTextFg;
} }
} }

View File

@ -254,12 +254,6 @@ void TopBar::startHighlightAnimation() {
rpl::producer<QString> TitleValue( rpl::producer<QString> TitleValue(
const Section &section, const Section &section,
not_null<PeerData*> peer) { not_null<PeerData*> peer) {
if (section.type() == Section::Type::Members) {
return Profile::MembersCountValue(peer)
| rpl::map([](int count) {
return lng_chat_status_members(lt_count, count);
});
}
return Lang::Viewer([&] { return Lang::Viewer([&] {
switch (section.type()) { switch (section.type()) {
case Section::Type::Profile: case Section::Type::Profile:
@ -298,6 +292,9 @@ rpl::producer<QString> TitleValue(
case Section::Type::CommonGroups: case Section::Type::CommonGroups:
return lng_profile_common_groups_section; return lng_profile_common_groups_section;
case Section::Type::Members:
return lng_profile_participants_section;
} }
Unexpected("Bad section type in Info::TitleValue()"); Unexpected("Bad section type in Info::TitleValue()");
}()); }());

View File

@ -85,6 +85,7 @@ auto AddActionButton(
result->toggleOn( result->toggleOn(
std::move(toggleOn) std::move(toggleOn)
)->entity()->addClickHandler(std::move(callback)); )->entity()->addClickHandler(std::move(callback));
result->finishAnimating();
return result; return result;
}; };
@ -314,8 +315,10 @@ Ui::MultiSlideTracker DetailsFiller::fillUserButtons(
Ui::MultiSlideTracker tracker; Ui::MultiSlideTracker tracker;
auto window = _controller->window(); auto window = _controller->window();
auto sendMessageVisible = window->historyPeer.value() auto sendMessageVisible = rpl::combine(
| rpl::map($1 != user); _controller->wrapValue(),
window->historyPeer.value(),
($1 != Wrap::Side) || ($2 != user));
auto sendMessage = [window, user] { auto sendMessage = [window, user] {
window->showPeerHistory( window->showPeerHistory(
user, user,
@ -343,8 +346,10 @@ Ui::MultiSlideTracker DetailsFiller::fillChannelButtons(
Ui::MultiSlideTracker tracker; Ui::MultiSlideTracker tracker;
auto window = _controller->window(); auto window = _controller->window();
auto viewChannelVisible = window->historyPeer.value() auto viewChannelVisible = rpl::combine(
| rpl::map($1 != channel); _controller->wrapValue(),
window->historyPeer.value(),
($1 != Wrap::Side) || ($2 != channel));
auto viewChannel = [=] { auto viewChannel = [=] {
window->showPeerHistory( window->showPeerHistory(
channel, channel,

View File

@ -25,11 +25,13 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "data/data_photo.h" #include "data/data_photo.h"
#include "info/profile/info_profile_values.h" #include "info/profile/info_profile_values.h"
#include "info/info_controller.h" #include "info/info_controller.h"
#include "info/info_memento.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "styles/style_info.h" #include "styles/style_info.h"
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/effects/ripple_animation.h" #include "ui/effects/ripple_animation.h"
#include "ui/special_buttons.h" #include "ui/special_buttons.h"
#include "window/window_controller.h"
#include "observer_peer.h" #include "observer_peer.h"
#include "messenger.h" #include "messenger.h"
#include "auth_session.h" #include "auth_session.h"
@ -228,6 +230,7 @@ Cover::Cover(
st::infoProfilePhotoTop st::infoProfilePhotoTop
+ st::infoProfilePhoto.size.height() + st::infoProfilePhoto.size.height()
+ st::infoProfilePhotoBottom) + st::infoProfilePhotoBottom)
, _controller(controller)
, _peer(peer) , _peer(peer)
, _userpic( , _userpic(
this, this,
@ -236,12 +239,19 @@ Cover::Cover(
Ui::UserpicButton::Role::OpenPhoto, Ui::UserpicButton::Role::OpenPhoto,
st::infoProfilePhoto) st::infoProfilePhoto)
, _name(this, st::infoProfileNameLabel) , _name(this, st::infoProfileNameLabel)
, _status(this, st::infoProfileStatusLabel) { , _status(
this,
_peer->isMegagroup()
? st::infoProfileMegagroupStatusLabel
: st::infoProfileStatusLabel) {
_peer->updateFull(); _peer->updateFull();
_name->setSelectable(true); _name->setSelectable(true);
_name->setContextCopyText(lang(lng_profile_copy_fullname)); _name->setContextCopyText(lang(lng_profile_copy_fullname));
_status->setAttribute(Qt::WA_TransparentForMouseEvents);
if (!_peer->isMegagroup()) {
_status->setAttribute(Qt::WA_TransparentForMouseEvents);
}
initViewers(); initViewers();
setupChildGeometry(); setupChildGeometry();
@ -332,7 +342,13 @@ void Cover::refreshNameText() {
} }
void Cover::refreshStatusText() { void Cover::refreshStatusText() {
auto statusText = [this] { auto hasMembersLink = [&] {
if (auto megagroup = _peer->asMegagroup()) {
return megagroup->canViewMembers();
}
return false;
}();
auto statusText = [&] {
auto currentTime = unixtime(); auto currentTime = unixtime();
if (auto user = _peer->asUser()) { if (auto user = _peer->asUser()) {
auto result = App::onlineText(user, currentTime, true); auto result = App::onlineText(user, currentTime, true);
@ -349,14 +365,22 @@ void Cover::refreshStatusText() {
return ChatStatusText(fullCount, _onlineCount, true); return ChatStatusText(fullCount, _onlineCount, true);
} else if (auto channel = _peer->asChannel()) { } else if (auto channel = _peer->asChannel()) {
auto fullCount = qMax(channel->membersCount(), 1); auto fullCount = qMax(channel->membersCount(), 1);
return ChatStatusText( auto result = ChatStatusText(
fullCount, fullCount,
_onlineCount, _onlineCount,
channel->isMegagroup()); channel->isMegagroup());
return hasMembersLink ? textcmdLink(1, result) : result;
} }
return lang(lng_chat_status_unaccessible); return lang(lng_chat_status_unaccessible);
}(); }();
_status->setRichText(statusText); _status->setRichText(statusText);
if (hasMembersLink) {
_status->setLink(1, MakeShared<LambdaClickHandler>([=] {
_controller->window()->showSection(Info::Memento(
_controller->peerId(),
Section::Type::Members));
}));
}
refreshStatusGeometry(width()); refreshStatusGeometry(width());
} }

View File

@ -86,6 +86,7 @@ private:
void refreshUploadPhotoOverlay(); void refreshUploadPhotoOverlay();
void setVerified(bool verified); void setVerified(bool verified);
not_null<Controller*> _controller;
not_null<PeerData*> _peer; not_null<PeerData*> _peer;
int _onlineCount = 0; int _onlineCount = 0;

View File

@ -47,7 +47,7 @@ namespace Info {
namespace Profile { namespace Profile {
namespace { namespace {
constexpr auto kEnableSearchMembersAfterCount = 1; constexpr auto kEnableSearchMembersAfterCount = 20;
} // namespace } // namespace