Show bar waves from any member-s level.

This commit is contained in:
John Preston 2020-12-09 13:08:36 +04:00
parent 468597f54d
commit e523687328
4 changed files with 22 additions and 13 deletions

View File

@ -3981,6 +3981,7 @@ void ApiWrap::forwardMessages(
++shared->requestsLeft;
}
const auto requestType = Data::Histories::RequestType::Send;
const auto idsCopy = localIds;
histories.sendRequest(history, requestType, [=](Fn<void()> finish) {
history->sendRequestId = request(MTPmessages_ForwardMessages(
MTP_flags(sendFlags),
@ -3995,9 +3996,9 @@ void ApiWrap::forwardMessages(
shared->callback();
}
finish();
}).fail([=, ids = localIds](const RPCError &error) {
if (ids) {
for (const auto &[randomId, itemId] : *ids) {
}).fail([=](const RPCError &error) {
if (idsCopy) {
for (const auto &[randomId, itemId] : *idsCopy) {
sendMessageFail(error, peer, randomId, itemId);
}
} else {

View File

@ -43,6 +43,7 @@ constexpr auto kMinorBlobAlpha = 76. / 255.;
constexpr auto kBlobLevelDuration1 = 250;
constexpr auto kBlobLevelDuration2 = 120;
constexpr auto kBlobUpdateInterval = crl::time(100);
auto LinearBlobs() -> std::array<Ui::Paint::LinearBlobs::BlobData, 3> {
return { {
@ -231,7 +232,9 @@ TopBar::TopBar(
kBlobLevelDuration1,
kBlobLevelDuration2,
1.))
, _gradients(Colors(), QPointF(), QPointF()) {
, _blobsLevelTimer([=] { _blobsLastLevel = 0.; })
, _gradients(Colors(), QPointF(), QPointF())
, _updateDurationTimer([=] { updateDurationText(); }) {
initControls();
resize(width(), st::callBarHeight);
}
@ -346,7 +349,6 @@ void TopBar::initControls() {
BoxContext::MainWindow));
}
});
_updateDurationTimer.setCallback([this] { updateDurationText(); });
updateDurationText();
initBlobs();
@ -394,7 +396,7 @@ void TopBar::initBlobs() {
return false;
}) | rpl::distinct_until_changed()
) | rpl::map([](bool animDisabled, bool hide, bool isBadState) {
return isBadState || !(!animDisabled && !hide);
return isBadState || animDisabled || hide;
});
std::move(
@ -407,6 +409,12 @@ void TopBar::initBlobs() {
if (!hide && !_blobsAnimation.animating()) {
_blobsAnimation.start();
}
if (hide) {
_blobsLevelTimer.cancel();
} else {
_blobsLastLevel = 0.;
_blobsLevelTimer.callEach(kBlobUpdateInterval);
}
const auto from = hide ? 0. : 1.;
const auto to = hide ? 1. : 0.;
@ -465,12 +473,10 @@ void TopBar::initBlobs() {
_groupCall->levelUpdates(
) | rpl::filter([=](const LevelUpdate &update) {
return update.self;
return !*hideLastTime && (update.value > _blobsLastLevel);
}) | rpl::start_with_next([=](const LevelUpdate &update) {
if (*hideLastTime) {
return;
}
_blobsPaint->setLevel(update.value);
_blobsLastLevel = update.value;
_blobsPaint->setLevel(_blobsLastLevel);
}, _blobs->lifetime());
_blobs->setAttribute(Qt::WA_TransparentForMouseEvents);

View File

@ -80,6 +80,8 @@ private:
object_ptr<Ui::IconButton> _hangup;
base::unique_qptr<Ui::RpWidget> _blobs;
std::unique_ptr<Ui::Paint::LinearBlobs> _blobsPaint;
float _blobsLastLevel = 0.;
base::Timer _blobsLevelTimer;
QBrush _groupBrush;
anim::linear_gradients<MuteState> _gradients;

View File

@ -108,8 +108,8 @@ auto GenerateCodes() {
if (const auto strong = weak.get()) {
loadFor(strong);
} else {
for (const auto &[index, account] : Core::App().domain().accounts()) {
loadFor(account.get());
for (const auto &pair : Core::App().domain().accounts()) {
loadFor(pair.account.get());
}
}
}