Skip to content

Commit

Permalink
Fix blank screen after scan complete and ensure default values are pr…
Browse files Browse the repository at this point in the history
…esent in userData file (#22)

* Ensure mandatory fields are set in userData.txt

* Fix blank screen after scan
  • Loading branch information
greyguy21 authored Aug 24, 2023
1 parent a8da7b4 commit e07bf43
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
17 changes: 17 additions & 0 deletions public/electron/userDataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,25 @@ const init = async () => {
exportDir: defaultExportDir
};
fs.writeFileSync(userDataFilePath, JSON.stringify(defaultSettings));
} else {
// check if mandatory fields are set
const userData = JSON.parse(fs.readFileSync(userDataFilePath));
if (!userData.exportDir) {
userData.exportDir = defaultExportDir;
}
if (!userData.name) {
userData.name = "";
}
if (!userData.email) {
userData.email = "";
}
if (!userData.browser) {
userData.browser = proxy ? "edge" : "chrome";
}
fs.writeFileSync(userDataFilePath, JSON.stringify(userData));
}


ipcMain.handle("getUserData", (_event) => {
const data = readUserDataFromFile();
return data;
Expand Down
5 changes: 3 additions & 2 deletions src/MainWindow/ResultPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ const ResultPage = ({ completedScanId: scanId }) => {
const [showCustomFlowReplayButton, setShowCustomFlowReplayButton] = useState(false);

useEffect(() => {
console.log('is custom flow: ', state);
setShowCustomFlowReplayButton(state.isCustomScan);
if (state && state.isCustomScan) {
setShowCustomFlowReplayButton(state.isCustomScan);
}
}, [])

useEffect(() => {
Expand Down

0 comments on commit e07bf43

Please sign in to comment.