@newtonschool/react_proctoring_library 0.0.86 → 0.0.88

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.
@@ -13,11 +13,11 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
13
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
14
14
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
15
  function ElectronScreenShare(_ref) {
16
+ var _config$fileUploadCon;
16
17
  let {
17
18
  setAskPermissionAction,
18
19
  proctoredContext,
19
- config,
20
- proctorParams
20
+ config
21
21
  } = _ref;
22
22
  const {
23
23
  permissionSetter,
@@ -79,15 +79,17 @@ function ElectronScreenShare(_ref) {
79
79
  streamId: newStreamId
80
80
  });
81
81
  };
82
+ const isRecurring = config === null || config === void 0 ? void 0 : config.recurring;
83
+ const screenShareConfig = config === null || config === void 0 ? void 0 : (_config$fileUploadCon = config.fileUploadConfig) === null || _config$fileUploadCon === void 0 ? void 0 : _config$fileUploadCon.screenShare;
82
84
  (0, _react.useEffect)(() => {
83
- var _config$fileUploadCon;
84
- if (streamDeviceId && config !== null && config !== void 0 && (_config$fileUploadCon = config.fileUploadConfig) !== null && _config$fileUploadCon !== void 0 && _config$fileUploadCon.screenShare && config !== null && config !== void 0 && config.recurring) {
85
+ console.log('streamDeviceId', streamDeviceId);
86
+ if (streamDeviceId && screenShareConfig && isRecurring) {
85
87
  const snapshotIntervalID = startScreenShareSnapshot(streamDeviceId);
86
88
  return () => {
87
89
  endScreenShareSnapshot(snapshotIntervalID);
88
90
  };
89
91
  }
90
- }, [streamDeviceId, config]);
92
+ }, [streamDeviceId, isRecurring, screenShareConfig]);
91
93
  (0, _react.useEffect)(() => {
92
94
  const permissionSetter = permission => {
93
95
  setScreensharePermission(permission);
@@ -44,7 +44,7 @@ const WebWebCam = _ref => {
44
44
  const recurringFetchIntervalRef = (0, _react.useRef)();
45
45
  const {
46
46
  recurring = false,
47
- recurringFetchInterval = 0
47
+ recurringFetchInterval = 30000
48
48
  } = config;
49
49
  const setAudioPermission = permissionSetter.audio;
50
50
  const setVideoPermission = permissionSetter.video;
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtonschool/react_proctoring_library",
3
- "version": "0.0.86",
3
+ "version": "0.0.88",
4
4
  "description": "Used to proctor online tests",
5
5
  "author": "ayushkagrawal,shreyachandra,weastel",
6
6
  "main": "dist/index.js",