Skip to content

Commit

Permalink
Option to edit adhkar voice time
Browse files Browse the repository at this point in the history
  • Loading branch information
kemzops committed Mar 14, 2023
1 parent 0804b23 commit 178c0c6
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 19 deletions.
42 changes: 40 additions & 2 deletions src/pages/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ <h3 class="settings_title">
</h3>

<p class="settings_description">
أدخِل المنطقة الزمنية (بالإنجليزية: Time zone) الخاص بدولتك
أدخِل المنطقة الزمنية (بالإنجليزية: Time zone) الخاص بدولتك
</p>
</div>

Expand All @@ -158,7 +158,7 @@ <h3 class="settings_title">
</h3>

<p class="settings_description">
أدخِل طريقة حساب أوقات الصلاة (ام القرى , رابطة العالم الإسلامي ,الهيئة المصرية العامة للمساحة الخ ...)
أدخِل طريقة حساب أوقات الصلاة (ام القرى, رابطة العالم الإسلامي, الخ ...)
</p>
</div>

Expand All @@ -182,6 +182,44 @@ <h3 class="settings_title">

<!-- ======= -->

<li>

<div class="settings_right">
<h3 class="settings_title">
وقت أذكار الصباح
</h3>

<p class="settings_description">
وقت التنبيه الصوتي بأذكار الصباح (PM مساء / AM صباح)
</p>
</div>

<div class="settings_left">
<input type="time" id="morning_adhkar_time">
</div>

</li>

<li>

<div class="settings_right">
<h3 class="settings_title">
وقت أذكار المساء
</h3>

<p class="settings_description">
وقت التنبيه الصوتي بأذكار المساء (PM مساء / AM صباح)
</p>
</div>

<div class="settings_left">
<input type="time" id="evening_adhkar_time">
</div>

</li>

<!-- ======= -->

<li>

<div class="settings_right">
Expand Down
27 changes: 14 additions & 13 deletions src/preload/audio_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ const adhanModule = require('../modules/adhan.js')

