diff options
author | 2022-11-28 16:53:04 +0100 | |
---|---|---|
committer | 2022-11-28 15:53:04 +0000 | |
commit | d5d685aaf4e796faf612c6d0fea0f0cc9ea49614 (patch) | |
tree | 72f027dc2d57f00c366d61570fd76ed6a0fcb27a /src/containers/settings/EditSettingsScreen.tsx | |
parent | 6.2.1-nightly.52 [skip ci] (diff) | |
download | ferdium-app-d5d685aaf4e796faf612c6d0fea0f0cc9ea49614.tar.gz ferdium-app-d5d685aaf4e796faf612c6d0fea0f0cc9ea49614.tar.zst ferdium-app-d5d685aaf4e796faf612c6d0fea0f0cc9ea49614.zip |
fix: ensure default values are working for the all fields in all settings screens (#750)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/containers/settings/EditSettingsScreen.tsx')
-rw-r--r-- | src/containers/settings/EditSettingsScreen.tsx | 368 |
1 files changed, 285 insertions, 83 deletions
diff --git a/src/containers/settings/EditSettingsScreen.tsx b/src/containers/settings/EditSettingsScreen.tsx index 2dbd8d2be..5c82a7e34 100644 --- a/src/containers/settings/EditSettingsScreen.tsx +++ b/src/containers/settings/EditSettingsScreen.tsx | |||
@@ -20,8 +20,6 @@ import { | |||
20 | TRANSLATOR_ENGINE_GOOGLE, | 20 | TRANSLATOR_ENGINE_GOOGLE, |
21 | LIBRETRANSLATE_TRANSLATOR_LANGUAGES, | 21 | LIBRETRANSLATE_TRANSLATOR_LANGUAGES, |
22 | TODO_APPS, | 22 | TODO_APPS, |
23 | DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, | ||
24 | DEFAULT_IS_FEATURE_ENABLED_BY_USER, | ||
25 | WAKE_UP_STRATEGIES, | 23 | WAKE_UP_STRATEGIES, |
26 | WAKE_UP_HIBERNATION_STRATEGIES, | 24 | WAKE_UP_HIBERNATION_STRATEGIES, |
27 | SPLIT_COLUMNS_MIN, | 25 | SPLIT_COLUMNS_MIN, |
@@ -39,6 +37,7 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; | |||
39 | 37 | ||
40 | import globalMessages from '../../i18n/globalMessages'; | 38 | import globalMessages from '../../i18n/globalMessages'; |
41 | import { importExportURL } from '../../api/apiBase'; | 39 | import { importExportURL } from '../../api/apiBase'; |
40 | import { ifUndefined } from '../../jsUtils'; | ||
42 | 41 | ||
43 | const debug = require('../../preload-safe-debug')('Ferdium:EditSettingsScreen'); | 42 | const debug = require('../../preload-safe-debug')('Ferdium:EditSettingsScreen'); |
44 | 43 | ||
@@ -542,31 +541,46 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> { | |||
542 | fields: { | 541 | fields: { |
543 | autoLaunchOnStart: { | 542 | autoLaunchOnStart: { |
544 | label: intl.formatMessage(messages.autoLaunchOnStart), | 543 | label: intl.formatMessage(messages.autoLaunchOnStart), |
545 | value: app.autoLaunchOnStart, | 544 | value: ifUndefined<boolean>( |
545 | app.autoLaunchOnStart, | ||
546 | DEFAULT_APP_SETTINGS.autoLaunchOnStart, | ||
547 | ), | ||
546 | default: DEFAULT_APP_SETTINGS.autoLaunchOnStart, | 548 | default: DEFAULT_APP_SETTINGS.autoLaunchOnStart, |
547 | type: 'checkbox', | 549 | type: 'checkbox', |
548 | }, | 550 | }, |
549 | autoLaunchInBackground: { | 551 | autoLaunchInBackground: { |
550 | label: intl.formatMessage(messages.autoLaunchInBackground), | 552 | label: intl.formatMessage(messages.autoLaunchInBackground), |
551 | value: app.launchInBackground, | 553 | value: ifUndefined<boolean>( |
554 | app.launchInBackground, | ||
555 | DEFAULT_APP_SETTINGS.autoLaunchInBackground, | ||
556 | ), | ||
552 | default: DEFAULT_APP_SETTINGS.autoLaunchInBackground, | 557 | default: DEFAULT_APP_SETTINGS.autoLaunchInBackground, |
553 | type: 'checkbox', | 558 | type: 'checkbox', |
554 | }, | 559 | }, |
555 | runInBackground: { | 560 | runInBackground: { |
556 | label: intl.formatMessage(messages.runInBackground), | 561 | label: intl.formatMessage(messages.runInBackground), |
557 | value: settings.all.app.runInBackground, | 562 | value: ifUndefined<boolean>( |
563 | settings.all.app.runInBackground, | ||
564 | DEFAULT_APP_SETTINGS.runInBackground, | ||
565 | ), | ||
558 | default: DEFAULT_APP_SETTINGS.runInBackground, | 566 | default: DEFAULT_APP_SETTINGS.runInBackground, |
559 | type: 'checkbox', | 567 | type: 'checkbox', |
560 | }, | 568 | }, |
561 | startMinimized: { | 569 | startMinimized: { |
562 | label: intl.formatMessage(messages.startMinimized), | 570 | label: intl.formatMessage(messages.startMinimized), |
563 | value: settings.all.app.startMinimized, | 571 | value: ifUndefined<boolean>( |
572 | settings.all.app.startMinimized, | ||
573 | DEFAULT_APP_SETTINGS.startMinimized, | ||
574 | ), | ||
564 | default: DEFAULT_APP_SETTINGS.startMinimized, | 575 | default: DEFAULT_APP_SETTINGS.startMinimized, |
565 | type: 'checkbox', | 576 | type: 'checkbox', |
566 | }, | 577 | }, |
567 | confirmOnQuit: { | 578 | confirmOnQuit: { |
568 | label: intl.formatMessage(messages.confirmOnQuit), | 579 | label: intl.formatMessage(messages.confirmOnQuit), |
569 | value: settings.all.app.confirmOnQuit, | 580 | value: ifUndefined<boolean>( |
581 | settings.all.app.confirmOnQuit, | ||
582 | DEFAULT_APP_SETTINGS.confirmOnQuit, | ||
583 | ), | ||
570 | default: DEFAULT_APP_SETTINGS.confirmOnQuit, | 584 | default: DEFAULT_APP_SETTINGS.confirmOnQuit, |
571 | type: 'checkbox', | 585 | type: 'checkbox', |
572 | }, | 586 | }, |
@@ -574,240 +588,359 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> { | |||
574 | label: intl.formatMessage( | 588 | label: intl.formatMessage( |
575 | isMac ? messages.enableMenuBar : messages.enableSystemTray, | 589 | isMac ? messages.enableMenuBar : messages.enableSystemTray, |
576 | ), | 590 | ), |
577 | value: settings.all.app.enableSystemTray, | 591 | value: ifUndefined<boolean>( |
592 | settings.all.app.enableSystemTray, | ||
593 | DEFAULT_APP_SETTINGS.enableSystemTray, | ||
594 | ), | ||
578 | default: DEFAULT_APP_SETTINGS.enableSystemTray, | 595 | default: DEFAULT_APP_SETTINGS.enableSystemTray, |
579 | type: 'checkbox', | 596 | type: 'checkbox', |
580 | }, | 597 | }, |
581 | reloadAfterResume: { | 598 | reloadAfterResume: { |
582 | label: intl.formatMessage(messages.reloadAfterResume), | 599 | label: intl.formatMessage(messages.reloadAfterResume), |
583 | value: settings.all.app.reloadAfterResume, | 600 | value: ifUndefined<boolean>( |
601 | settings.all.app.reloadAfterResume, | ||
602 | DEFAULT_APP_SETTINGS.reloadAfterResume, | ||
603 | ), | ||
584 | default: DEFAULT_APP_SETTINGS.reloadAfterResume, | 604 | default: DEFAULT_APP_SETTINGS.reloadAfterResume, |
585 | type: 'checkbox', | 605 | type: 'checkbox', |
586 | }, | 606 | }, |
587 | reloadAfterResumeTime: { | 607 | reloadAfterResumeTime: { |
588 | label: intl.formatMessage(messages.reloadAfterResumeTime), | 608 | label: intl.formatMessage(messages.reloadAfterResumeTime), |
589 | value: settings.all.app.reloadAfterResumeTime, | 609 | value: ifUndefined<number>( |
610 | settings.all.app.reloadAfterResumeTime, | ||
611 | DEFAULT_APP_SETTINGS.reloadAfterResumeTime, | ||
612 | ), | ||
590 | default: DEFAULT_APP_SETTINGS.reloadAfterResumeTime, | 613 | default: DEFAULT_APP_SETTINGS.reloadAfterResumeTime, |
591 | }, | 614 | }, |
592 | minimizeToSystemTray: { | 615 | minimizeToSystemTray: { |
593 | label: intl.formatMessage(messages.minimizeToSystemTray), | 616 | label: intl.formatMessage(messages.minimizeToSystemTray), |
594 | value: settings.all.app.minimizeToSystemTray, | 617 | value: ifUndefined<boolean>( |
618 | settings.all.app.minimizeToSystemTray, | ||
619 | DEFAULT_APP_SETTINGS.minimizeToSystemTray, | ||
620 | ), | ||
595 | default: DEFAULT_APP_SETTINGS.minimizeToSystemTray, | 621 | default: DEFAULT_APP_SETTINGS.minimizeToSystemTray, |
596 | type: 'checkbox', | 622 | type: 'checkbox', |
597 | }, | 623 | }, |
598 | closeToSystemTray: { | 624 | closeToSystemTray: { |
599 | label: intl.formatMessage(messages.closeToSystemTray), | 625 | label: intl.formatMessage(messages.closeToSystemTray), |
600 | value: settings.all.app.closeToSystemTray, | 626 | value: ifUndefined<boolean>( |
627 | settings.all.app.closeToSystemTray, | ||
628 | DEFAULT_APP_SETTINGS.closeToSystemTray, | ||
629 | ), | ||
601 | default: DEFAULT_APP_SETTINGS.closeToSystemTray, | 630 | default: DEFAULT_APP_SETTINGS.closeToSystemTray, |
602 | type: 'checkbox', | 631 | type: 'checkbox', |
603 | }, | 632 | }, |
604 | privateNotifications: { | 633 | privateNotifications: { |
605 | label: intl.formatMessage(messages.privateNotifications), | 634 | label: intl.formatMessage(messages.privateNotifications), |
606 | value: settings.all.app.privateNotifications, | 635 | value: ifUndefined<boolean>( |
636 | settings.all.app.privateNotifications, | ||
637 | DEFAULT_APP_SETTINGS.privateNotifications, | ||
638 | ), | ||
607 | default: DEFAULT_APP_SETTINGS.privateNotifications, | 639 | default: DEFAULT_APP_SETTINGS.privateNotifications, |
608 | type: 'checkbox', | 640 | type: 'checkbox', |
609 | }, | 641 | }, |
610 | clipboardNotifications: { | 642 | clipboardNotifications: { |
611 | label: intl.formatMessage(messages.clipboardNotifications), | 643 | label: intl.formatMessage(messages.clipboardNotifications), |
612 | value: settings.all.app.clipboardNotifications, | 644 | value: ifUndefined<boolean>( |
645 | settings.all.app.clipboardNotifications, | ||
646 | DEFAULT_APP_SETTINGS.clipboardNotifications, | ||
647 | ), | ||
613 | default: DEFAULT_APP_SETTINGS.clipboardNotifications, | 648 | default: DEFAULT_APP_SETTINGS.clipboardNotifications, |
614 | type: 'checkbox', | 649 | type: 'checkbox', |
615 | }, | 650 | }, |
616 | notifyTaskBarOnMessage: { | 651 | notifyTaskBarOnMessage: { |
617 | label: intl.formatMessage(messages.notifyTaskBarOnMessage), | 652 | label: intl.formatMessage(messages.notifyTaskBarOnMessage), |
618 | value: settings.all.app.notifyTaskBarOnMessage, | 653 | value: ifUndefined<boolean>( |
654 | settings.all.app.notifyTaskBarOnMessage, | ||
655 | DEFAULT_APP_SETTINGS.notifyTaskBarOnMessage, | ||
656 | ), | ||
619 | default: DEFAULT_APP_SETTINGS.notifyTaskBarOnMessage, | 657 | default: DEFAULT_APP_SETTINGS.notifyTaskBarOnMessage, |
620 | type: 'checkbox', | 658 | type: 'checkbox', |
621 | }, | 659 | }, |
622 | navigationBarBehaviour: { | 660 | navigationBarBehaviour: { |
623 | label: intl.formatMessage(messages.navigationBarBehaviour), | 661 | label: intl.formatMessage(messages.navigationBarBehaviour), |
624 | value: settings.all.app.navigationBarBehaviour, | 662 | value: ifUndefined<string>( |
663 | settings.all.app.navigationBarBehaviour, | ||
664 | DEFAULT_APP_SETTINGS.navigationBarBehaviour, | ||
665 | ), | ||
625 | default: DEFAULT_APP_SETTINGS.navigationBarBehaviour, | 666 | default: DEFAULT_APP_SETTINGS.navigationBarBehaviour, |
626 | options: navigationBarBehaviours, | 667 | options: navigationBarBehaviours, |
627 | }, | 668 | }, |
628 | webRTCIPHandlingPolicy: { | 669 | webRTCIPHandlingPolicy: { |
629 | label: intl.formatMessage(messages.webRTCIPHandlingPolicy), | 670 | label: intl.formatMessage(messages.webRTCIPHandlingPolicy), |
630 | value: settings.all.app.webRTCIPHandlingPolicy, | 671 | value: ifUndefined<string>( |
672 | settings.all.app.webRTCIPHandlingPolicy, | ||
673 | DEFAULT_APP_SETTINGS.webRTCIPHandlingPolicy, | ||
674 | ), | ||
631 | default: DEFAULT_APP_SETTINGS.webRTCIPHandlingPolicy, | 675 | default: DEFAULT_APP_SETTINGS.webRTCIPHandlingPolicy, |
632 | options: webRTCIPHandlingPolicies, | 676 | options: webRTCIPHandlingPolicies, |
633 | type: 'checkbox', | 677 | type: 'checkbox', |
634 | }, | 678 | }, |
635 | searchEngine: { | 679 | searchEngine: { |
636 | label: intl.formatMessage(messages.searchEngine), | 680 | label: intl.formatMessage(messages.searchEngine), |
637 | value: settings.all.app.searchEngine, | 681 | value: ifUndefined<string>( |
682 | settings.all.app.searchEngine, | ||
683 | DEFAULT_APP_SETTINGS.searchEngine, | ||
684 | ), | ||
638 | default: DEFAULT_APP_SETTINGS.searchEngine, | 685 | default: DEFAULT_APP_SETTINGS.searchEngine, |
639 | options: searchEngines, | 686 | options: searchEngines, |
640 | }, | 687 | }, |
641 | translatorEngine: { | 688 | translatorEngine: { |
642 | label: intl.formatMessage(messages.translatorEngine), | 689 | label: intl.formatMessage(messages.translatorEngine), |
643 | value: settings.all.app.translatorEngine, | 690 | value: ifUndefined<string>( |
691 | settings.all.app.translatorEngine, | ||
692 | DEFAULT_APP_SETTINGS.translatorEngine, | ||
693 | ), | ||
644 | default: DEFAULT_APP_SETTINGS.translatorEngine, | 694 | default: DEFAULT_APP_SETTINGS.translatorEngine, |
645 | options: translatorEngines, | 695 | options: translatorEngines, |
646 | }, | 696 | }, |
647 | translatorLanguage: { | 697 | translatorLanguage: { |
648 | label: intl.formatMessage(messages.translatorLanguage), | 698 | label: intl.formatMessage(messages.translatorLanguage), |
649 | value: settings.all.app.translatorLanguage, | 699 | value: ifUndefined<string>( |
700 | settings.all.app.translatorLanguage, | ||
701 | DEFAULT_APP_SETTINGS.translatorLanguage, | ||
702 | ), | ||
650 | default: DEFAULT_APP_SETTINGS.translatorLanguage, | 703 | default: DEFAULT_APP_SETTINGS.translatorLanguage, |
651 | options: translatorLanguages, | 704 | options: translatorLanguages, |
652 | }, | 705 | }, |
653 | sentry: { | 706 | sentry: { |
654 | label: intl.formatMessage(messages.sentry), | 707 | label: intl.formatMessage(messages.sentry), |
655 | value: settings.all.app.sentry, | 708 | value: ifUndefined<boolean>( |
709 | settings.all.app.sentry, | ||
710 | DEFAULT_APP_SETTINGS.sentry, | ||
711 | ), | ||
656 | default: DEFAULT_APP_SETTINGS.sentry, | 712 | default: DEFAULT_APP_SETTINGS.sentry, |
657 | type: 'checkbox', | 713 | type: 'checkbox', |
658 | }, | 714 | }, |
659 | hibernateOnStartup: { | 715 | hibernateOnStartup: { |
660 | label: intl.formatMessage(messages.hibernateOnStartup), | 716 | label: intl.formatMessage(messages.hibernateOnStartup), |
661 | value: settings.all.app.hibernateOnStartup, | 717 | value: ifUndefined<boolean>( |
718 | settings.all.app.hibernateOnStartup, | ||
719 | DEFAULT_APP_SETTINGS.hibernateOnStartup, | ||
720 | ), | ||
662 | default: DEFAULT_APP_SETTINGS.hibernateOnStartup, | 721 | default: DEFAULT_APP_SETTINGS.hibernateOnStartup, |
663 | type: 'checkbox', | 722 | type: 'checkbox', |
664 | }, | 723 | }, |
665 | hibernationStrategy: { | 724 | hibernationStrategy: { |
666 | label: intl.formatMessage(messages.hibernationStrategy), | 725 | label: intl.formatMessage(messages.hibernationStrategy), |
667 | value: settings.all.app.hibernationStrategy, | 726 | value: ifUndefined<string>( |
668 | options: hibernationStrategies, | 727 | settings.all.app.hibernationStrategy, |
728 | DEFAULT_APP_SETTINGS.hibernationStrategy, | ||
729 | ), | ||
669 | default: DEFAULT_APP_SETTINGS.hibernationStrategy, | 730 | default: DEFAULT_APP_SETTINGS.hibernationStrategy, |
731 | options: hibernationStrategies, | ||
670 | }, | 732 | }, |
671 | wakeUpStrategy: { | 733 | wakeUpStrategy: { |
672 | label: intl.formatMessage(messages.wakeUpStrategy), | 734 | label: intl.formatMessage(messages.wakeUpStrategy), |
673 | value: settings.all.app.wakeUpStrategy, | 735 | value: ifUndefined<string>( |
674 | options: wakeUpStrategies, | 736 | settings.all.app.wakeUpStrategy, |
737 | DEFAULT_APP_SETTINGS.wakeUpStrategy, | ||
738 | ), | ||
675 | default: DEFAULT_APP_SETTINGS.wakeUpStrategy, | 739 | default: DEFAULT_APP_SETTINGS.wakeUpStrategy, |
740 | options: wakeUpStrategies, | ||
676 | }, | 741 | }, |
677 | wakeUpHibernationStrategy: { | 742 | wakeUpHibernationStrategy: { |
678 | label: intl.formatMessage(messages.wakeUpHibernationStrategy), | 743 | label: intl.formatMessage(messages.wakeUpHibernationStrategy), |
679 | value: settings.all.app.wakeUpHibernationStrategy, | 744 | value: ifUndefined<string>( |
680 | options: wakeUpHibernationStrategies, | 745 | settings.all.app.wakeUpHibernationStrategy, |
746 | DEFAULT_APP_SETTINGS.wakeUpHibernationStrategy, | ||
747 | ), | ||
681 | default: DEFAULT_APP_SETTINGS.wakeUpHibernationStrategy, | 748 | default: DEFAULT_APP_SETTINGS.wakeUpHibernationStrategy, |
749 | options: wakeUpHibernationStrategies, | ||
682 | }, | 750 | }, |
683 | wakeUpHibernationSplay: { | 751 | wakeUpHibernationSplay: { |
684 | label: intl.formatMessage(messages.wakeUpHibernationSplay), | 752 | label: intl.formatMessage(messages.wakeUpHibernationSplay), |
685 | value: settings.all.app.wakeUpHibernationSplay, | 753 | value: ifUndefined<boolean>( |
754 | settings.all.app.wakeUpHibernationSplay, | ||
755 | DEFAULT_APP_SETTINGS.wakeUpHibernationSplay, | ||
756 | ), | ||
686 | default: DEFAULT_APP_SETTINGS.wakeUpHibernationSplay, | 757 | default: DEFAULT_APP_SETTINGS.wakeUpHibernationSplay, |
687 | type: 'checkbox', | 758 | type: 'checkbox', |
688 | }, | 759 | }, |
689 | predefinedTodoServer: { | 760 | predefinedTodoServer: { |
690 | label: intl.formatMessage(messages.predefinedTodoServer), | 761 | label: intl.formatMessage(messages.predefinedTodoServer), |
691 | value: settings.all.app.predefinedTodoServer, | 762 | value: ifUndefined<string>( |
763 | settings.all.app.predefinedTodoServer, | ||
764 | DEFAULT_APP_SETTINGS.predefinedTodoServer, | ||
765 | ), | ||
692 | default: DEFAULT_APP_SETTINGS.predefinedTodoServer, | 766 | default: DEFAULT_APP_SETTINGS.predefinedTodoServer, |
693 | options: todoApp, | 767 | options: todoApp, |
694 | }, | 768 | }, |
695 | customTodoServer: { | 769 | customTodoServer: { |
696 | label: intl.formatMessage(messages.customTodoServer), | 770 | label: intl.formatMessage(messages.customTodoServer), |
697 | value: settings.all.app.customTodoServer, | 771 | value: ifUndefined<string>( |
772 | settings.all.app.customTodoServer, | ||
773 | DEFAULT_APP_SETTINGS.customTodoServer, | ||
774 | ), | ||
698 | default: DEFAULT_APP_SETTINGS.customTodoServer, | 775 | default: DEFAULT_APP_SETTINGS.customTodoServer, |
699 | }, | 776 | }, |
700 | lockingFeatureEnabled: { | 777 | lockingFeatureEnabled: { |
701 | label: intl.formatMessage(messages.enableLock), | 778 | label: intl.formatMessage(messages.enableLock), |
702 | value: settings.all.app.lockingFeatureEnabled || false, | 779 | value: ifUndefined<boolean>( |
780 | settings.all.app.lockingFeatureEnabled, | ||
781 | DEFAULT_APP_SETTINGS.lockingFeatureEnabled, | ||
782 | ), | ||
703 | default: DEFAULT_APP_SETTINGS.lockingFeatureEnabled, | 783 | default: DEFAULT_APP_SETTINGS.lockingFeatureEnabled, |
704 | type: 'checkbox', | 784 | type: 'checkbox', |
705 | }, | 785 | }, |
706 | lockedPassword: { | 786 | lockedPassword: { |
707 | label: intl.formatMessage(messages.lockPassword), | 787 | label: intl.formatMessage(messages.lockPassword), |
708 | value: lockedPassword, | 788 | value: ifUndefined<string>( |
709 | default: '', | 789 | lockedPassword, |
790 | DEFAULT_APP_SETTINGS.lockedPassword, | ||
791 | ), | ||
792 | default: DEFAULT_APP_SETTINGS.lockedPassword, | ||
710 | type: 'password', | 793 | type: 'password', |
711 | }, | 794 | }, |
712 | useTouchIdToUnlock: { | 795 | useTouchIdToUnlock: { |
713 | label: intl.formatMessage(messages.useTouchIdToUnlock), | 796 | label: intl.formatMessage(messages.useTouchIdToUnlock), |
714 | value: settings.all.app.useTouchIdToUnlock, | 797 | value: ifUndefined<boolean>( |
798 | settings.all.app.useTouchIdToUnlock, | ||
799 | DEFAULT_APP_SETTINGS.useTouchIdToUnlock, | ||
800 | ), | ||
715 | default: DEFAULT_APP_SETTINGS.useTouchIdToUnlock, | 801 | default: DEFAULT_APP_SETTINGS.useTouchIdToUnlock, |
716 | type: 'checkbox', | 802 | type: 'checkbox', |
717 | }, | 803 | }, |
718 | inactivityLock: { | 804 | inactivityLock: { |
719 | label: intl.formatMessage(messages.inactivityLock), | 805 | label: intl.formatMessage(messages.inactivityLock), |
720 | value: settings.all.app.inactivityLock, | 806 | value: ifUndefined<number>( |
721 | default: 0, | 807 | settings.all.app.inactivityLock, |
808 | DEFAULT_APP_SETTINGS.inactivityLock, | ||
809 | ), | ||
810 | default: DEFAULT_APP_SETTINGS.inactivityLock, | ||
722 | type: 'number', | 811 | type: 'number', |
723 | }, | 812 | }, |
724 | scheduledDNDEnabled: { | 813 | scheduledDNDEnabled: { |
725 | label: intl.formatMessage(messages.scheduledDNDEnabled), | 814 | label: intl.formatMessage(messages.scheduledDNDEnabled), |
726 | value: settings.all.app.scheduledDNDEnabled || false, | 815 | value: ifUndefined<boolean>( |
816 | settings.all.app.scheduledDNDEnabled, | ||
817 | DEFAULT_APP_SETTINGS.scheduledDNDEnabled, | ||
818 | ), | ||
727 | default: DEFAULT_APP_SETTINGS.scheduledDNDEnabled, | 819 | default: DEFAULT_APP_SETTINGS.scheduledDNDEnabled, |
728 | type: 'checkbox', | 820 | type: 'checkbox', |
729 | }, | 821 | }, |
730 | scheduledDNDStart: { | 822 | scheduledDNDStart: { |
731 | label: intl.formatMessage(messages.scheduledDNDStart), | 823 | label: intl.formatMessage(messages.scheduledDNDStart), |
732 | value: settings.all.app.scheduledDNDStart, | 824 | value: ifUndefined<string>( |
733 | default: '17:00', | 825 | settings.all.app.scheduledDNDStart, |
826 | DEFAULT_APP_SETTINGS.scheduledDNDStart, | ||
827 | ), | ||
828 | default: DEFAULT_APP_SETTINGS.scheduledDNDStart, | ||
734 | type: 'time', | 829 | type: 'time', |
735 | }, | 830 | }, |
736 | scheduledDNDEnd: { | 831 | scheduledDNDEnd: { |
737 | label: intl.formatMessage(messages.scheduledDNDEnd), | 832 | label: intl.formatMessage(messages.scheduledDNDEnd), |
738 | value: settings.all.app.scheduledDNDEnd, | 833 | value: ifUndefined<string>( |
739 | default: '09:00', | 834 | settings.all.app.scheduledDNDEnd, |
835 | DEFAULT_APP_SETTINGS.scheduledDNDEnd, | ||
836 | ), | ||
837 | default: DEFAULT_APP_SETTINGS.scheduledDNDEnd, | ||
740 | type: 'time', | 838 | type: 'time', |
741 | }, | 839 | }, |
742 | showDisabledServices: { | 840 | showDisabledServices: { |
743 | label: intl.formatMessage(messages.showDisabledServices), | 841 | label: intl.formatMessage(messages.showDisabledServices), |
744 | value: settings.all.app.showDisabledServices, | 842 | value: ifUndefined<boolean>( |
843 | settings.all.app.showDisabledServices, | ||
844 | DEFAULT_APP_SETTINGS.showDisabledServices, | ||
845 | ), | ||
745 | default: DEFAULT_APP_SETTINGS.showDisabledServices, | 846 | default: DEFAULT_APP_SETTINGS.showDisabledServices, |
746 | type: 'checkbox', | 847 | type: 'checkbox', |
747 | }, | 848 | }, |
748 | showServiceName: { | 849 | showServiceName: { |
749 | label: intl.formatMessage(messages.showServiceName), | 850 | label: intl.formatMessage(messages.showServiceName), |
750 | value: settings.all.app.showServiceName, | 851 | value: ifUndefined<boolean>( |
852 | settings.all.app.showServiceName, | ||
853 | DEFAULT_APP_SETTINGS.showServiceName, | ||
854 | ), | ||
751 | default: DEFAULT_APP_SETTINGS.showServiceName, | 855 | default: DEFAULT_APP_SETTINGS.showServiceName, |
752 | type: 'checkbox', | ||
753 | }, | 856 | }, |
754 | showMessageBadgeWhenMuted: { | 857 | showMessageBadgeWhenMuted: { |
755 | label: intl.formatMessage(messages.showMessageBadgeWhenMuted), | 858 | label: intl.formatMessage(messages.showMessageBadgeWhenMuted), |
756 | value: settings.all.app.showMessageBadgeWhenMuted, | 859 | value: ifUndefined<boolean>( |
860 | settings.all.app.showMessageBadgeWhenMuted, | ||
861 | DEFAULT_APP_SETTINGS.showMessageBadgeWhenMuted, | ||
862 | ), | ||
757 | default: DEFAULT_APP_SETTINGS.showMessageBadgeWhenMuted, | 863 | default: DEFAULT_APP_SETTINGS.showMessageBadgeWhenMuted, |
758 | type: 'checkbox', | 864 | type: 'checkbox', |
759 | }, | 865 | }, |
760 | showDragArea: { | 866 | showDragArea: { |
761 | label: intl.formatMessage(messages.showDragArea), | 867 | label: intl.formatMessage(messages.showDragArea), |
762 | value: settings.all.app.showDragArea, | 868 | value: ifUndefined<boolean>( |
869 | settings.all.app.showDragArea, | ||
870 | DEFAULT_APP_SETTINGS.showDragArea, | ||
871 | ), | ||
763 | default: DEFAULT_APP_SETTINGS.showDragArea, | 872 | default: DEFAULT_APP_SETTINGS.showDragArea, |
764 | type: 'checkbox', | 873 | type: 'checkbox', |
765 | }, | 874 | }, |
766 | enableSpellchecking: { | 875 | enableSpellchecking: { |
767 | label: intl.formatMessage(messages.enableSpellchecking), | 876 | label: intl.formatMessage(messages.enableSpellchecking), |
768 | value: settings.all.app.enableSpellchecking, | 877 | value: ifUndefined<boolean>( |
878 | settings.all.app.enableSpellchecking, | ||
879 | DEFAULT_APP_SETTINGS.enableSpellchecking, | ||
880 | ), | ||
769 | default: DEFAULT_APP_SETTINGS.enableSpellchecking, | 881 | default: DEFAULT_APP_SETTINGS.enableSpellchecking, |
770 | type: 'checkbox', | 882 | type: 'checkbox', |
771 | }, | 883 | }, |
772 | enableTranslator: { | 884 | enableTranslator: { |
773 | label: intl.formatMessage(messages.enableTranslator), | 885 | label: intl.formatMessage(messages.enableTranslator), |
774 | value: settings.all.app.enableTranslator, | 886 | value: ifUndefined<boolean>( |
887 | settings.all.app.enableTranslator, | ||
888 | DEFAULT_APP_SETTINGS.enableTranslator, | ||
889 | ), | ||
775 | default: DEFAULT_APP_SETTINGS.enableTranslator, | 890 | default: DEFAULT_APP_SETTINGS.enableTranslator, |
776 | type: 'checkbox', | 891 | type: 'checkbox', |
777 | }, | 892 | }, |
778 | spellcheckerLanguage: { | 893 | spellcheckerLanguage: { |
779 | label: intl.formatMessage(globalMessages.spellcheckerLanguage), | 894 | label: intl.formatMessage(globalMessages.spellcheckerLanguage), |
780 | value: settings.all.app.spellcheckerLanguage, | 895 | value: ifUndefined<string>( |
781 | options: spellcheckingLanguages, | 896 | settings.all.app.spellcheckerLanguage, |
897 | DEFAULT_APP_SETTINGS.spellcheckerLanguage, | ||
898 | ), | ||
782 | default: DEFAULT_APP_SETTINGS.spellcheckerLanguage, | 899 | default: DEFAULT_APP_SETTINGS.spellcheckerLanguage, |
900 | options: spellcheckingLanguages, | ||
783 | }, | 901 | }, |
784 | userAgentPref: { | 902 | userAgentPref: { |
785 | label: intl.formatMessage(globalMessages.userAgentPref), | 903 | label: intl.formatMessage(globalMessages.userAgentPref), |
786 | value: settings.all.app.userAgentPref, | 904 | value: ifUndefined<string>( |
905 | settings.all.app.userAgentPref, | ||
906 | DEFAULT_APP_SETTINGS.userAgentPref, | ||
907 | ), | ||
787 | default: DEFAULT_APP_SETTINGS.userAgentPref, | 908 | default: DEFAULT_APP_SETTINGS.userAgentPref, |
788 | placeholder: defaultUserAgent(), | 909 | placeholder: defaultUserAgent(), |
789 | }, | 910 | }, |
790 | darkMode: { | 911 | darkMode: { |
791 | label: intl.formatMessage(messages.darkMode), | 912 | label: intl.formatMessage(messages.darkMode), |
792 | value: settings.all.app.darkMode, | 913 | value: ifUndefined<boolean>( |
914 | settings.all.app.darkMode, | ||
915 | DEFAULT_APP_SETTINGS.darkMode, | ||
916 | ), | ||
793 | default: DEFAULT_APP_SETTINGS.darkMode, | 917 | default: DEFAULT_APP_SETTINGS.darkMode, |
794 | type: 'checkbox', | 918 | type: 'checkbox', |
795 | }, | 919 | }, |
796 | adaptableDarkMode: { | 920 | adaptableDarkMode: { |
797 | label: intl.formatMessage(messages.adaptableDarkMode), | 921 | label: intl.formatMessage(messages.adaptableDarkMode), |
798 | value: settings.all.app.adaptableDarkMode, | 922 | value: ifUndefined<boolean>( |
923 | settings.all.app.adaptableDarkMode, | ||
924 | DEFAULT_APP_SETTINGS.adaptableDarkMode, | ||
925 | ), | ||
799 | default: DEFAULT_APP_SETTINGS.adaptableDarkMode, | 926 | default: DEFAULT_APP_SETTINGS.adaptableDarkMode, |
800 | type: 'checkbox', | 927 | type: 'checkbox', |
801 | }, | 928 | }, |
802 | universalDarkMode: { | 929 | universalDarkMode: { |
803 | label: intl.formatMessage(messages.universalDarkMode), | 930 | label: intl.formatMessage(messages.universalDarkMode), |
804 | value: settings.all.app.universalDarkMode, | 931 | value: ifUndefined<boolean>( |
932 | settings.all.app.universalDarkMode, | ||
933 | DEFAULT_APP_SETTINGS.universalDarkMode, | ||
934 | ), | ||
805 | default: DEFAULT_APP_SETTINGS.universalDarkMode, | 935 | default: DEFAULT_APP_SETTINGS.universalDarkMode, |
806 | type: 'checkbox', | 936 | type: 'checkbox', |
807 | }, | 937 | }, |
808 | splitMode: { | 938 | splitMode: { |
809 | label: intl.formatMessage(messages.splitMode), | 939 | label: intl.formatMessage(messages.splitMode), |
810 | value: settings.all.app.splitMode, | 940 | value: ifUndefined<boolean>( |
941 | settings.all.app.splitMode, | ||
942 | DEFAULT_APP_SETTINGS.splitMode, | ||
943 | ), | ||
811 | default: DEFAULT_APP_SETTINGS.splitMode, | 944 | default: DEFAULT_APP_SETTINGS.splitMode, |
812 | type: 'checkbox', | 945 | type: 'checkbox', |
813 | }, | 946 | }, |
@@ -815,129 +948,192 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> { | |||
815 | label: `${intl.formatMessage( | 948 | label: `${intl.formatMessage( |
816 | messages.splitColumns, | 949 | messages.splitColumns, |
817 | )} (${SPLIT_COLUMNS_MIN}-${SPLIT_COLUMNS_MAX})`, | 950 | )} (${SPLIT_COLUMNS_MIN}-${SPLIT_COLUMNS_MAX})`, |
818 | value: settings.all.app.splitColumns, | 951 | value: ifUndefined<number>( |
952 | settings.all.app.splitColumns, | ||
953 | DEFAULT_APP_SETTINGS.splitColumns, | ||
954 | ), | ||
819 | default: DEFAULT_APP_SETTINGS.splitColumns, | 955 | default: DEFAULT_APP_SETTINGS.splitColumns, |
820 | }, | 956 | }, |
821 | serviceRibbonWidth: { | 957 | serviceRibbonWidth: { |
822 | label: intl.formatMessage(messages.serviceRibbonWidth), | 958 | label: intl.formatMessage(messages.serviceRibbonWidth), |
823 | value: settings.all.app.serviceRibbonWidth, | 959 | value: ifUndefined<number>( |
960 | settings.all.app.serviceRibbonWidth, | ||
961 | DEFAULT_APP_SETTINGS.serviceRibbonWidth, | ||
962 | ), | ||
824 | default: DEFAULT_APP_SETTINGS.serviceRibbonWidth, | 963 | default: DEFAULT_APP_SETTINGS.serviceRibbonWidth, |
825 | options: sidebarWidth, | 964 | options: sidebarWidth, |
826 | }, | 965 | }, |
827 | sidebarServicesLocation: { | 966 | sidebarServicesLocation: { |
828 | label: intl.formatMessage(messages.sidebarServicesLocation), | 967 | label: intl.formatMessage(messages.sidebarServicesLocation), |
829 | value: settings.all.app.sidebarServicesLocation, | 968 | value: ifUndefined<number>( |
969 | settings.all.app.sidebarServicesLocation, | ||
970 | DEFAULT_APP_SETTINGS.sidebarServicesLocation, | ||
971 | ), | ||
830 | default: DEFAULT_APP_SETTINGS.sidebarServicesLocation, | 972 | default: DEFAULT_APP_SETTINGS.sidebarServicesLocation, |
831 | options: sidebarServicesLocation, | 973 | options: sidebarServicesLocation, |
832 | }, | 974 | }, |
833 | iconSize: { | 975 | iconSize: { |
834 | label: intl.formatMessage(messages.iconSize), | 976 | label: intl.formatMessage(messages.iconSize), |
835 | value: settings.all.app.iconSize, | 977 | value: ifUndefined<number>( |
978 | settings.all.app.iconSize, | ||
979 | DEFAULT_APP_SETTINGS.iconSize, | ||
980 | ), | ||
836 | default: DEFAULT_APP_SETTINGS.iconSize, | 981 | default: DEFAULT_APP_SETTINGS.iconSize, |
837 | options: iconSizes, | 982 | options: iconSizes, |
838 | }, | 983 | }, |
839 | enableLongPressServiceHint: { | 984 | enableLongPressServiceHint: { |
840 | label: intl.formatMessage(messages.enableLongPressServiceHint), | 985 | label: intl.formatMessage(messages.enableLongPressServiceHint), |
841 | value: settings.all.app.enableLongPressServiceHint, | 986 | value: ifUndefined<boolean>( |
987 | settings.all.app.enableLongPressServiceHint, | ||
988 | DEFAULT_APP_SETTINGS.enableLongPressServiceHint, | ||
989 | ), | ||
842 | default: DEFAULT_APP_SETTINGS.enableLongPressServiceHint, | 990 | default: DEFAULT_APP_SETTINGS.enableLongPressServiceHint, |
843 | type: 'checkbox', | 991 | type: 'checkbox', |
844 | }, | 992 | }, |
845 | useHorizontalStyle: { | 993 | useHorizontalStyle: { |
846 | label: intl.formatMessage(messages.useHorizontalStyle), | 994 | label: intl.formatMessage(messages.useHorizontalStyle), |
847 | value: settings.all.app.useHorizontalStyle, | 995 | value: ifUndefined<boolean>( |
996 | settings.all.app.useHorizontalStyle, | ||
997 | DEFAULT_APP_SETTINGS.useHorizontalStyle, | ||
998 | ), | ||
848 | default: DEFAULT_APP_SETTINGS.useHorizontalStyle, | 999 | default: DEFAULT_APP_SETTINGS.useHorizontalStyle, |
849 | type: 'checkbox', | 1000 | type: 'checkbox', |
850 | }, | 1001 | }, |
851 | hideCollapseButton: { | 1002 | hideCollapseButton: { |
852 | label: intl.formatMessage(messages.hideCollapseButton), | 1003 | label: intl.formatMessage(messages.hideCollapseButton), |
853 | value: settings.all.app.hideCollapseButton, | 1004 | value: ifUndefined<boolean>( |
1005 | settings.all.app.hideCollapseButton, | ||
1006 | DEFAULT_APP_SETTINGS.hideCollapseButton, | ||
1007 | ), | ||
854 | default: DEFAULT_APP_SETTINGS.hideCollapseButton, | 1008 | default: DEFAULT_APP_SETTINGS.hideCollapseButton, |
855 | type: 'checkbox', | 1009 | type: 'checkbox', |
856 | }, | 1010 | }, |
857 | hideRecipesButton: { | 1011 | hideRecipesButton: { |
858 | label: intl.formatMessage(messages.hideRecipesButton), | 1012 | label: intl.formatMessage(messages.hideRecipesButton), |
859 | value: settings.all.app.hideRecipesButton, | 1013 | value: ifUndefined<boolean>( |
1014 | settings.all.app.hideRecipesButton, | ||
1015 | DEFAULT_APP_SETTINGS.hideRecipesButton, | ||
1016 | ), | ||
860 | default: DEFAULT_APP_SETTINGS.hideRecipesButton, | 1017 | default: DEFAULT_APP_SETTINGS.hideRecipesButton, |
861 | type: 'checkbox', | 1018 | type: 'checkbox', |
862 | }, | 1019 | }, |
863 | hideSplitModeButton: { | 1020 | hideSplitModeButton: { |
864 | label: intl.formatMessage(messages.hideSplitModeButton), | 1021 | label: intl.formatMessage(messages.hideSplitModeButton), |
865 | value: settings.all.app.hideSplitModeButton, | 1022 | value: ifUndefined<boolean>( |
1023 | settings.all.app.hideSplitModeButton, | ||
1024 | DEFAULT_APP_SETTINGS.hideSplitModeButton, | ||
1025 | ), | ||
866 | default: DEFAULT_APP_SETTINGS.hideSplitModeButton, | 1026 | default: DEFAULT_APP_SETTINGS.hideSplitModeButton, |
867 | type: 'checkbox', | 1027 | type: 'checkbox', |
868 | }, | 1028 | }, |
869 | useGrayscaleServices: { | 1029 | useGrayscaleServices: { |
870 | label: intl.formatMessage(messages.useGrayscaleServices), | 1030 | label: intl.formatMessage(messages.useGrayscaleServices), |
871 | value: settings.all.app.useGrayscaleServices, | 1031 | value: ifUndefined<boolean>( |
1032 | settings.all.app.useGrayscaleServices, | ||
1033 | DEFAULT_APP_SETTINGS.useGrayscaleServices, | ||
1034 | ), | ||
872 | default: DEFAULT_APP_SETTINGS.useGrayscaleServices, | 1035 | default: DEFAULT_APP_SETTINGS.useGrayscaleServices, |
873 | type: 'checkbox', | 1036 | type: 'checkbox', |
874 | }, | 1037 | }, |
875 | grayscaleServicesDim: { | 1038 | grayscaleServicesDim: { |
876 | label: intl.formatMessage(messages.grayscaleServicesDim), | 1039 | label: intl.formatMessage(messages.grayscaleServicesDim), |
877 | value: settings.all.app.grayscaleServicesDim, | 1040 | value: ifUndefined<number>( |
1041 | settings.all.app.grayscaleServicesDim, | ||
1042 | DEFAULT_APP_SETTINGS.grayscaleServicesDim, | ||
1043 | ), | ||
878 | default: DEFAULT_APP_SETTINGS.grayscaleServicesDim, | 1044 | default: DEFAULT_APP_SETTINGS.grayscaleServicesDim, |
879 | }, | 1045 | }, |
880 | hideWorkspacesButton: { | 1046 | hideWorkspacesButton: { |
881 | label: intl.formatMessage(messages.hideWorkspacesButton), | 1047 | label: intl.formatMessage(messages.hideWorkspacesButton), |
882 | value: settings.all.app.hideWorkspacesButton, | 1048 | value: ifUndefined<boolean>( |
1049 | settings.all.app.hideWorkspacesButton, | ||
1050 | DEFAULT_APP_SETTINGS.hideWorkspacesButton, | ||
1051 | ), | ||
883 | default: DEFAULT_APP_SETTINGS.hideWorkspacesButton, | 1052 | default: DEFAULT_APP_SETTINGS.hideWorkspacesButton, |
884 | type: 'checkbox', | 1053 | type: 'checkbox', |
885 | }, | 1054 | }, |
886 | hideNotificationsButton: { | 1055 | hideNotificationsButton: { |
887 | label: intl.formatMessage(messages.hideNotificationsButton), | 1056 | label: intl.formatMessage(messages.hideNotificationsButton), |
888 | value: settings.all.app.hideNotificationsButton, | 1057 | value: ifUndefined<boolean>( |
1058 | settings.all.app.hideNotificationsButton, | ||
1059 | DEFAULT_APP_SETTINGS.hideNotificationsButton, | ||
1060 | ), | ||
889 | default: DEFAULT_APP_SETTINGS.hideNotificationsButton, | 1061 | default: DEFAULT_APP_SETTINGS.hideNotificationsButton, |
890 | type: 'checkbox', | 1062 | type: 'checkbox', |
891 | }, | 1063 | }, |
892 | hideSettingsButton: { | 1064 | hideSettingsButton: { |
893 | label: intl.formatMessage(messages.hideSettingsButton), | 1065 | label: intl.formatMessage(messages.hideSettingsButton), |
894 | value: settings.all.app.hideSettingsButton, | 1066 | value: ifUndefined<boolean>( |
1067 | settings.all.app.hideSettingsButton, | ||
1068 | DEFAULT_APP_SETTINGS.hideSettingsButton, | ||
1069 | ), | ||
895 | default: DEFAULT_APP_SETTINGS.hideSettingsButton, | 1070 | default: DEFAULT_APP_SETTINGS.hideSettingsButton, |
896 | type: 'checkbox', | 1071 | type: 'checkbox', |
897 | }, | 1072 | }, |
898 | alwaysShowWorkspaces: { | 1073 | alwaysShowWorkspaces: { |
899 | label: intl.formatMessage(messages.alwaysShowWorkspaces), | 1074 | label: intl.formatMessage(messages.alwaysShowWorkspaces), |
900 | value: settings.all.app.alwaysShowWorkspaces, | 1075 | value: ifUndefined<boolean>( |
1076 | settings.all.app.alwaysShowWorkspaces, | ||
1077 | DEFAULT_APP_SETTINGS.alwaysShowWorkspaces, | ||
1078 | ), | ||
901 | default: DEFAULT_APP_SETTINGS.alwaysShowWorkspaces, | 1079 | default: DEFAULT_APP_SETTINGS.alwaysShowWorkspaces, |
902 | type: 'checkbox', | 1080 | type: 'checkbox', |
903 | }, | 1081 | }, |
904 | accentColor: { | 1082 | accentColor: { |
905 | label: intl.formatMessage(messages.accentColor), | 1083 | label: intl.formatMessage(messages.accentColor), |
906 | value: settings.all.app.accentColor, | 1084 | value: ifUndefined<string>( |
1085 | settings.all.app.accentColor, | ||
1086 | DEFAULT_APP_SETTINGS.accentColor, | ||
1087 | ), | ||
907 | default: DEFAULT_APP_SETTINGS.accentColor, | 1088 | default: DEFAULT_APP_SETTINGS.accentColor, |
908 | }, | 1089 | }, |
909 | progressbarAccentColor: { | 1090 | progressbarAccentColor: { |
910 | label: intl.formatMessage(messages.progressbarAccentColor), | 1091 | label: intl.formatMessage(messages.progressbarAccentColor), |
911 | value: settings.all.app.progressbarAccentColor, | 1092 | value: ifUndefined<string>( |
1093 | settings.all.app.progressbarAccentColor, | ||
1094 | DEFAULT_APP_SETTINGS.progressbarAccentColor, | ||
1095 | ), | ||
912 | default: DEFAULT_APP_SETTINGS.progressbarAccentColor, | 1096 | default: DEFAULT_APP_SETTINGS.progressbarAccentColor, |
913 | }, | 1097 | }, |
914 | enableGPUAcceleration: { | 1098 | enableGPUAcceleration: { |
915 | label: intl.formatMessage(messages.enableGPUAcceleration), | 1099 | label: intl.formatMessage(messages.enableGPUAcceleration), |
916 | value: settings.all.app.enableGPUAcceleration, | 1100 | value: ifUndefined<boolean>( |
1101 | settings.all.app.enableGPUAcceleration, | ||
1102 | DEFAULT_APP_SETTINGS.enableGPUAcceleration, | ||
1103 | ), | ||
917 | default: DEFAULT_APP_SETTINGS.enableGPUAcceleration, | 1104 | default: DEFAULT_APP_SETTINGS.enableGPUAcceleration, |
918 | type: 'checkbox', | 1105 | type: 'checkbox', |
919 | }, | 1106 | }, |
920 | enableGlobalHideShortcut: { | 1107 | enableGlobalHideShortcut: { |
921 | label: intl.formatMessage(messages.enableGlobalHideShortcut), | 1108 | label: intl.formatMessage(messages.enableGlobalHideShortcut), |
922 | value: settings.all.app.enableGlobalHideShortcut, | 1109 | value: ifUndefined<boolean>( |
1110 | settings.all.app.enableGlobalHideShortcut, | ||
1111 | DEFAULT_APP_SETTINGS.enableGlobalHideShortcut, | ||
1112 | ), | ||
923 | default: DEFAULT_APP_SETTINGS.enableGlobalHideShortcut, | 1113 | default: DEFAULT_APP_SETTINGS.enableGlobalHideShortcut, |
924 | type: 'checkbox', | 1114 | type: 'checkbox', |
925 | }, | 1115 | }, |
926 | locale: { | 1116 | locale: { |
927 | label: intl.formatMessage(messages.language), | 1117 | label: intl.formatMessage(messages.language), |
928 | value: app.locale, | 1118 | value: ifUndefined<string>(app.locale, DEFAULT_APP_SETTINGS.locale), |
929 | options: locales, | ||
930 | default: DEFAULT_APP_SETTINGS.locale, | 1119 | default: DEFAULT_APP_SETTINGS.locale, |
1120 | options: locales, | ||
931 | }, | 1121 | }, |
932 | beta: { | 1122 | beta: { |
933 | label: intl.formatMessage(messages.beta), | 1123 | label: intl.formatMessage(messages.beta), |
934 | value: user.data.beta, | 1124 | value: ifUndefined<boolean>( |
1125 | user.data.beta, | ||
1126 | DEFAULT_APP_SETTINGS.beta, | ||
1127 | ), | ||
935 | default: DEFAULT_APP_SETTINGS.beta, | 1128 | default: DEFAULT_APP_SETTINGS.beta, |
936 | type: 'checkbox', | 1129 | type: 'checkbox', |
937 | }, | 1130 | }, |
938 | automaticUpdates: { | 1131 | automaticUpdates: { |
939 | label: intl.formatMessage(messages.automaticUpdates), | 1132 | label: intl.formatMessage(messages.automaticUpdates), |
940 | value: settings.app.automaticUpdates, | 1133 | value: ifUndefined<boolean>( |
1134 | settings.app.automaticUpdates, | ||
1135 | DEFAULT_APP_SETTINGS.automaticUpdates, | ||
1136 | ), | ||
941 | default: DEFAULT_APP_SETTINGS.automaticUpdates, | 1137 | default: DEFAULT_APP_SETTINGS.automaticUpdates, |
942 | type: 'checkbox', | 1138 | type: 'checkbox', |
943 | }, | 1139 | }, |
@@ -955,8 +1151,11 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> { | |||
955 | if (workspaces.isFeatureActive) { | 1151 | if (workspaces.isFeatureActive) { |
956 | config.fields.keepAllWorkspacesLoaded = { | 1152 | config.fields.keepAllWorkspacesLoaded = { |
957 | label: intl.formatMessage(messages.keepAllWorkspacesLoaded), | 1153 | label: intl.formatMessage(messages.keepAllWorkspacesLoaded), |
958 | value: workspaces.settings.keepAllWorkspacesLoaded, | 1154 | value: ifUndefined<boolean>( |
959 | default: DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, | 1155 | workspaces.settings.keepAllWorkspacesLoaded, |
1156 | DEFAULT_APP_SETTINGS.keepAllWorkspacesLoaded, | ||
1157 | ), | ||
1158 | default: DEFAULT_APP_SETTINGS.keepAllWorkspacesLoaded, | ||
960 | type: 'checkbox', | 1159 | type: 'checkbox', |
961 | }; | 1160 | }; |
962 | } | 1161 | } |
@@ -964,8 +1163,11 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> { | |||
964 | if (todos.isFeatureActive) { | 1163 | if (todos.isFeatureActive) { |
965 | config.fields.enableTodos = { | 1164 | config.fields.enableTodos = { |
966 | label: intl.formatMessage(messages.enableTodos), | 1165 | label: intl.formatMessage(messages.enableTodos), |
967 | value: todos.settings.isFeatureEnabledByUser, | 1166 | value: ifUndefined<boolean>( |
968 | default: DEFAULT_IS_FEATURE_ENABLED_BY_USER, | 1167 | todos.settings.isFeatureEnabledByUser, |
1168 | DEFAULT_APP_SETTINGS.isFeatureEnabledByUser, | ||
1169 | ), | ||
1170 | default: DEFAULT_APP_SETTINGS.isFeatureEnabledByUser, | ||
969 | type: 'checkbox', | 1171 | type: 'checkbox', |
970 | }; | 1172 | }; |
971 | } | 1173 | } |