@newtonschool/react_proctoring_library 0.0.85 → 0.0.87
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.
|
@@ -4,20 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useCleanupPermissions = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _permission = require("../utils/permission");
|
|
9
8
|
const useCleanupPermissions = _ref => {
|
|
10
9
|
let {
|
|
11
|
-
|
|
10
|
+
proctoredContextData
|
|
12
11
|
} = _ref;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
permissionSetter,
|
|
17
|
-
streamSetter,
|
|
18
|
-
allPermissionGrantedOnce
|
|
19
|
-
} = (0, _react.useContext)(proctoredContext);
|
|
12
|
+
if (!proctoredContextData) {
|
|
13
|
+
return () => {};
|
|
14
|
+
}
|
|
20
15
|
const cleanupPermissions = () => {
|
|
16
|
+
const {
|
|
17
|
+
references,
|
|
18
|
+
screenshareStream,
|
|
19
|
+
permissionSetter,
|
|
20
|
+
streamSetter,
|
|
21
|
+
allPermissionGrantedOnce
|
|
22
|
+
} = proctoredContextData;
|
|
21
23
|
const screenShareReference = references.screenshareReference;
|
|
22
24
|
const setScreensharePermission = permissionSetter.screenshare;
|
|
23
25
|
const setScreenshareStream = streamSetter.screenshare;
|
|
@@ -10,13 +10,14 @@ function useGenericSleepDetected() {
|
|
|
10
10
|
const [deviceWentToSleepCount, setDeviceWentToSleepCount] = (0, _react.useState)(0);
|
|
11
11
|
(0, _react.useEffect)(() => {
|
|
12
12
|
var lastTime = new Date().getTime();
|
|
13
|
-
setInterval(function () {
|
|
13
|
+
const intervalId = setInterval(function () {
|
|
14
14
|
var currentTime = new Date().getTime();
|
|
15
15
|
if (currentTime > lastTime + 2000 * 2) {
|
|
16
16
|
setDeviceWentToSleepCount(cnt => cnt + 1);
|
|
17
17
|
}
|
|
18
18
|
lastTime = currentTime;
|
|
19
19
|
}, 2000);
|
|
20
|
+
return () => clearInterval(intervalId);
|
|
20
21
|
}, []);
|
|
21
22
|
return deviceWentToSleepCount;
|
|
22
23
|
}
|