fix: correctly start and stop autolock timer

This commit is contained in:
Baptiste Grob
2020-09-18 12:07:18 +02:00
parent 2cbff5982a
commit 9036beb3f3
2 changed files with 7 additions and 3 deletions

View File

@@ -56,17 +56,16 @@ export class AppState {
this.$timeout = $timeout;
this.$rootScope = $rootScope;
this.application = application;
this.registerVisibilityObservers();
this.addAppEventObserver();
this.streamNotesAndTags();
const onVisibilityChange = () => {
this.onVisibilityChange = () => {
const visible = document.visibilityState === "visible";
const event = visible
? AppStateEvent.WindowDidFocus
: AppStateEvent.WindowDidBlur;
this.notifyEvent(event);
}
this.onVisibilityChange = onVisibilityChange.bind(this);
this.registerVisibilityObservers();
}
deinit() {