@@ -33,6 +33,10 @@ import {
33
33
SET_ACTION_ACCESSIBILITY_SUCCEEDED ,
34
34
FLAG_SETTING_ACTIONS_AS_ENABLED ,
35
35
SET_ACTIONS_AS_ENABLED_SUCCEEDED ,
36
+ FLAG_SETTING_FONT_SIZE ,
37
+ SET_FONT_SIZE_SUCCEEDED ,
38
+ GET_FONT_SIZE_SUCCEEDED ,
39
+ FLAG_GETTING_FONT_SIZE ,
36
40
} from '../types' ;
37
41
import {
38
42
ERROR_GETTING_GEOLOCATION ,
@@ -52,6 +56,8 @@ import {
52
56
ERROR_SETTING_SPACE_AS_RECENT ,
53
57
ERROR_SETTING_ACTION_ACCESSIBILITY ,
54
58
ERROR_SETTING_ACTIONS_AS_ENABLED ,
59
+ ERROR_SETTING_FONT_SIZE ,
60
+ ERROR_GETTING_FONT_SIZE ,
55
61
} from '../config/messages' ;
56
62
import {
57
63
GET_USER_FOLDER_CHANNEL ,
@@ -69,6 +75,8 @@ import {
69
75
SET_SPACE_AS_RECENT_CHANNEL ,
70
76
SET_ACTION_ACCESSIBILITY_CHANNEL ,
71
77
SET_ACTIONS_AS_ENABLED_CHANNEL ,
78
+ SET_FONT_SIZE_CHANNEL ,
79
+ GET_FONT_SIZE_CHANNEL ,
72
80
} from '../config/channels' ;
73
81
import { createFlag } from './common' ;
74
82
import { ERROR_GENERAL } from '../config/errors' ;
@@ -94,6 +102,8 @@ const flagSettingActionAccessibility = createFlag(
94
102
FLAG_SETTING_ACTION_ACCESSIBILITY
95
103
) ;
96
104
const flagSettingActionsAsEnabled = createFlag ( FLAG_SETTING_ACTIONS_AS_ENABLED ) ;
105
+ const flagSettingFontSize = createFlag ( FLAG_SETTING_FONT_SIZE ) ;
106
+ const flagGettingFontSize = createFlag ( FLAG_GETTING_FONT_SIZE ) ;
97
107
98
108
const getGeolocation = async ( ) => async ( dispatch ) => {
99
109
// only fetch location if online
@@ -535,6 +545,54 @@ const setActionsAsEnabled = (payload) => (dispatch) => {
535
545
}
536
546
} ;
537
547
548
+ const setFontSize = ( payload ) => ( dispatch ) => {
549
+ try {
550
+ dispatch ( flagSettingFontSize ( true ) ) ;
551
+ window . ipcRenderer . send ( SET_FONT_SIZE_CHANNEL , payload ) ;
552
+ window . ipcRenderer . once ( SET_FONT_SIZE_CHANNEL , ( event , response ) => {
553
+ if ( response === ERROR_GENERAL ) {
554
+ toastr . error (
555
+ i18n . t ( ERROR_MESSAGE_HEADER ) ,
556
+ i18n . t ( ERROR_SETTING_FONT_SIZE )
557
+ ) ;
558
+ } else {
559
+ dispatch ( {
560
+ type : SET_FONT_SIZE_SUCCEEDED ,
561
+ payload,
562
+ } ) ;
563
+ }
564
+ dispatch ( flagSettingFontSize ( false ) ) ;
565
+ } ) ;
566
+ } catch ( e ) {
567
+ console . error ( e ) ;
568
+ toastr . error ( i18n . t ( ERROR_MESSAGE_HEADER ) , i18n . t ( ERROR_SETTING_FONT_SIZE ) ) ;
569
+ }
570
+ } ;
571
+
572
+ const getFontSize = ( ) => ( dispatch ) => {
573
+ try {
574
+ dispatch ( flagGettingFontSize ( true ) ) ;
575
+ window . ipcRenderer . send ( GET_FONT_SIZE_CHANNEL ) ;
576
+ window . ipcRenderer . once ( GET_FONT_SIZE_CHANNEL , ( event , response ) => {
577
+ if ( response === ERROR_GENERAL ) {
578
+ toastr . error (
579
+ i18n . t ( ERROR_MESSAGE_HEADER ) ,
580
+ i18n . t ( ERROR_GETTING_FONT_SIZE )
581
+ ) ;
582
+ } else {
583
+ dispatch ( {
584
+ type : GET_FONT_SIZE_SUCCEEDED ,
585
+ payload : response ,
586
+ } ) ;
587
+ }
588
+ dispatch ( flagGettingFontSize ( false ) ) ;
589
+ } ) ;
590
+ } catch ( e ) {
591
+ console . error ( e ) ;
592
+ toastr . error ( i18n . t ( ERROR_MESSAGE_HEADER ) , i18n . t ( ERROR_GETTING_FONT_SIZE ) ) ;
593
+ }
594
+ } ;
595
+
538
596
export {
539
597
getUserFolder ,
540
598
getGeolocation ,
@@ -552,4 +610,6 @@ export {
552
610
setSpaceAsRecent ,
553
611
setActionAccessibility ,
554
612
setActionsAsEnabled ,
613
+ setFontSize ,
614
+ getFontSize ,
555
615
} ;
0 commit comments