mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Refactored counting idle time.
- psIdleTime() was replaced with Platform::LastUserInputTime(). - _lastTimeVideoPlayedAt was moved to Application as _lastNonIdleTime. - Call of updateNonIdle() was added while voice is recording. - Fixed #5695. - Thanks Preston. =)
This commit is contained in:
@@ -841,6 +841,14 @@ bool Application::passcodeLocked() const {
|
||||
return _passcodeLock.current();
|
||||
}
|
||||
|
||||
void Application::updateNonIdle() {
|
||||
_lastNonIdleTime = crl::now();
|
||||
}
|
||||
|
||||
crl::time Application::lastNonIdleTime() const {
|
||||
return std::max(Platform::LastUserInputTime(), _lastNonIdleTime);
|
||||
}
|
||||
|
||||
rpl::producer<bool> Application::passcodeLockChanges() const {
|
||||
return _passcodeLock.changes();
|
||||
}
|
||||
|
@@ -184,6 +184,9 @@ public:
|
||||
rpl::producer<bool> lockChanges() const;
|
||||
rpl::producer<bool> lockValue() const;
|
||||
|
||||
[[nodiscard]] crl::time lastNonIdleTime() const;
|
||||
void updateNonIdle();
|
||||
|
||||
void registerLeaveSubscription(QWidget *widget);
|
||||
void unregisterLeaveSubscription(QWidget *widget);
|
||||
|
||||
@@ -282,6 +285,8 @@ private:
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
crl::time _lastNonIdleTime = 0;
|
||||
|
||||
};
|
||||
|
||||
Application &App();
|
||||
|
Reference in New Issue
Block a user