aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2020-02-03 12:59:27 +0100
committerLibravatar vantezzen <hello@vantezzen.io>2020-02-03 12:59:27 +0100
commit8f9c22fdaff4a9b61cf1dab4f25378e2d169b3a8 (patch)
treea3b1cd5b6dd384eb392ed709e604c503b80c10d3
parent#339 Ensure the recipe dev directory exists (diff)
downloadferdium-app-8f9c22fdaff4a9b61cf1dab4f25378e2d169b3a8.tar.gz
ferdium-app-8f9c22fdaff4a9b61cf1dab4f25378e2d169b3a8.tar.zst
ferdium-app-8f9c22fdaff4a9b61cf1dab4f25378e2d169b3a8.zip
Add info about Franz accounts in Ferdi Todos
-rw-r--r--src/features/todos/preload.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/features/todos/preload.js b/src/features/todos/preload.js
index d1838e0d6..0a1183030 100644
--- a/src/features/todos/preload.js
+++ b/src/features/todos/preload.js
@@ -21,3 +21,30 @@ ipcRenderer.on(IPC.TODOS_HOST_CHANNEL, (event, message) => {
21 debug('Received host message', event, message); 21 debug('Received host message', event, message);
22 hostMessageListener(message); 22 hostMessageListener(message);
23}); 23});
24
25if (location.href === 'https://app.franztodos.com/login/') {
26 // Insert info element informing about Franz accounts
27 const infoElement = document.createElement('p');
28 infoElement.innerText = `You are using Franz\'s official Todo Service.
29This service will only work with accounts registered with Franz - no Ferdi accounts will work here!
30If you do not have a Franz account you can change the Todo service by going into Ferdi's settings and changing the "Todo server".
31You can choose any service as this Todo server, e.g. Todoist or Apple Notes.`;
32
33 // Franz Todos uses React. Because of this we can't directly insert the element into the page
34 // but we have to wait for React to finish rendering the login page
35 let numChecks = 0;
36 const waitForReact = setInterval(() => {
37 const textElement = document.querySelector('p');
38 if (textElement) {
39 clearInterval(waitForReact);
40 textElement.parentElement.insertBefore(infoElement, textElement);
41 } else {
42 numChecks += 1;
43
44 // Stop after ~10 seconds. We are probably not on the login page
45 if (numChecks > 1000) {
46 clearInterval(waitForReact);
47 }
48 }
49 }, 10);
50}