Skip to content

Commit

Permalink
fixed old settings import | added new adhan (Ahmed Al-Nufeis) + chang…
Browse files Browse the repository at this point in the history
…ed default
  • Loading branch information
DBChoco committed Apr 13, 2022
1 parent d23d6ee commit 9616f9f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "muezzin",
"version": "0.2.2",
"version": "2.3.0",
"description": "Prayer Time Caller",
"main": "src/main/main.js",
"scripts": {
Expand Down
Binary file added ressources/audio/Adhan - Ahmed Al-Nufais.mp3
Binary file not shown.
57 changes: 48 additions & 9 deletions src/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ async function loadSettings(){
adhanSettings = await store.get('adhan', {
adhan: {
custom: false,
path: "ressources/audio/Adhan - Mecca.mp3"
path: "../../ressources/audio/Adhan - Ahmed Al-Nufais.mp3"
},
adhanFajr: {
custom: false,
path: "ressources/audio/Adhan - Mecca.mp3"
path: "../../ressources/audio/Adhan - Ahmed Al-Nufais.mp3"
},
dua: {
enabled: true
Expand Down Expand Up @@ -871,17 +871,56 @@ function setAutoStart(autoStart){
}
}


/**
* Checks if the old settings are still saved, if so, imports them into the new one.
*/
async function loadOldSettings(){
if (store.has('calcmeth') && !store.has("calculationMethod")){
reset()
var calcmeth = await store.get('calcmeth', "MWL");
var madhab = await store.get('madhab', 'Shafi');
var hlr = await store.get( 'hlr', 'TA');
var pcr = await store.get('pcr', 'CC');
var shafaq = await store.get('shafaq', 'shafaqG');
store.set("calculationMethod", {
calcMethod: calcmeth,
madhab: madhab,
hlr: hlr,
pcr: pcr,
shafaq: shafaq
})
}
else if (store.has("adhanFile") && !store.has("adhan")){
reset()
else if (store.has() && !store.has("settings")){
var adhanCheck = await store.get("adhanCheck", true)
var notifCheck = await store.get("notifCheck", true)
var systray = await store.get("systray", true)
var startupSound = await store.get("startupSound", true)
var autoStart = await store.get("autoStart", true)
var minStart = await store.get("minStart", true)
store.set("settings", {
startupSound: startupSound,
notifCheck: notifCheck,
systray: systray,
adhanCheck: adhanCheck,
autoStart: autoStart,
minStart: minStart
})
}
function reset(){
store.clear();
app.relaunch()
app.exit()
else if (store.has("adhanFile") && !store.has("adhan")){
var adhanFile = store.get('adhanFile', [false, "../../ressources/audio/Adhan - Ahmed Al-Nufais.mp3", true]);
store.set("adhan", {
adhan: {
custom: adhanFile[0],
path: adhanFile[1]
},
adhanFajr: {
custom: false,
path: adhanFile[1]
},
dua: {
enabled: adhanFile[2]
}
})
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ <h1 id=settingsTitle>Settings</h1>

<div class="grid-R-spacer">
<select class="form-select" id="adhanList" name="adhanList">
<option id="adhanAhmed" value="../../ressources/audio/Adhan - Ahmed Al-Nufais.mp3" id="adhanAhmedText">Adhan - Ahmed Al-Nufais</option>
<option id="adhanMecca" value="../../ressources/audio/Adhan - Mecca.mp3" id="adhanMeccaText">Adhan Mecca</option>
<option id="adhanAqsa" value="../../ressources/audio/Adhan - al-Aqsa.mp3" id="adhanAqsaText">Adhan al-Aqsa</option>

</select>
</div>

Expand Down
6 changes: 3 additions & 3 deletions src/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ async function loadAdhan(){
adhanFile = await window.api.getFromStore('adhan', {
adhan: {
custom: false,
path: "ressources/audio/Adhan - Mecca.mp3"
path: "../../ressources/audio/Adhan - Ahmed Al-Nufais.mp3"
},
adhanFajr: {
custom: false,
path: "ressources/audio/Adhan - Mecca.mp3"
path: "../../ressources/audio/Adhan - Ahmed Al-Nufais.mp3"
},
dua: {
enabled: true
Expand Down Expand Up @@ -408,7 +408,7 @@ async function loadAdhan(){
}

function shortenedString(text){
if (text.length > 20) return text.substr(0,15);
if (text.length > 30) return text.substr(0,30);
else return text
}

Expand Down

0 comments on commit 9616f9f

Please sign in to comment.