@newtonschool/react_proctoring_library 0.0.93 → 0.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/screenshare-activity-tracker/electron.js +1 -3
- package/dist/hooks/electron/useKioskMode.js +13 -1
- package/dist/hooks/electron/usePageVisibility.js +8 -2
- package/package.json +1 -1
- package/dist/hooks/electron/useIsPageFocussed.js +0 -25
- package/dist/hooks/useGenericPageFocus.js +0 -17
|
@@ -95,9 +95,7 @@ function ElectronScreenShare(_ref) {
|
|
|
95
95
|
const permissionSetter = permission => {
|
|
96
96
|
setScreensharePermission(permission);
|
|
97
97
|
};
|
|
98
|
-
window.electron.states.isScreenShareRecordingStarted(streamDeviceId)
|
|
99
|
-
permissionSetter(recordingStarted);
|
|
100
|
-
});
|
|
98
|
+
window.electron.states.isScreenShareRecordingStarted(streamDeviceId);
|
|
101
99
|
const id = window.electron.listener.screenShareRecordingStatusChanged(streamDeviceId, permissionSetter);
|
|
102
100
|
return () => {
|
|
103
101
|
window.electron.listener.removeListener(id, permissionSetter);
|
|
@@ -7,9 +7,12 @@ exports.default = useKioskMode;
|
|
|
7
7
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _ElectronContext = require("../../contexts/ElectronContext");
|
|
10
|
+
var _usePageVisibility = _interopRequireDefault(require("./usePageVisibility"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
12
|
function useKioskMode() {
|
|
11
13
|
const [connectedToInternet, setConnectedToInternet] = (0, _react.useState)(true);
|
|
12
14
|
const isElectronApp = (0, _react.useContext)(_ElectronContext.ElectronContext);
|
|
15
|
+
const isPageVisibile = (0, _usePageVisibility.default)();
|
|
13
16
|
(0, _react.useEffect)(() => {
|
|
14
17
|
const updateOnlineStatus = () => {
|
|
15
18
|
setConnectedToInternet(window.navigator.onLine);
|
|
@@ -29,5 +32,14 @@ function useKioskMode() {
|
|
|
29
32
|
var _window$electron, _window$electron$acti;
|
|
30
33
|
(_window$electron = window.electron) === null || _window$electron === void 0 ? void 0 : (_window$electron$acti = _window$electron.actions) === null || _window$electron$acti === void 0 ? void 0 : _window$electron$acti.disableKioskMode();
|
|
31
34
|
}
|
|
32
|
-
}, [isElectronApp, connectedToInternet]);
|
|
35
|
+
}, [isElectronApp, connectedToInternet, isPageVisibile]);
|
|
36
|
+
(0, _react.useEffect)(() => {
|
|
37
|
+
if (isPageVisibile) {
|
|
38
|
+
var _window$electron2, _window$electron2$act;
|
|
39
|
+
if ((_window$electron2 = window.electron) !== null && _window$electron2 !== void 0 && (_window$electron2$act = _window$electron2.actions) !== null && _window$electron2$act !== void 0 && _window$electron2$act.forceFocus) {
|
|
40
|
+
var _window$electron3, _window$electron3$act;
|
|
41
|
+
(_window$electron3 = window.electron) === null || _window$electron3 === void 0 ? void 0 : (_window$electron3$act = _window$electron3.actions) === null || _window$electron3$act === void 0 ? void 0 : _window$electron3$act.forceFocus();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [isPageVisibile]);
|
|
33
45
|
}
|
|
@@ -7,19 +7,25 @@ exports.default = usePageVisibility;
|
|
|
7
7
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _ElectronContext = require("../../contexts/ElectronContext");
|
|
10
|
-
function usePageVisibility(
|
|
10
|
+
function usePageVisibility() {
|
|
11
11
|
const [isPageFocused, setIsPageFocused] = (0, _react.useState)(true);
|
|
12
|
+
const [isPageVisible, setIsPageVisible] = (0, _react.useState)(true);
|
|
12
13
|
const isElectronApp = (0, _react.useContext)(_ElectronContext.ElectronContext);
|
|
13
14
|
(0, _react.useEffect)(() => {
|
|
14
15
|
if (isElectronApp) {
|
|
15
16
|
const isPageFocusChanged = isPageFocused => {
|
|
16
17
|
setIsPageFocused(isPageFocused);
|
|
17
18
|
};
|
|
19
|
+
const isPageVisibilityChanged = isPageVisible => {
|
|
20
|
+
setIsPageVisible(isPageVisible);
|
|
21
|
+
};
|
|
18
22
|
const signal = window.electron.listener.isPageFocusedChanged(isPageFocusChanged);
|
|
23
|
+
const visibilitySignal = window.electron.listener.isPageVisibilityChanged(isPageVisibilityChanged);
|
|
19
24
|
return () => {
|
|
20
25
|
window.electron.listener.removeListener(signal, isPageFocusChanged);
|
|
26
|
+
window.electron.listener.removeListener(visibilitySignal, isPageVisibilityChanged);
|
|
21
27
|
};
|
|
22
28
|
}
|
|
23
29
|
}, [isElectronApp]);
|
|
24
|
-
return isPageFocused &&
|
|
30
|
+
return isPageFocused && isPageVisible;
|
|
25
31
|
}
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useIsPageFocussed;
|
|
7
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _ElectronContext = require("../../contexts/ElectronContext");
|
|
10
|
-
function useIsPageFocussed(isProctorParam) {
|
|
11
|
-
const [isPageFocussed, setIsPageFocussed] = (0, _react.useState)(true);
|
|
12
|
-
const isElectronApp = (0, _react.useContext)(_ElectronContext.ElectronContext);
|
|
13
|
-
(0, _react.useEffect)(() => {
|
|
14
|
-
if (isElectronApp) {
|
|
15
|
-
const pageFocusChangeHandler = isPageFocused => {
|
|
16
|
-
setIsPageFocussed(isPageFocused);
|
|
17
|
-
};
|
|
18
|
-
const signal = window.electron.listener.isPageFocusedChanged(pageFocusChangeHandler);
|
|
19
|
-
return () => {
|
|
20
|
-
window.electron.listener.removeListener(signal, pageFocusChangeHandler);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}, [isElectronApp]);
|
|
24
|
-
return isPageFocussed && isProctorParam;
|
|
25
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useGenericPageFocus;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _ElectronContext = require("../contexts/ElectronContext");
|
|
9
|
-
var _useIsPageFocussed = _interopRequireDefault(require("./web/useIsPageFocussed"));
|
|
10
|
-
var _useIsPageFocussed2 = _interopRequireDefault(require("./electron/useIsPageFocussed"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function useGenericPageFocus(isProctorParam) {
|
|
13
|
-
const isElectronApp = (0, _react.useContext)(_ElectronContext.ElectronContext);
|
|
14
|
-
const webIsPageFocussed = (0, _useIsPageFocussed.default)(isProctorParam);
|
|
15
|
-
const electronIsPageFocused = (0, _useIsPageFocussed2.default)(isProctorParam);
|
|
16
|
-
return isElectronApp ? electronIsPageFocused : webIsPageFocussed;
|
|
17
|
-
}
|