window.addEventListener('DOMContentLoaded', async (e) => {
e.preventDefault();

let App_Path = await ipcRenderer?.invoke('App_Path3');
let location = fs.readJsonSync(path.join(App_Path, './data/location.json'));
let settings = fs.readJsonSync(path.join(App_Path, './data/settings.json'));
let audioJson = fs.readJsonSync(path.join(App_Path, './data/audio_window.json'));
let variables_css = document.getElementById("variables_css");
let icon_closed_window = document.getElementById("icon_closed_window");

Expand Down Expand Up @@ -38,12 +36,15 @@ window.addEventListener('DOMContentLoaded', async (e) => {

while (true) {

await new Promise(resolve => setTimeout(resolve, 60000));

await new Promise(resolve => setTimeout(resolve, 30000));
let audioJson = fs.readJsonSync(path.join(App_Path, './data/audio_window.json'));
let location = fs.readJsonSync(path.join(App_Path, './data/location.json'));
let settings = fs.readJsonSync(path.join(App_Path, './data/settings.json'));
let data = adhanModule(path, fs, App_Path, location);
let time_now = moment().tz(location?.timezone).format('LT');
let time_now_adhan = moment().tz(location?.timezone).format('LT');
let time_now_adhkar = moment().tz(location?.timezone).format('HH:mm');

if (time_now === data.fajr && audioJson?.start === false && settings?.notifications_adhan) {
if (time_now_adhan === data.fajr && audioJson?.start === false && settings?.notifications_adhan) {
audioBoolean(App_Path, true);
ipcRenderer.send('show3');
document.getElementById('text').innerText = 'حان الان وقت صلاة الفجر'
Expand All @@ -55,7 +56,7 @@ window.addEventListener('DOMContentLoaded', async (e) => {
}, 600000);
}

else if (time_now === data.dhuhr && audioJson?.start === false && settings?.notifications_adhan) {
else if (time_now_adhan === data.dhuhr && audioJson?.start === false && settings?.notifications_adhan) {
audioBoolean(App_Path, true);
ipcRenderer.send('show3');
document.getElementById('text').innerText = 'حان الان وقت صلاة الظهر'
Expand All @@ -67,7 +68,7 @@ window.addEventListener('DOMContentLoaded', async (e) => {
}, 600000);
}

else if (time_now === data.asr && audioJson?.start === false && settings?.notifications_adhan) {
else if (time_now_adhan === data.asr && audioJson?.start === false && settings?.notifications_adhan) {
audioBoolean(App_Path, true);
ipcRenderer.send('show3');
document.getElementById('text').innerText = 'حان الان وقت صلاة العصر'
Expand All @@ -79,7 +80,7 @@ window.addEventListener('DOMContentLoaded', async (e) => {
}, 600000);
}

else if (time_now === data.maghrib && audioJson?.start === false && settings?.notifications_adhan) {
else if (time_now_adhan === data.maghrib && audioJson?.start === false && settings?.notifications_adhan) {
audioBoolean(App_Path, true);
ipcRenderer.send('show3');
document.getElementById('text').innerText = 'حان الان وقت صلاة المغرب'
Expand All @@ -91,7 +92,7 @@ window.addEventListener('DOMContentLoaded', async (e) => {
}, 600000);
}

else if (time_now === data.isha && audioJson?.start === false && settings?.notifications_adhan) {
else if (time_now_adhan === data.isha && audioJson?.start === false && settings?.notifications_adhan) {
audioBoolean(App_Path, true);
ipcRenderer.send('show3');
document.getElementById('text').innerText = 'حان الان وقت صلاة العشاء'
Expand All @@ -103,7 +104,7 @@ window.addEventListener('DOMContentLoaded', async (e) => {
}, 600000);
}

else if (time_now === '7:40 AM' && audioJson?.start === false && settings?.notifications_adhkar) {
else if (time_now_adhkar === settings?.morning_adhkar_time && audioJson?.start === false && settings?.notifications_adhkar) {
audioBoolean(App_Path, true);
ipcRenderer.send('show3');
document.getElementById('text').innerText = 'أذكار الصباح ☀️ | بصوت إدريس أبكر 🔊';
Expand All @@ -115,7 +116,7 @@ window.addEventListener('DOMContentLoaded', async (e) => {
}, 600000);
}

else if (time_now === '7:40 PM' && audioJson?.start === false && settings?.notifications_adhkar) {
else if (time_now_adhkar === settings?.evening_adhkar_time && audioJson?.start === false && settings?.notifications_adhkar) {
audioBoolean(App_Path, true);
ipcRenderer.send('show3');
document.getElementById('text').innerText = 'أذكار المساء 🌑 | بصوت فيصل بن جذيان 🔊';
Expand Down
10 changes: 7 additions & 3 deletions src/preload/preload_modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module.exports = function settings(fs, path, App_Path, settings, ipcRenderer) {
let minimizeToPanel = document.getElementById('minimizeToPanel');
let dark_mode = document.getElementById('dark_mode');
let selected = document.getElementById(settings?.Calculation);

let morning_adhkar_time = document.getElementById("morning_adhkar_time");
let evening_adhkar_time = document.getElementById("evening_adhkar_time");
let save = document.getElementById('save');
let alrt = document.getElementById('alrt');

Expand All @@ -25,6 +26,8 @@ module.exports = function settings(fs, path, App_Path, settings, ipcRenderer) {
autostart.checked = settings?.autostart || false
startHidden.checked = settings?.startHidden || false
minimizeToPanel.checked = settings?.minimizeToPanel || false
morning_adhkar_time.value = settings?.morning_adhkar_time || ""
evening_adhkar_time.value = settings?.evening_adhkar_time || ""
dark_mode.checked = settings?.dark_mode ? true : false
selected.selected = "selected"

Expand Down Expand Up @@ -96,17 +99,18 @@ module.exports = function settings(fs, path, App_Path, settings, ipcRenderer) {
minimizeToPanel: minimizeToPanel.checked,
dark_mode: dark_mode.checked,
Calculation: Calculation.value,
morning_adhkar_time: morning_adhkar_time.value,
evening_adhkar_time: evening_adhkar_time.value,
notifications_adhan: notifications_adhan.checked,
notifications_adhkar: notifications_adhkar.checked,
volume: volumeRange.value / 100,
adhanVolume: adhanVolumeRange.value / 100
}, { spaces: '\t' });


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

})
Expand Down
4 changes: 3 additions & 1 deletion src/public/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

#latitude,
#longitude,
#timezone {
#timezone,
#morning_adhkar_time,
#evening_adhkar_time {
width: 300px;
height: 35px;
text-align: center;
Expand Down

0 comments on commit 178c0c6

Please sign in to comment.