aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorLibravatar Bennett <hello@vantezzen.io>2020-03-03 17:53:09 +0100
committerLibravatar GitHub <noreply@github.com>2020-03-03 17:53:09 +0100
commite043795a040b8666a6ad253bb6cd37a5d647bbd5 (patch)
treed14e1237d49687742901d515c95d7d2c5fbe069f /src/lib
parentAdd Crowdin contributors to list of contributors (#429) (diff)
downloadferdium-app-e043795a040b8666a6ad253bb6cd37a5d647bbd5.tar.gz
ferdium-app-e043795a040b8666a6ad253bb6cd37a5d647bbd5.tar.zst
ferdium-app-e043795a040b8666a6ad253bb6cd37a5d647bbd5.zip
Add support for unlocking with Touch ID (#423)
* Enhance installation guide in README * Add TouchID unlock for Ferdi Lock * Remove commit 8861014 as it is not related to this feature This reverts commit 88610144b942739772286ec3073b328e829a8b39. * Rename TouchID to "Touch ID" * Improve Touch ID prompt text * Improve unlocking with Touch ID * Fix lint * Add separator after lock-related menu entry Co-authored-by: Amine <amine@mouafik.fr>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Menu.js34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index 6d5eb0095..957621f94 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -10,8 +10,9 @@ import { CUSTOM_WEBSITE_ID } from '../features/webControls/constants';
10import { workspaceActions } from '../features/workspaces/actions'; 10import { workspaceActions } from '../features/workspaces/actions';
11import { workspaceStore } from '../features/workspaces/index'; 11import { workspaceStore } from '../features/workspaces/index';
12 12
13 13const {
14const { app, Menu, dialog } = remote; 14 app, Menu, dialog, systemPreferences,
15} = remote;
15 16
16const menuItems = defineMessages({ 17const menuItems = defineMessages({
17 edit: { 18 edit: {
@@ -166,6 +167,14 @@ const menuItems = defineMessages({
166 id: 'menu.help.debugInfoCopiedBody', 167 id: 'menu.help.debugInfoCopiedBody',
167 defaultMessage: '!!!Your Debug Information has been copied to your clipboard.', 168 defaultMessage: '!!!Your Debug Information has been copied to your clipboard.',
168 }, 169 },
170 touchId: {
171 id: 'locked.touchId',
172 defaultMessage: '!!!Unlock with Touch ID',
173 },
174 touchIdPrompt: {
175 id: 'locked.touchIdPrompt',
176 defaultMessage: '!!!unlock via Touch ID',
177 },
169 tos: { 178 tos: {
170 id: 'menu.help.tos', 179 id: 'menu.help.tos',
171 defaultMessage: '!!!Terms of Service', 180 defaultMessage: '!!!Terms of Service',
@@ -833,6 +842,27 @@ export default class FranzMenu {
833 if (todosStore.isFeatureEnabled) { 842 if (todosStore.isFeatureEnabled) {
834 tpl[5].submenu = this.todosMenu(); 843 tpl[5].submenu = this.todosMenu();
835 } 844 }
845 } else {
846 const touchIdEnabled = this.stores.settings.app.useTouchIdToUnlock && systemPreferences.canPromptTouchID();
847
848 tpl[0].submenu.unshift({
849 label: intl.formatMessage(menuItems.touchId),
850 accelerator: 'CmdOrCtrl+Shift+L',
851 visible: touchIdEnabled,
852 click() {
853 systemPreferences.promptTouchID(intl.formatMessage(menuItems.touchIdPrompt)).then(() => {
854 actions.settings.update({
855 type: 'app',
856 data: {
857 locked: false,
858 },
859 });
860 });
861 },
862 }, {
863 type: 'separator',
864 visible: touchIdEnabled
865 });
836 } 866 }
837 867
838 tpl.unshift({ 868 tpl.unshift({