desktopManager window blur event

This commit is contained in:
Mo Bitar
2018-12-16 15:25:14 -06:00
parent 31d44af52e
commit 0ce88bc929
4 changed files with 30 additions and 7 deletions

View File

@@ -79,6 +79,10 @@ class DesktopManager {
this.searchHandler = handler;
}
desktop_windowLostFocus() {
this.$rootScope.$broadcast("window-lost-focus");
}
desktop_onComponentInstallationComplete(componentData, error) {
console.log("Web|Component Installation/Update Complete", componentData, error);

View File

@@ -1,9 +1,20 @@
class PasscodeManager {
constructor(authManager, storageManager) {
document.addEventListener('visibilitychange', (e) => {
this.documentVisibilityChanged(document.visibilityState);
});
constructor($rootScope, authManager, storageManager) {
if(isDesktopApplication()) {
// desktop only
$rootScope.$on("window-lost-focus", () => {
let visible = false;
this.documentVisibilityChanged(visible);
})
} else {
// tab visibility listender, web only
document.addEventListener('visibilitychange', (e) => {
let visible = document.visibilityState == "visible";
this.documentVisibilityChanged(visible);
});
}
this.authManager = authManager;
this.storageManager = storageManager;
@@ -13,6 +24,7 @@ class PasscodeManager {
const MillisecondsPerSecond = 1000;
PasscodeManager.AutoLockIntervalNone = 0;
PasscodeManager.AutoLockIntervalImmediate = 1;
PasscodeManager.AutoLockIntervalOneMinute = 60 * MillisecondsPerSecond;
PasscodeManager.AutoLockIntervalFiveMinutes = 300 * MillisecondsPerSecond;
PasscodeManager.AutoLockIntervalOneHour = 3600 * MillisecondsPerSecond;
@@ -26,6 +38,10 @@ class PasscodeManager {
value: PasscodeManager.AutoLockIntervalNone,
label: "None"
},
{
value: PasscodeManager.AutoLockIntervalImmediate,
label: "Immediately"
},
{
value: PasscodeManager.AutoLockIntervalOneMinute,
label: "1 Min"
@@ -41,8 +57,7 @@ class PasscodeManager {
]
}
documentVisibilityChanged(visbility) {
let visible = document.visibilityState == "visible";
documentVisibilityChanged(visible) {
if(!visible) {
this.beginAutoLockTimer();
} else {

View File

@@ -53,3 +53,7 @@
opacity: 1.0
}
}
button.sk-button {
border: none;
}

View File

@@ -148,7 +148,7 @@
.sk-horizontal-group
.sk-h4.sk-bold Autolock
%a.sk-a.info{"ng-repeat" => "option in passcodeAutoLockOptions", "ng-click" => "selectAutoLockInterval(option.value)",
"ng-class" => "{'info boxed' : option.value == selectedAutoLockInterval}"}
"ng-class" => "{'boxed' : option.value == selectedAutoLockInterval}"}
{{option.label}}
.sk-p The autolock timer begins when the window or tab loses focus.