Skip to content

Commit a36f011

Browse files
committed
fix: idle time not being tracked when option is disabled #56
1 parent 4a56ccd commit a36f011

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

app-src/scripts/main/global-services/time-tracking-s.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,15 @@
7373
}
7474

7575
handleIdle() {
76-
window.ipcRenderer.on(IPC_EVENT_IDLE_TIME, (ev, idleTime) => {
77-
if (idleTime > this.$rootScope.r.config.minIdleTimeInMs) {
76+
window.ipcRenderer.on(IPC_EVENT_IDLE_TIME, (ev, idleTimeInMs) => {
77+
// don't run if option is not enabled
78+
if (!this.$rootScope.r.config.isEnableIdleTimeTracking) {
79+
this.isIdle = false;
80+
return;
81+
}
82+
const minIdleTimeInMs = moment.duration(this.$rootScope.r.config.minIdleTime).asMilliseconds();
83+
84+
if (idleTimeInMs > minIdleTimeInMs) {
7885
this.isIdle = true;
7986
this.$rootScope.$broadcast(this.EV.IS_IDLE);
8087

@@ -84,8 +91,8 @@
8491
if (!this.isIdleDialogOpen) {
8592
this.isIdleDialogOpen = true;
8693
this.Dialogs('WAS_IDLE', {
87-
initialIdleTime: idleTime,
88-
minIdleTimeInMs: this.$rootScope.r.config.minIdleTimeInMs,
94+
initialIdleTime: idleTimeInMs,
95+
minIdleTimeInMs: minIdleTimeInMs,
8996
})
9097
.then(() => {
9198
// if tracked

app-src/scripts/settings/misc-settings/misc-settings-d.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h2 class="md-title">
4747
<div>
4848
<md-switch ng-model="vm.settings.isEnableIdleTimeTracking"
4949
aria-label="Enable idle time tracking">
50-
Enable idle time handling
50+
Enable idle time handling (when idle, open dialog on what to track)
5151
</md-switch>
5252
</div>
5353

0 commit comments

Comments
 (0)