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;
linkFontOver: normalFont;
}
}
infoProfileMegagroupStatusLabel: FlatLabel(infoProfileStatusLabel) {
style: defaultTextStyle;
palette: TextPalette(defaultTextPalette) {
linkFg: windowActiveTextFg;
linkFg: windowSubTextFg;
}
}

View File

@ -254,12 +254,6 @@ void TopBar::startHighlightAnimation() {
rpl::producer<QString> TitleValue(
const Section &section,
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([&] {
switch (section.type()) {
case Section::Type::Profile:
@ -298,6 +292,9 @@ rpl::producer<QString> TitleValue(
case Section::Type::CommonGroups:
return lng_profile_common_groups_section;
case Section::Type::Members:
return lng_profile_participants_section;
}
Unexpected("Bad section type in Info::TitleValue()");
}());

View File

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

View File

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

View File

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

View File

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