mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-03 21:54:05 +02:00
Added maximum of lifetime to every deactivated quick dialog action.
This commit is contained in:
parent
c085691c54
commit
838711e2ac
3 changed files with 15 additions and 6 deletions
|
@ -848,8 +848,9 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
|||
auto it = _inactiveQuickActions.begin();
|
||||
while (it != _inactiveQuickActions.end()) {
|
||||
const auto raw = it->get();
|
||||
if ((!raw->ripple || raw->ripple->empty())
|
||||
&& (!raw->rippleFg || raw->rippleFg->empty())) {
|
||||
if (raw->finishedAt
|
||||
&& (ms - raw->finishedAt
|
||||
> st::defaultRippleAnimation.hideDuration)) {
|
||||
_inactiveQuickActions.erase(it);
|
||||
} else {
|
||||
if (raw->data.msgBareId == history->peer->id.value) {
|
||||
|
@ -2347,8 +2348,7 @@ void InnerWidget::mousePressReleased(
|
|||
raw->action,
|
||||
_filterId);
|
||||
}
|
||||
_inactiveQuickActions.push_back(
|
||||
QuickActionPtr{ _activeQuickAction.release() });
|
||||
deactivateQuickAction();
|
||||
}
|
||||
}
|
||||
updateSelectedRow();
|
||||
|
@ -5157,8 +5157,7 @@ not_null<Ui::QuickActionContext*> InnerWidget::ensureQuickAction(int64 key) {
|
|||
if (_activeQuickAction->data.msgBareId == key) {
|
||||
return _activeQuickAction.get();
|
||||
} else {
|
||||
_inactiveQuickActions.push_back(
|
||||
QuickActionPtr{ _activeQuickAction.release() });
|
||||
deactivateQuickAction();
|
||||
}
|
||||
}
|
||||
_activeQuickAction = std::make_unique<Ui::QuickActionContext>();
|
||||
|
@ -5204,4 +5203,12 @@ void InnerWidget::clearQuickActions() {
|
|||
_inactiveQuickActions.clear();
|
||||
}
|
||||
|
||||
void InnerWidget::deactivateQuickAction() {
|
||||
if (_activeQuickAction) {
|
||||
_activeQuickAction->finishedAt = crl::now();
|
||||
_inactiveQuickActions.push_back(
|
||||
QuickActionPtr{ _activeQuickAction.release() });
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Dialogs
|
||||
|
|
|
@ -486,6 +486,7 @@ private:
|
|||
|
||||
[[nodiscard]] not_null<Ui::QuickActionContext*> ensureQuickAction(
|
||||
int64 key);
|
||||
void deactivateQuickAction();
|
||||
|
||||
[[nodiscard]] bool lookupIsInBotAppButton(
|
||||
Row *row,
|
||||
|
|
|
@ -41,6 +41,7 @@ struct QuickActionContext {
|
|||
std::unique_ptr<Ui::RippleAnimation> ripple;
|
||||
std::unique_ptr<Ui::RippleAnimation> rippleFg;
|
||||
QuickDialogAction action;
|
||||
crl::time finishedAt = 0;
|
||||
};
|
||||
|
||||
} // namespace Dialogs::Ui
|
||||
|
|
Loading…
Add table
Reference in a new issue