Skip to content

Commit

Permalink
downgrade to electron v21
Browse files Browse the repository at this point in the history
  • Loading branch information
kemzops committed Mar 14, 2023
1 parent 78c3140 commit 1623976
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"v8-compile-cache": "^2.3.0"
},
"devDependencies": {
"electron": "^22.3.2",
"electron": "^21.4.2",
"electron-builder": "^23.6.0",
"nodemon": "^2.0.21"
},
Expand Down
5 changes: 5 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@

ipcMain?.on('closed', () => win?.close());

// for changing light/dark mode on settings
ipcMain?.on('background', (_, dark) => {
dark ? win?.setBackgroundColor('#2e3338') : win?.setBackgroundColor('#f4f5fb');
});

ipcMain?.on('minimizable', () => {

if (win?.isMaximized()) win?.unmaximize();
Expand Down
6 changes: 3 additions & 3 deletions src/preload/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ window.addEventListener('DOMContentLoaded', async (event) => {
document.getElementById('closed').addEventListener('click', e => ipcRenderer.send('closed'));
document.getElementById('minimizable').addEventListener('click', e => ipcRenderer.send('minimizable'));
document.getElementById('minimize').addEventListener('click', e => ipcRenderer.send('minimize'));

/* DARK/LIGHT MODE */
const settings = fs.readJsonSync(path.join(App_Path, './data/settings.json'));

Expand Down Expand Up @@ -393,7 +393,7 @@ window.addEventListener('DOMContentLoaded', async (event) => {
icon_info.src = '../public/icon/dark/info.png';

let settingsPage = require('./preload_modules/settings.js');
await settingsPage(fs, path, App_Path, settings);
await settingsPage(fs, path, App_Path, settings, ipcRenderer);
break;

case "info.html":
Expand Down Expand Up @@ -495,7 +495,7 @@ window.addEventListener('DOMContentLoaded', async (event) => {
case "settings.html":
variables_css.href = '../public/css/var.css';
let settingsPage = require('./preload_modules/settings.js');
await settingsPage(fs, path, App_Path, settings);
await settingsPage(fs, path, App_Path, settings, ipcRenderer);
break;

case "info.html":
Expand Down
15 changes: 11 additions & 4 deletions src/preload/preload_modules/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function settings(fs, path, App_Path, settings) {
module.exports = function settings(fs, path, App_Path, settings, ipcRenderer) {

let location = fs.readJsonSync(path.join(App_Path, './data/location.json'));

Expand Down Expand Up @@ -41,7 +41,7 @@ module.exports = function settings(fs, path, App_Path, settings) {
function handleVolumeRange(volume) {
volumeValue.innerHTML = volumeRange.value;
}

let adhanVolumeRange = document.getElementById('adhan_volume');
let adhanVolumeValue = document.getElementById('adhan_volume_value');
adhanVolumeRange.addEventListener('input', adhanHandleVolumeRange)
Expand All @@ -57,6 +57,9 @@ module.exports = function settings(fs, path, App_Path, settings) {

save.addEventListener('click', e => {

dark_mode?.checked ? ipcRenderer.send('background', true)
: ipcRenderer.send('background', false)

if (latitude.value !== '') {

location.lat = Number(latitude.value)
Expand Down Expand Up @@ -99,9 +102,13 @@ module.exports = function settings(fs, path, App_Path, settings) {
adhanVolume: adhanVolumeRange.value / 100
}, { spaces: '\t' });


alrt.style.display = 'inline-flex';
setTimeout(() => { alrt.style.display = 'none'; }, 1000);
setTimeout(() => {
alrt.style.display = 'none';
window.location.href = "./settings.html";
}, 1000);

})

}

0 comments on commit 1623976

Please sign in to comment.