Skip to content

Commit

Permalink
Fixed a bug related to file watcher still running on quitting the app…
Browse files Browse the repository at this point in the history
…, archive file won't be selected automatically any more, added function to choose archive file on first archiving
  • Loading branch information
ransome1 committed Nov 28, 2023
1 parent 768ac16 commit 4ca64c0
Show file tree
Hide file tree
Showing 36 changed files with 332 additions and 193 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"test": "jest",
"mac": "cross-env NODE_ENV=production yarn run build && electron-builder build -m --publish never",
"mas": "cross-env NODE_ENV=production yarn run build && electron-builder build -m mas --universal --publish never",
"masDev": "cross-env NODE_ENV=production yarn run build && electron-builder build -m mas-dev --universal --publish never",
"dir": "cross-env NODE_ENV=production yarn run build && electron-builder --dir --publish never",
"peggy": "peggy --format es --output ./src/main/modules/FilterLang/FilterLang.js ./src/main/modules/FilterLang/FilterLang.pegjs",
"depcheck": "depcheck"
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.3-rc.3",
"version": "2.0.3-rc.4",
"description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"keywords": [
Expand Down
17 changes: 9 additions & 8 deletions src/__tests__/__mock__/recurrence.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

2023-11-26 Line 1 rec:1d due:2023-11-27
2023-11-26 Line 1 rec:w due:2023-12-03
2023-11-26 Line 1 rec:2m due:2024-01-26
2023-11-26 Line 1 rec:+1d due:2023-11-28
2023-11-26 Line 1 rec:7w due:2024-01-14
2023-11-28 Line 1 rec:1d due:2023-11-29
2023-11-28 Line 1 rec:w due:2023-12-05
2023-11-28 Line 1 rec:2m due:2024-01-28
2023-11-28 Line 1 rec:+1d due:2023-11-30
2023-11-28 Line 1 rec:7w due:2024-01-16
2023-07-21 Line 1 due:2023-07-24 rec:+1b
2021-01-01 taxes are due in one year t:2022-03-30 due:2022-04-30 rec:+1y
2023-11-26 Water plants @home +quick due:2023-12-03 t:2023-11-23 rec:1w
2023-11-26 Line 1 rec:+1d t:2023-09-20 due:2023-11-27
(A) 2023-11-26 Line 1 rec:1d pri:A due:2023-11-27
2023-11-28 Water plants @home +quick due:2023-12-05 t:2023-11-25 rec:1w
2023-11-28 Line 1 rec:+1d t:2023-09-20
2023-11-28 Line 1 rec:1d pri:A due:2023-11-29
2023-11-28 (A) Do something rec:d t:2023-11-29 @SomeContext
8 changes: 4 additions & 4 deletions src/__tests__/main/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('openFile', () => {
});

