mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +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();
|
auto it = _inactiveQuickActions.begin();
|
||||||
while (it != _inactiveQuickActions.end()) {
|
while (it != _inactiveQuickActions.end()) {
|
||||||
const auto raw = it->get();
|
const auto raw = it->get();
|
||||||
if ((!raw->ripple || raw->ripple->empty())
|
if (raw->finishedAt
|
||||||
&& (!raw->rippleFg || raw->rippleFg->empty())) {
|
&& (ms - raw->finishedAt
|
||||||
|
> st::defaultRippleAnimation.hideDuration)) {
|
||||||
_inactiveQuickActions.erase(it);
|
_inactiveQuickActions.erase(it);
|
||||||
} else {
|
} else {
|
||||||
if (raw->data.msgBareId == history->peer->id.value) {
|
if (raw->data.msgBareId == history->peer->id.value) {
|
||||||
|
@ -2347,8 +2348,7 @@ void InnerWidget::mousePressReleased(
|
||||||
raw->action,
|
raw->action,
|
||||||
_filterId);
|
_filterId);
|
||||||
}
|
}
|
||||||
_inactiveQuickActions.push_back(
|
deactivateQuickAction();
|
||||||
QuickActionPtr{ _activeQuickAction.release() });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateSelectedRow();
|
updateSelectedRow();
|
||||||
|
@ -5157,8 +5157,7 @@ not_null<Ui::QuickActionContext*> InnerWidget::ensureQuickAction(int64 key) {
|
||||||
if (_activeQuickAction->data.msgBareId == key) {
|
if (_activeQuickAction->data.msgBareId == key) {
|
||||||
return _activeQuickAction.get();
|
return _activeQuickAction.get();
|
||||||
} else {
|
} else {
|
||||||
_inactiveQuickActions.push_back(
|
deactivateQuickAction();
|
||||||
QuickActionPtr{ _activeQuickAction.release() });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_activeQuickAction = std::make_unique<Ui::QuickActionContext>();
|
_activeQuickAction = std::make_unique<Ui::QuickActionContext>();
|
||||||
|
@ -5204,4 +5203,12 @@ void InnerWidget::clearQuickActions() {
|
||||||
_inactiveQuickActions.clear();
|
_inactiveQuickActions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InnerWidget::deactivateQuickAction() {
|
||||||
|
if (_activeQuickAction) {
|
||||||
|
_activeQuickAction->finishedAt = crl::now();
|
||||||
|
_inactiveQuickActions.push_back(
|
||||||
|
QuickActionPtr{ _activeQuickAction.release() });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Dialogs
|
} // namespace Dialogs
|
||||||
|
|
|
@ -486,6 +486,7 @@ private:
|
||||||
|
|
||||||
[[nodiscard]] not_null<Ui::QuickActionContext*> ensureQuickAction(
|
[[nodiscard]] not_null<Ui::QuickActionContext*> ensureQuickAction(
|
||||||
int64 key);
|
int64 key);
|
||||||
|
void deactivateQuickAction();
|
||||||
|
|
||||||
[[nodiscard]] bool lookupIsInBotAppButton(
|
[[nodiscard]] bool lookupIsInBotAppButton(
|
||||||
Row *row,
|
Row *row,
|
||||||
|
|
|
@ -41,6 +41,7 @@ struct QuickActionContext {
|
||||||
std::unique_ptr<Ui::RippleAnimation> ripple;
|
std::unique_ptr<Ui::RippleAnimation> ripple;
|
||||||
std::unique_ptr<Ui::RippleAnimation> rippleFg;
|
std::unique_ptr<Ui::RippleAnimation> rippleFg;
|
||||||
QuickDialogAction action;
|
QuickDialogAction action;
|
||||||
|
crl::time finishedAt = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Dialogs::Ui
|
} // namespace Dialogs::Ui
|
||||||
|
|
Loading…
Add table
Reference in a new issue