-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds tour close #323
- Loading branch information
Showing
25 changed files
with
625 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { TOUR_COMPLETED_CHANNEL } = require('../config/channels'); | ||
const { ERROR_GENERAL } = require('../config/errors'); | ||
const logger = require('../logger'); | ||
|
||
const completeTour = (mainWindow, db) => async (event, { tourName }) => { | ||
try { | ||
// update user in users collection | ||
db.get('user') | ||
.set(`tour.${tourName}`, true) | ||
.write(); | ||
mainWindow.webContents.send(TOUR_COMPLETED_CHANNEL); | ||
} catch (e) { | ||
logger.error(e); | ||
mainWindow.webContents.send(TOUR_COMPLETED_CHANNEL, ERROR_GENERAL); | ||
} | ||
}; | ||
|
||
module.exports = completeTour; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { TOUR_COMPLETED_CHANNEL } from '../config/channels'; | ||
import { ERROR_GENERAL } from '../config/errors'; | ||
import { | ||
INITIALIZE_TOUR, | ||
NAVIGATE_STOP_TOUR, | ||
NEXT_OR_PREV_TOUR, | ||
RESET_TOUR, | ||
RESTART_TOUR, | ||
START_TOUR, | ||
STOP_TOUR, | ||
} from '../types/tour'; | ||
|
||
const nextStepTour = payload => dispatch => | ||
dispatch({ | ||
type: NEXT_OR_PREV_TOUR, | ||
payload, | ||
}); | ||
|
||
const navigateStopTour = payload => dispatch => | ||
dispatch({ | ||
type: NAVIGATE_STOP_TOUR, | ||
payload, | ||
}); | ||
|
||
const stopTour = () => dispatch => | ||
dispatch({ | ||
type: STOP_TOUR, | ||
}); | ||
|
||
const restartTour = () => dispatch => | ||
dispatch({ | ||
type: RESTART_TOUR, | ||
}); | ||
|
||
const startTour = () => dispatch => | ||
dispatch({ | ||
type: START_TOUR, | ||
}); | ||
|
||
const initializeTour = payload => dispatch => | ||
dispatch({ | ||
type: INITIALIZE_TOUR, | ||
payload, | ||
}); | ||
|
||
const resetTour = () => dispatch => | ||
dispatch({ | ||
type: RESET_TOUR, | ||
}); | ||
|
||
const completeTour = async tourName => dispatch => { | ||
try { | ||
dispatch({ | ||
type: RESET_TOUR, | ||
}); | ||
window.ipcRenderer.send(TOUR_COMPLETED_CHANNEL, { tourName }); | ||
window.ipcRenderer.once(TOUR_COMPLETED_CHANNEL, async (event, error) => { | ||
if (error === ERROR_GENERAL) { | ||
console.error(error); | ||
} | ||
}); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
}; | ||
|
||
export { | ||
stopTour, | ||
nextStepTour, | ||
restartTour, | ||
startTour, | ||
navigateStopTour, | ||
resetTour, | ||
completeTour, | ||
initializeTour, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.