Skip to content

Commit

Permalink
Merge pull request #4 from GustavoOly/dev
Browse files Browse the repository at this point in the history
config: auto update
  • Loading branch information
GustavoOly authored Aug 27, 2024
2 parents d96f305 + 8031c85 commit f00ae48
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 41 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/workflow.yml

This file was deleted.

4 changes: 2 additions & 2 deletions dev-app-update.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
provider: generic
url: https://example.com/auto-updates
provider: github
url: https://github.com/GustavoOly/Loaned-book-management-system
updaterCacheDirName: gerenciador_de_livros_alugados-updater
5 changes: 3 additions & 2 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ appImage:
artifactName: Gerenciador de livros alugados - ${version}.${ext}
npmRebuild: false
publish:
provider: generic
url: https://example.com/auto-updates
provider: github
repo: Loaned-book-management-system
owner: GustavoOly
electronDownload:
mirror: https://npmmirror.com/mirrors/electron/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gerenciador_de_livros_alugados",
"version": "1.0.2",
"version": "1.0.3",
"description": "Aplicativo para gerenciar livros alugados",
"main": "./out/main/index.js",
"author": "gustavooly",
Expand Down
24 changes: 22 additions & 2 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,29 @@ function createWindow() {
mainWindow.loadFile(join(__dirname, '../renderer/index.html'));
}

autoUpdater.checkForUpdatesAndNotify();

autoUpdater.on('update-available', () => {
dialog.showMessageBox(mainWindow, {
type: 'info',
title: 'Atualização disponível',
message: 'Uma nova versão está disponível. Ela será baixada em segundo plano.',
});
});

autoUpdater.on('update-downloaded', () => {
autoUpdater.quitAndInstall();
})
dialog.showMessageBox(mainWindow, {
type: 'info',
title: 'Atualização pronta',
message: 'A nova versão foi baixada. O aplicativo será atualizado após reiniciar.',
buttons: ['Reiniciar agora', 'Mais tarde'],
defaultId: 0,
}).then((result) => {
if (result.response === 0) { // O usuário clicou em "Reiniciar agora"
autoUpdater.quitAndInstall();
}
});
});
}

app.whenReady().then(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function Header({ titulo, nome }) {
return (
<header className="h-20 px-2 bg-primary text-secundary">
<header className="h-20 px-2 text-secundary bg-primary">
<section className="w-full h-full max-w-7xl m-auto flex justify-center items-center">
<div>
<h1 className="font-bold text-2xl bg-red-900">{titulo}</h1>
Expand Down

0 comments on commit f00ae48

Please sign in to comment.