Skip to content

Commit b8ef939

Browse files
Shanon LeeShanon Lee
authored andcommitted
Add conditional execution of deeplink to only execute in production mode. Dev mode & production mode OK.
1 parent 931a92c commit b8ef939

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

src-electron/electron-main.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ let authCode;
2626
const protocol = isDev ? "overvuedev" : "overvue";
2727

2828
// Used to console log for main process in production mode
29-
// const deeplink = new Deeplink({
30-
// app,
31-
// mainWindow,
32-
// protocol,
33-
// isDev,
34-
// debugLogging: true,
35-
// // electronPath: '/node_modules/electron/dist/Electron.app'
36-
// });
29+
// ** Only works on production level application; throws errors if you run quasar dev
30+
if (process.env.PROD) {
31+
const deeplink = new Deeplink({
32+
app,
33+
mainWindow,
34+
protocol,
35+
isDev,
36+
debugLogging: true,
37+
// electronPath: '/node_modules/electron/dist/Electron.app'
38+
});
39+
}
3740

3841
// Sends request to Slack for User's information,
3942
// then sends user information back to renderer process
@@ -105,17 +108,17 @@ function getSlackUser (token, userId) {
105108
request.end()
106109
}
107110

108-
// function setOauthListener() {
109-
// // logEverywhere(`process.env.SLACK_CLIENT_ID in electron-main: ${process.env.SLACK_CLIENT_ID}`);
110-
// // logEverywhere(`process.env.SLACK_CLIENT_SECRET in electron-main: ${process.env.SLACK_CLIENT_SECRET}`);
111+
function setOauthListener() {
112+
// logEverywhere(`process.env.SLACK_CLIENT_ID in electron-main: ${process.env.SLACK_CLIENT_ID}`);
113+
// logEverywhere(`process.env.SLACK_CLIENT_SECRET in electron-main: ${process.env.SLACK_CLIENT_SECRET}`);
111114

112-
// return deeplink.on("received", link => {
113-
// // logEverywhere(`auth worked here link: ${link}`);
114-
// // Extracts Slack authorization code from deep link
115-
// authCode = link.split("=")[1];
116-
// sendTokenRequest();
117-
// });
118-
// }
115+
return deeplink.on("received", link => {
116+
// logEverywhere(`auth worked here link: ${link}`);
117+
// Extracts Slack authorization code from deep link
118+
authCode = link.split("=")[1];
119+
sendTokenRequest();
120+
});
121+
}
119122

120123

121124
// ********************* Default *****************
@@ -163,6 +166,7 @@ app.on('window-all-closed', () => {
163166

164167
app.on('activate', () => {
165168
if (mainWindow === null) {
166-
createWindow()
169+
createWindow();
170+
setOauthListener();
167171
}
168172
})

0 commit comments

Comments
 (0)