Skip to content

Commit

Permalink
Fix Check Current Release
Browse files Browse the repository at this point in the history
  • Loading branch information
kemzops committed Mar 15, 2023
1 parent f25876e commit f2e0e2e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "altaqwaa",
"version": "3.0.0",
"version": "2.1.0",
"homepage": "https://www.altaqwaa.org",
"description": "Altaqwaa - Islamic Desktop Application",
"main": "./src/index.js",
Expand Down Expand Up @@ -100,4 +100,4 @@
]
}
}
}
}
6 changes: 3 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
setTimeout(() => {
loadWin.close();
win?.show();
win?.webContents.openDevTools();
//win?.webContents.openDevTools();
}, 1000);
}

Expand Down Expand Up @@ -95,8 +95,8 @@
});

// to get app version
ipcMain?.on('currentRelease', () => {
return app.getVersion();
ipcMain?.handle('currentRelease', async () => {
return await app.getVersion();
});

ipcMain?.on('minimizable', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/preload/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ window.addEventListener('DOMContentLoaded', async (event) => {
logo.src = '../public/icon/dark/logo.png';

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

/* THE DEFAULT FOR UNEXPECTED THING HAPPEN */
Expand Down Expand Up @@ -505,7 +505,7 @@ window.addEventListener('DOMContentLoaded', async (event) => {
case "info.html":
variables_css.href = '../public/css/var.css';
let info = require('./preload_modules/info.js');
await info(fs, path, App_Path, shell);
await info(ipcRenderer, shell);
break;

/* THE DEFAULT FOR UNEXPECTED THING HAPPEN */
Expand Down
12 changes: 3 additions & 9 deletions src/preload/preload_modules/info.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
module.exports = function info(fs, path, App_Path, shell) {

/*
* SIMPLE GITHUB API CHECK FOR NEW RELEASES SCRIPT
* THE CURRENT RELEASE LOADS IN PRELOAD.JS FILE
* LAST CHANGE WAS TO INSURE THAT CHECK HAPPENS ONCE (GITHUB RATE LIMIT)
* https://github.com/kemzops
*/
let currentRelease = ipcRenderer.invoke('currentRelease') || "0.0.0";
module.exports = async function info(ipcRenderer, shell) {

let currentRelease = await ipcRenderer.invoke('currentRelease') || "0.0.0";
document.getElementById("Version").innerHTML = "v" + currentRelease;

let github = document.getElementById('github');
Expand Down
9 changes: 5 additions & 4 deletions src/preload/preload_modules/settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = function settings(fs, path, App_Path, settings, ipcRenderer) {
module.exports = async function settings(fs, path, App_Path, settings, ipcRenderer) {

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

console.log(currentRelease)
let latitude = document.getElementById('latitude');
let longitude = document.getElementById('longitude');
Expand Down Expand Up @@ -129,15 +130,15 @@ module.exports = function settings(fs, path, App_Path, settings, ipcRenderer) {
if (lastVersion === currentRelease) {

alert_settings_title.innerText = "لديك بالفعل آخر إصدار من تطبيق التقوى"
alert_settings_icon.src = "../public/icon/x.png"
alert_settings_icon.src = "../public/icon/correct.png"
app_current_version.innerText = currentRelease
app_latest_version.innerText = lastVersion
}

else {

alert_settings_title.innerText = "يتوفر تحديث جديد للتطبيق"
alert_settings_icon.src = "../public/icon/correct.png"
alert_settings_icon.src = "../public/icon/x.png"
app_current_version.innerText = currentRelease
app_latest_version.innerText = lastVersion
alert_settings_text.style.display = "block"
Expand Down

0 comments on commit f2e0e2e

Please sign in to comment.