it('should call addFile when a file is selected', async () => {
await openFile();
await openFile(false);

expect(dialog.showOpenDialog).toHaveBeenCalledWith({
properties: ['openFile'],
Expand All @@ -65,7 +65,7 @@ describe('openFile', () => {
securityScopedBookmarks: true,
});

await openFile();
await openFile(false);

expect(addFile).not.toHaveBeenCalled();
});
Expand All @@ -83,7 +83,7 @@ describe('createFile', () => {
securityScopedBookmarks: true,
});

await createFile();
await createFile(false);

expect(dialog.showSaveDialog).toHaveBeenCalledWith({
defaultPath: expect.any(String),
Expand All @@ -102,7 +102,7 @@ describe('createFile', () => {
securityScopedBookmarks: true,
});

await createFile();
await createFile(false);

expect(addFile).not.toHaveBeenCalled();
});
Expand Down
36 changes: 22 additions & 14 deletions src/__tests__/main/File.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ import path from 'path'
import { configStorage } from '../../main/config';
import { addFile, removeFile, setFile } from '../../main/modules/File/File';

jest.mock('../../main/main', () => ({
mainWindow: {
webContents: {
send: jest.fn(),
},
},
}));

jest.mock('../../main/config', () => ({
configStorage: {
get: jest.fn().mockReturnValue([
{ active: false, todoFileName: 'test1.txt', todoFilePath: path.join('/', 'path', 'to', 'test1.txt'), todoFileBookmark: null, doneFilePath: path.join('/', 'path', 'to', 'done.txt'), doneFileBookmark: null },
{ active: true, todoFileName: 'test2.txt', todoFilePath: path.join('/', 'path', 'to', 'test2.txt'), todoFileBookmark: null, doneFilePath: path.join('/', 'path', 'to', 'done.txt'), doneFileBookmark: null },
{ active: false, todoFileName: 'test3.txt', todoFilePath: path.join('/', 'path', 'to', 'test3.txt'), todoFileBookmark: null, doneFilePath: path.join('/', 'path', 'to', 'done.txt'), doneFileBookmark: null },
{ active: false, todoFileName: 'test1.txt', todoFilePath: path.join('/', 'path', 'to', 'test1.txt'), todoFileBookmark: null, doneFilePath: null, doneFileBookmark: null },
{ active: true, todoFileName: 'test2.txt', todoFilePath: path.join('/', 'path', 'to', 'test2.txt'), todoFileBookmark: null, doneFilePath: null, doneFileBookmark: null },
{ active: false, todoFileName: 'test3.txt', todoFilePath: path.join('/', 'path', 'to', 'test3.txt'), todoFileBookmark: null, doneFilePath: null, doneFileBookmark: null },
]),
set: jest.fn(),
},
Expand All @@ -29,31 +37,31 @@ describe('File functions', () => {
todoFileName: 'test1.txt',
todoFilePath: path.join('/', 'path', 'to', 'test1.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
{
active: false,
todoFileName: 'test2.txt',
todoFilePath: path.join('/', 'path', 'to', 'test2.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
{
active: false,
todoFileName: 'test3.txt',
todoFilePath: path.join('/', 'path', 'to', 'test3.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
{
active: true,
todoFileName: 'test4.txt',
todoFilePath: path.join('/', 'path', 'to', 'test4.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
]);
Expand All @@ -67,23 +75,23 @@ describe('File functions', () => {
todoFileName: 'test1.txt',
todoFilePath: path.join('/', 'path', 'to', 'test1.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
{
active: false,
todoFileName: 'test3.txt',
todoFilePath: path.join('/', 'path', 'to', 'test3.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
{
active: true,
todoFileName: 'test4.txt',
todoFilePath: path.join('/', 'path', 'to', 'test4.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
]);
Expand All @@ -97,15 +105,15 @@ describe('File functions', () => {
todoFileName: 'test1.txt',
todoFilePath: path.join('/', 'path', 'to', 'test1.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
{
active: false,
todoFileName: 'test3.txt',
todoFilePath: path.join('/', 'path', 'to', 'test3.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
]);
Expand All @@ -119,15 +127,15 @@ describe('File functions', () => {
todoFileName: 'test1.txt',
todoFilePath: path.join('/', 'path', 'to', 'test1.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
{
active: true,
todoFileName: 'test3.txt',
todoFilePath: path.join('/', 'path', 'to', 'test3.txt'),
todoFileBookmark: null,
doneFilePath: path.join('/', 'path', 'to', 'done.txt'),
doneFilePath: null,
doneFileBookmark: null
},
]);
Expand Down
12 changes: 7 additions & 5 deletions src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"copy": "Kopírovat",
"delete": "Smazat",
"cancel": "Zrušit",
"fileTabs.changeLocation": "Změnit umístění souboru done.txt",
"openFile": "Otevřít soubor",
"createFile": "Vytvořit soubor",
"fileTabs.changeLocation": "Změnit soubor pro archivaci",
"fileTabs.revealFile": "Zobrazit v správci souborů",
"fileTabs.removeFileHeadline": "Odstranit soubor ze sleek?",
"fileTabs.removeFileText": "Nebude smazán z pevného disku.",
Expand Down Expand Up @@ -40,8 +42,6 @@
"shared.attributeMapping.created": "Datum vytvoření",
"shared.attributeMapping.completed": "Datum dokončení",
"splashscreen.noFiles.text": "Přetáhněte sem soubor todo.txt nebo použijte tlačítka",
"splashscreen.noFiles.open": "Otevřít soubor todo.txt",
"splashscreen.noFiles.create": "Vytvořit soubor todo.txt",
"splashscreen.noTodosAvailable.text": "V tomto souboru nejsou žádné úkoly",
"splashscreen.noTodosAvailable.create": "Vytvořit úkol",
"splashscreen.noTodosVisible.text": "Žádné výsledky nejsou viditelné.",
Expand All @@ -66,6 +66,8 @@
"prompt.delete.headline": "Smazat úkol?",
"prompt.delete.text": "Úkol bude trvale odstraněn ze souboru",
"prompt.archive.headline": "Archivovat dokončené úkoly?",
"prompt.archive.text": "Tímto se přesunou všechny dokončené úkoly do vašeho určeného souboru done",
"prompt.archive.button": "Archivovat"
"prompt.archive.text": "Tímto se přesunou všechny dokončené úkoly do vašeho určeného archivačního souboru",
"prompt.archive.button": "Archivovat",
"prompt.archive.changeFile.headline": "Vyberte soubor pro archivaci",
"prompt.archive.changeFile.text": "Pro archivaci dokončených úkolů je nutné nejprve vybrat archivační soubor."
}
12 changes: 7 additions & 5 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"copy": "Kopieren",
"delete": "Löschen",
"cancel": "Abbrechen",
"fileTabs.changeLocation": "Speicherort der done.txt-Datei ändern",
"openFile": "Datei öffnen",
"createFile": "Datei erstellen",
"fileTabs.changeLocation": "Datei für die Archivierung ändern",
"fileTabs.revealFile": "Im Dateimanager anzeigen",
"fileTabs.removeFileHeadline": "Datei aus sleek entfernen?",
"fileTabs.removeFileText": "Die Datei wird nicht von Ihrer Festplatte gelöscht.",
Expand Down Expand Up @@ -40,8 +42,6 @@
"shared.attributeMapping.created": "Erstellungsdatum",
"shared.attributeMapping.completed": "Abschlussdatum",
"splashscreen.noFiles.text": "Ziehen Sie Ihre todo.txt-Datei hierher oder verwenden Sie die Schaltflächen",
"splashscreen.noFiles.open": "todo.txt-Datei öffnen",
"splashscreen.noFiles.create": "todo.txt-Datei erstellen",
"splashscreen.noTodosAvailable.text": "Keine Aufgaben in dieser Datei",
"splashscreen.noTodosAvailable.create": "Eine Aufgabe erstellen",
"splashscreen.noTodosVisible.text": "Keine sichtbaren Ergebnisse.",
Expand All @@ -66,6 +66,8 @@
"prompt.delete.headline": "Aufgabe löschen?",
"prompt.delete.text": "Die Aufgabe wird dauerhaft aus der Datei entfernt",
"prompt.archive.headline": "Abgeschlossene Aufgaben archivieren?",
"prompt.archive.text": "Dadurch werden alle abgeschlossenen Aufgaben in Ihre angegebene 'erledigt'-Datei verschoben",
"prompt.archive.button": "Archivieren"
"prompt.archive.text": "Dadurch werden alle abgeschlossenen Aufgaben in Ihre angegebene Archivdatei verschoben",
"prompt.archive.button": "Archivieren",
"prompt.archive.changeFile.headline": "Datei für Archivierung auswählen",
"prompt.archive.changeFile.text": "Um abgeschlossene Aufgaben zu archivieren, musst du zuerst eine Archivdatei auswählen"
}
12 changes: 7 additions & 5 deletions src/locales/en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"copy": "Copy",
"delete": "Delete",
"cancel": "Cancel",
"fileTabs.changeLocation": "Change location of done.txt file",
"openFile": "Open file",
"createFile": "Create file",
"fileTabs.changeLocation": "Change file for archiving",
"fileTabs.revealFile": "Reveal in file manager",
"fileTabs.removeFileHeadline": "Remove file from sleek?",
"fileTabs.removeFileText": "It will not be deleted from your hard drive.",
Expand Down Expand Up @@ -40,8 +42,6 @@
"shared.attributeMapping.created": "Creation date",
"shared.attributeMapping.completed": "Completion date",
"splashscreen.noFiles.text": "Drop your todo.txt file here or use the buttons",
"splashscreen.noFiles.open": "Open todo.txt file",
"splashscreen.noFiles.create": "Create todo.txt file",
"splashscreen.noTodosAvailable.text": "No todos in this file",
"splashscreen.noTodosAvailable.create": "Create a todo",
"splashscreen.noTodosVisible.text": "No results visible.",
Expand All @@ -66,6 +66,8 @@
"prompt.delete.headline": "Delete todo?",
"prompt.delete.text": "The todo will be permanently removed from the file",
"prompt.archive.headline": "Archive completed todos?",
"prompt.archive.text": "This will move all completed todos to your specified done file",
"prompt.archive.button": "Archive"
"prompt.archive.text": "This will move all completed todos to your specified archiving file",
"prompt.archive.button": "Archive",
"prompt.archive.changeFile.headline": "Choose a File for Archiving",
"prompt.archive.changeFile.text": "To archive completed todos, you need to choose an archive file first"
}
12 changes: 7 additions & 5 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"copy": "Copy",
"delete": "Delete",
"cancel": "Cancel",
"fileTabs.changeLocation": "Change location of done.txt file",
"openFile": "Open file",
"createFile": "Create file",
"fileTabs.changeLocation": "Change file for archiving",
"fileTabs.revealFile": "Reveal in file manager",
"fileTabs.removeFileHeadline": "Remove file from sleek?",
"fileTabs.removeFileText": "It will not be deleted from your hard drive.",
Expand Down Expand Up @@ -40,8 +42,6 @@
"shared.attributeMapping.created": "Creation date",
"shared.attributeMapping.completed": "Completion date",
"splashscreen.noFiles.text": "Drop your todo.txt file here or use the buttons",
"splashscreen.noFiles.open": "Open todo.txt file",
"splashscreen.noFiles.create": "Create todo.txt file",
"splashscreen.noTodosAvailable.text": "No todos in this file",
"splashscreen.noTodosAvailable.create": "Create a todo",
"splashscreen.noTodosVisible.text": "No results visible.",
Expand All @@ -66,6 +66,8 @@
"prompt.delete.headline": "Delete todo?",
"prompt.delete.text": "The todo will be permanently removed from the file",
"prompt.archive.headline": "Archive completed todos?",
"prompt.archive.text": "This will move all completed todos to your specified done file",
"prompt.archive.button": "Archive"
"prompt.archive.text": "This will move all completed todos to your specified archiving file",
"prompt.archive.button": "Archive",
"prompt.archive.changeFile.headline": "Choose a File for Archiving",
"prompt.archive.changeFile.text": "To archive completed todos, you need to choose an archive file first"
}
12 changes: 7 additions & 5 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"copy": "Copiar",
"delete": "Eliminar",
"cancel": "Cancelar",
"fileTabs.changeLocation": "Cambiar la ubicación del archivo done.txt",
"openFile": "Abrir archivo",
"createFile": "Crear archivo",
"fileTabs.changeLocation": "Cambiar archivo para archivar",
"fileTabs.revealFile": "Mostrar en el administrador de archivos",
"fileTabs.removeFileHeadline": "¿Eliminar archivo de sleek?",
"fileTabs.removeFileText": "No se eliminará de su disco duro.",
Expand Down Expand Up @@ -40,8 +42,6 @@
"shared.attributeMapping.created": "Fecha de creación",
"shared.attributeMapping.completed": "Fecha de finalización",
"splashscreen.noFiles.text": "Arrastre su archivo todo.txt aquí o use los botones",
"splashscreen.noFiles.open": "Abrir archivo todo.txt",
"splashscreen.noFiles.create": "Crear archivo todo.txt",
"splashscreen.noTodosAvailable.text": "No hay tareas en este archivo",
"splashscreen.noTodosAvailable.create": "Crear una tarea",
"splashscreen.noTodosVisible.text": "No se ven resultados.",
Expand All @@ -66,6 +66,8 @@
"prompt.delete.headline": "¿Eliminar tarea?",
"prompt.delete.text": "La tarea se eliminará permanentemente del archivo",
"prompt.archive.headline": "¿Archivar tareas completadas?",
"prompt.archive.text": "Esto moverá todas las tareas completadas a su archivo done especificado",
"prompt.archive.button": "Archivar"
"prompt.archive.text": "Esto moverá todas las tareas completadas a tu archivo de archivado especificado",
"prompt.archive.button": "Archivar",
"prompt.archive.changeFile.headline": "Selecciona un archivo para archivar",
"prompt.archive.changeFile.text": "Para archivar tareas completadas, primero debes elegir un archivo de archivo."
}
14 changes: 8 additions & 6 deletions src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"copy": "Copier",
"delete": "Supprimer",
"cancel": "Annuler",
"fileTabs.changeLocation": "Changer l'emplacement du fichier done.txt",
"openFile": "Ouvrir un fichier",
"createFile": "Créer un fichier",
"fileTabs.changeLocation": "Changer le fichier pour archiver",
"fileTabs.revealFile": "Révéler dans le gestionnaire de fichiers",
"fileTabs.removeFileHeadline": "Supprimer le fichier de sleek?",
"fileTabs.removeFileText": "Il ne sera pas supprimé de votre disque dur.",
Expand Down Expand Up @@ -40,8 +42,6 @@
"shared.attributeMapping.created": "Date de création",
"shared.attributeMapping.completed": "Date de réalisation",
"splashscreen.noFiles.text": "Déposez votre fichier todo.txt ici ou utilisez les boutons",
"splashscreen.noFiles.open": "Ouvrir le fichier todo.txt",
"splashscreen.noFiles.create": "Créer un fichier todo.txt",
"splashscreen.noTodosAvailable.text": "Aucune tâche dans ce fichier",
"splashscreen.noTodosAvailable.create": "Créer une tâche",
"splashscreen.noTodosVisible.text": "Aucun résultat visible.",
Expand All @@ -66,6 +66,8 @@
"prompt.delete.headline": "Supprimer la tâche?",
"prompt.delete.text": "La tâche sera définitivement supprimée du fichier",
"prompt.archive.headline": "Archiver les tâches terminées?",
"prompt.archive.text": "Cela déplacera toutes les tâches terminées vers votre fichier done spécifié",
"prompt.archive.button": "Archiver"
}
"prompt.archive.text": "Cela déplacera toutes les tâches terminées vers votre fichier d'archivage spécifié",
"prompt.archive.button": "Archiver",
"prompt.archive.changeFile.headline": "Choisissez un fichier pour archiver",
"prompt.archive.changeFile.text": "Pour archiver les tâches terminées, vous devez d'abord choisir un fichier d'archivage."
}
Loading

0 comments on commit 4ca64c0

Please sign in to comment.