@newtonschool/react_proctoring_library 0.0.108 → 0.0.109

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.
@@ -24,7 +24,10 @@ const OpenHeimdall = _ref => {
24
24
  const {
25
25
  permissionSetter,
26
26
  setPermissionErrors,
27
- endTimeStamp
27
+ downloadHeimdallUrl,
28
+ endTimeStamp,
29
+ setShouldShowDownloadHeimdallButton,
30
+ setIsHeimdallSuccessfullyInstalledByScript
28
31
  } = (0, _react.useContext)(proctoredContext);
29
32
  (0, _react.useEffect)(() => {
30
33
  if (endTimeStamp) {
@@ -41,6 +44,14 @@ const OpenHeimdall = _ref => {
41
44
  openHeimdall: async () => {
42
45
  await window.electron.actions.openHeimdall();
43
46
  window.electron.actions.sendFileUploadConfig(config.fileUploadConfig);
47
+ },
48
+ downloadHeimdall: async () => {
49
+ if (downloadHeimdallUrl.current) {
50
+ const res = await window.electron.actions.downloadHeimdall(downloadHeimdallUrl.current);
51
+ if (res.success) {
52
+ setIsHeimdallSuccessfullyInstalledByScript(true);
53
+ }
54
+ }
44
55
  }
45
56
  }));
46
57
  window.electron.actions.onHeimdallStatusChange(status => {
@@ -56,6 +67,9 @@ const OpenHeimdall = _ref => {
56
67
  console.log(error);
57
68
  }
58
69
  });
70
+ window.electron.checkIsHeimdallInstalled().then(isInstalled => {
71
+ setShouldShowDownloadHeimdallButton(!isInstalled);
72
+ });
59
73
  }, []);
60
74
  return null;
61
75
  };
@@ -63,7 +63,8 @@ const ProctorApp = _ref => {
63
63
  fullscreen: () => {},
64
64
  video: () => {},
65
65
  audio: () => {},
66
- openHeimdall: () => {}
66
+ openHeimdall: () => {},
67
+ downloadHeimdall: () => {}
67
68
  });
68
69
  (0, _react.useEffect)(() => {
69
70
  acquireWakeUpLock();
@@ -39,6 +39,9 @@ const ProctoredContextApp = _ref => {
39
39
  const [screenShareDeviceId, setScreenShareDeviceId] = (0, _react.useState)();
40
40
  const [audioPermisison, setAudioPermission] = (0, _react.useState)();
41
41
  const [videoPermission, setVideoPermission] = (0, _react.useState)();
42
+ const [shouldShowDownloadHeimdallButton, setShouldShowDownloadHeimdallButton] = (0, _react.useState)(false);
43
+ const [isHeimdallSuccessfullyInstalledByScript, setIsHeimdallSuccessfullyInstalledByScript] = (0, _react.useState)(false);
44
+ const downloadHeimdallUrl = (0, _react.useRef)(null);
42
45
  const allPermissionGrantedOnce = (0, _react.useRef)(false);
43
46
  const [permissionErrors, setPermissionErrors] = (0, _react.useState)({
44
47
  audio: null,
@@ -97,7 +100,12 @@ const ProctoredContextApp = _ref => {
97
100
  screenshareReference
98
101
  },
99
102
  screenshareStream,
100
- forceUpdate
103
+ forceUpdate,
104
+ shouldShowDownloadHeimdallButton,
105
+ setShouldShowDownloadHeimdallButton,
106
+ isHeimdallSuccessfullyInstalledByScript,
107
+ setIsHeimdallSuccessfullyInstalledByScript,
108
+ downloadHeimdallUrl
101
109
  }),
102
110
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ElectronContext.ElectronContextProvider, {
103
111
  value: isElectronApp,
@@ -44,7 +44,8 @@ const proctorParamsToPermission = exports.proctorParamsToPermission = {
44
44
  webcamSnapshots: 'video',
45
45
  screenshareSnapshots: 'screenshare',
46
46
  audio: 'audio',
47
- openHeimdall: 'openHeimdall'
47
+ openHeimdall: 'openHeimdall',
48
+ downloadHeimdall: 'downloadHeimdall'
48
49
  };
49
50
  const evaluateVideoIntervalInSeconds = exports.evaluateVideoIntervalInSeconds = 5;
50
51
  const gpuTypes = exports.gpuTypes = ['intel', 'apple', 'amd', 'radeon', 'nvidia', 'geforce'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtonschool/react_proctoring_library",
3
- "version": "0.0.108",
3
+ "version": "0.0.109",
4
4
  "description": "Used to proctor online tests",
5
5
  "author": "ayushkagrawal,shreyachandra,weastel",
6
6
  "main": "dist/index.js",