1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
|
import { remote } from 'electron';
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import Form from '../../../lib/Form';
import Button from '../../ui/Button';
import Toggle from '../../ui/Toggle';
import Select from '../../ui/Select';
import PremiumFeatureContainer from '../../ui/PremiumFeatureContainer';
import Input from '../../ui/Input';
import { FRANZ_TRANSLATION } from '../../../config';
import { isMac, isWindows } from '../../../environment';
const {
systemPreferences,
} = remote;
const messages = defineMessages({
headline: {
id: 'settings.app.headline',
defaultMessage: '!!!Settings',
},
headlineGeneral: {
id: 'settings.app.headlineGeneral',
defaultMessage: '!!!General',
},
sentryInfo: {
id: 'settings.app.sentryInfo',
defaultMessage: '!!!Sending telemetry data allows us to find errors in Ferdi - we will not send any personal information like your message data! Changing this option requires you to restart Ferdi.',
},
hibernateInfo: {
id: 'settings.app.hibernateInfo',
defaultMessage: '!!!By default, Ferdi will keep all your services open and loaded in the background so they are ready when you want to use them. Service Hibernation will unload your services after a specified amount. This is useful to save RAM or keeping services from slowing down your computer.',
},
inactivityLockInfo: {
id: 'settings.app.inactivityLockInfo',
defaultMessage: '!!!Minutes of inactivity, after which Ferdi should automatically lock. Use 0 to disable',
},
todoServerInfo: {
id: 'settings.app.todoServerInfo',
defaultMessage: '!!!This server will be used for the "Franz Todo" feature. (default: https://app.franztodos.com)',
},
lockedPassword: {
id: 'settings.app.lockedPassword',
defaultMessage: '!!!Password',
},
lockedPasswordInfo: {
id: 'settings.app.lockedPasswordInfo',
defaultMessage: '!!!Please make sure to set a password you\'ll remember.\nIf you loose this password, you will have to reinstall Ferdi.',
},
lockInfo: {
id: 'settings.app.lockInfo',
defaultMessage: '!!!Password Lock allows you to keep your messages protected.\nUsing Password Lock, you will be prompted to enter your password everytime you start Ferdi or lock Ferdi yourself using the lock symbol in the bottom left corner or the shortcut CMD/CTRL+Shift+L.',
},
scheduledDNDTimeInfo: {
id: 'settings.app.scheduledDNDTimeInfo',
defaultMessage: '!!!Times in 24-Hour-Format. End time can be before start time (e.g. start 17:00, end 09:00) to enable Do-not-Disturb overnight.',
},
scheduledDNDInfo: {
id: 'settings.app.scheduledDNDInfo',
defaultMessage: '!!!Scheduled Do-not-Disturb allows you to define a period of time in which you do not want to get Notifications from Ferdi.',
},
headlineLanguage: {
id: 'settings.app.headlineLanguage',
defaultMessage: '!!!Language',
},
headlineUpdates: {
id: 'settings.app.headlineUpdates',
defaultMessage: '!!!Updates',
},
headlineAppearance: {
id: 'settings.app.headlineAppearance',
defaultMessage: '!!!Appearance',
},
universalDarkModeInfo: {
id: 'settings.app.universalDarkModeInfo',
defaultMessage: '!!!Universal Dark Mode tries to dynamically generate dark mode styles for services that are otherwise not currently supported.',
},
accentColorInfo: {
id: 'settings.app.accentColorInfo',
defaultMessage: '!!!Write your accent color in a CSS-compatible format. (Default: #7367f0)',
},
headlineAdvanced: {
id: 'settings.app.headlineAdvanced',
defaultMessage: '!!!Advanced',
},
translationHelp: {
id: 'settings.app.translationHelp',
defaultMessage: '!!!Help us to translate Ferdi into your language.',
},
spellCheckerLanguageInfo: {
id: 'settings.app.spellCheckerLanguageInfo',
defaultMessage: '!!!Ferdi uses your Mac\'s build-in spellchecker to check for typos. If you want to change the languages the spellchecker checks for, you can do so in your Mac\'s System Preferences.',
},
subheadlineCache: {
id: 'settings.app.subheadlineCache',
defaultMessage: '!!!Cache',
},
cacheInfo: {
id: 'settings.app.cacheInfo',
defaultMessage: '!!!Ferdi cache is currently using {size} of disk space.',
},
cacheNotCleared: {
id: 'settings.app.cacheNotCleared',
defaultMessage: '!!!Couldn\'t clear all cache',
},
buttonClearAllCache: {
id: 'settings.app.buttonClearAllCache',
defaultMessage: '!!!Clear cache',
},
buttonSearchForUpdate: {
id: 'settings.app.buttonSearchForUpdate',
defaultMessage: '!!!Check for updates',
},
buttonInstallUpdate: {
id: 'settings.app.buttonInstallUpdate',
defaultMessage: '!!!Restart & install update',
},
updateStatusSearching: {
id: 'settings.app.updateStatusSearching',
defaultMessage: '!!!Is searching for update',
},
updateStatusAvailable: {
id: 'settings.app.updateStatusAvailable',
defaultMessage: '!!!Update available, downloading...',
},
updateStatusUpToDate: {
id: 'settings.app.updateStatusUpToDate',
defaultMessage: '!!!You are using the latest version of Ferdi',
},
currentVersion: {
id: 'settings.app.currentVersion',
defaultMessage: '!!!Current version:',
},
enableGPUAccelerationInfo: {
id: 'settings.app.restartRequired',
defaultMessage: '!!!Changes require restart',
},
languageDisclaimer: {
id: 'settings.app.languageDisclaimer',
defaultMessage: '!!!Official translations are English & German. All other languages are community based translations.',
},
});
const Hr = () => (
<hr style={{ marginBottom: 20 }} />
);
export default @observer class EditSettingsForm extends Component {
static propTypes = {
checkForUpdates: PropTypes.func.isRequired,
installUpdate: PropTypes.func.isRequired,
form: PropTypes.instanceOf(Form).isRequired,
onSubmit: PropTypes.func.isRequired,
isCheckingForUpdates: PropTypes.bool.isRequired,
isUpdateAvailable: PropTypes.bool.isRequired,
noUpdateAvailable: PropTypes.bool.isRequired,
updateIsReadyToInstall: PropTypes.bool.isRequired,
isClearingAllCache: PropTypes.bool.isRequired,
onClearAllCache: PropTypes.func.isRequired,
cacheSize: PropTypes.string.isRequired,
isSpellcheckerIncludedInCurrentPlan: PropTypes.bool.isRequired,
isTodosEnabled: PropTypes.bool.isRequired,
isTodosActivated: PropTypes.bool.isRequired,
isWorkspaceEnabled: PropTypes.bool.isRequired,
automaticUpdates: PropTypes.bool.isRequired,
hibernationEnabled: PropTypes.bool.isRequired,
isDarkmodeEnabled: PropTypes.bool.isRequired,
isAdaptableDarkModeEnabled: PropTypes.bool.isRequired,
openProcessManager: PropTypes.func.isRequired,
};
static contextTypes = {
intl: intlShape,
};
state = {
activeSetttingsTab: 'general',
clearCacheButtonClicked: false,
}
setActiveSettingsTab(tab) {
this.setState({
activeSetttingsTab: tab,
});
}
onClearCacheClicked=() => {
this.setState({ clearCacheButtonClicked: true });
}
submit(e) {
e.preventDefault();
this.props.form.submit({
onSuccess: (form) => {
const values = form.values();
this.props.onSubmit(values);
},
onError: () => {},
});
}
render() {
const {
checkForUpdates,
installUpdate,
form,
isCheckingForUpdates,
isAdaptableDarkModeEnabled,
isUpdateAvailable,
noUpdateAvailable,
updateIsReadyToInstall,
isClearingAllCache,
onClearAllCache,
cacheSize,
isSpellcheckerIncludedInCurrentPlan,
isTodosEnabled,
isWorkspaceEnabled,
automaticUpdates,
hibernationEnabled,
isDarkmodeEnabled,
openProcessManager,
isTodosActivated,
} = this.props;
const { intl } = this.context;
let updateButtonLabelMessage = messages.buttonSearchForUpdate;
if (isCheckingForUpdates) {
updateButtonLabelMessage = messages.updateStatusSearching;
} else if (isUpdateAvailable) {
updateButtonLabelMessage = messages.updateStatusAvailable;
} else {
updateButtonLabelMessage = messages.buttonSearchForUpdate;
}
const {
lockingFeatureEnabled,
scheduledDNDEnabled,
} = window.ferdi.stores.settings.all.app;
const notCleared = this.state.clearCacheButtonClicked && isClearingAllCache === false && cacheSize !== 0;
return (
<div className="settings__main">
<div className="settings__header">
<h1>{intl.formatMessage(messages.headline)}</h1>
</div>
<div className="settings__body">
<form
onSubmit={e => this.submit(e)}
onChange={e => this.submit(e)}
id="form"
>
{/* Titles */}
<div className="recipes__navigation">
<h2
id="general"
className={this.state.activeSetttingsTab === 'general' ? 'badge badge--primary' : 'badge'}
onClick={() => { this.setActiveSettingsTab('general'); }}
>
{intl.formatMessage(messages.headlineGeneral)}
</h2>
<h2
id="appearance"
className={this.state.activeSetttingsTab === 'appearance' ? 'badge badge--primary' : 'badge'}
onClick={() => { this.setActiveSettingsTab('appearance'); }}
>
{intl.formatMessage(messages.headlineAppearance)}
</h2>
<h2
id="language"
className={this.state.activeSetttingsTab === 'language' ? 'badge badge--primary' : 'badge'}
onClick={() => { this.setActiveSettingsTab('language'); }}
>
{intl.formatMessage(messages.headlineLanguage)}
</h2>
<h2
id="advanced"
className={this.state.activeSetttingsTab === 'advanced' ? 'badge badge--primary' : 'badge'}
onClick={() => { this.setActiveSettingsTab('advanced'); }}
>
{intl.formatMessage(messages.headlineAdvanced)}
</h2>
<h2
id="updates"
className={this.state.activeSetttingsTab === 'updates' ? 'badge badge--primary' : 'badge'}
onClick={() => { this.setActiveSettingsTab('updates'); }}
>
{intl.formatMessage(messages.headlineUpdates)}
</h2>
</div>
{/* General */}
{ this.state.activeSetttingsTab === 'general' && (
<div>
<Toggle field={form.$('autoLaunchOnStart')} />
<Toggle field={form.$('runInBackground')} />
<Toggle field={form.$('enableSystemTray')} />
<Toggle field={form.$('reloadAfterResume')} />
<Toggle field={form.$('startMinimized')} />
{process.platform === 'win32' && (
<Toggle field={form.$('minimizeToSystemTray')} />
)}
<Toggle field={form.$('privateNotifications')} />
<Select field={form.$('navigationBarBehaviour')} />
<Hr />
<Toggle field={form.$('sentry')} />
<p>{intl.formatMessage(messages.sentryInfo)}</p>
<Hr />
<Toggle field={form.$('hibernate')} />
{hibernationEnabled && (
<>
<Select field={form.$('hibernationStrategy')} />
<Toggle field={form.$('hibernateOnStartup')} />
</>
)}
<p
className="settings__message"
style={{
borderTop: 0, marginTop: 0, paddingTop: 0, marginBottom: '2rem',
}}
>
<span>
{ intl.formatMessage(messages.hibernateInfo) }
</span>
</p>
<Hr />
{isWorkspaceEnabled && (
<Toggle field={form.$('keepAllWorkspacesLoaded')} />
)}
<Hr />
{isTodosEnabled && (
<>
<Toggle field={form.$('enableTodos')} />
{isTodosActivated && (
<div>
<Select field={form.$('predefinedTodoServer')} />
{form.$('predefinedTodoServer').value === 'isUsingCustomTodoService' && (
<div>
<Input
placeholder="Todo Server"
onChange={e => this.submit(e)}
field={form.$('customTodoServer')}
/>
<p
className="settings__message"
style={{
borderTop: 0, marginTop: 0, paddingTop: 0, marginBottom: '2rem',
}}
>
{ intl.formatMessage(messages.todoServerInfo) }
</p>
</div>
)}
</div>
)}
</>
)}
<Hr />
<Toggle field={form.$('lockingFeatureEnabled')} />
{lockingFeatureEnabled && (
<>
{isMac && systemPreferences.canPromptTouchID() && (
<Toggle field={form.$('useTouchIdToUnlock')} />
)}
<Input
placeholder={intl.formatMessage(messages.lockedPassword)}
onChange={e => this.submit(e)}
field={form.$('lockedPassword')}
type="password"
scorePassword
showPasswordToggle
/>
<p>
{ intl.formatMessage(messages.lockedPasswordInfo) }
</p>
<Input
placeholder="Lock after inactivity"
onChange={e => this.submit(e)}
field={form.$('inactivityLock')}
autoFocus
/>
<p>
{ intl.formatMessage(messages.inactivityLockInfo) }
</p>
</>
)}
<p
className="settings__message"
style={{
borderTop: 0, marginTop: 0, paddingTop: 0, marginBottom: '2rem',
}}
>
<span>
{ intl.formatMessage(messages.lockInfo) }
</span>
</p>
<Hr />
<Toggle field={form.$('scheduledDNDEnabled')} />
{scheduledDNDEnabled && (
<>
<div style={{
display: 'flex',
justifyContent: 'center',
}}
>
<div style={{
padding: '0 1rem',
width: '100%',
}}
>
<Input
placeholder="17:00"
onChange={e => this.submit(e)}
field={form.$('scheduledDNDStart')}
type="time"
/>
</div>
<div style={{
padding: '0 1rem',
width: '100%',
}}
>
<Input
placeholder="09:00"
onChange={e => this.submit(e)}
field={form.$('scheduledDNDEnd')}
type="time"
/>
</div>
</div>
<p>
{ intl.formatMessage(messages.scheduledDNDTimeInfo) }
</p>
</>
)}
<p
className="settings__message"
style={{
borderTop: 0, marginTop: 0, paddingTop: 0, marginBottom: '2rem',
}}
>
<span>
{ intl.formatMessage(messages.scheduledDNDInfo) }
</span>
</p>
</div>
)}
{/* Appearance */}
{ this.state.activeSetttingsTab === 'appearance' && (
<div>
<Toggle field={form.$('showDisabledServices')} />
<Toggle field={form.$('showMessageBadgeWhenMuted')} />
{isMac && <Toggle field={form.$('showDragArea')} />}
<Hr />
{(isMac || isWindows) && <Toggle field={form.$('adaptableDarkMode')} />}
{!((isMac || isWindows) && isAdaptableDarkModeEnabled) && <Toggle field={form.$('darkMode')} />}
{(isDarkmodeEnabled || isAdaptableDarkModeEnabled) && (
<>
<Toggle field={form.$('universalDarkMode')} />
<p
className="settings__message"
style={{
borderTop: 0, marginTop: 0, paddingTop: 0, marginBottom: '2rem',
}}
>
<span>
{ intl.formatMessage(messages.universalDarkModeInfo) }
</span>
</p>
</>
)}
<Hr />
<Select field={form.$('serviceRibbonWidth')} />
<Select field={form.$('iconSize')} />
<Hr />
<Input
placeholder="Accent Color"
onChange={e => this.submit(e)}
field={form.$('accentColor')}
/>
<p>{intl.formatMessage(messages.accentColorInfo)}</p>
</div>
)}
{/* Language */}
{ this.state.activeSetttingsTab === 'language' && (
<div>
<Select field={form.$('locale')} showLabel={false} />
<Hr />
<PremiumFeatureContainer
condition={!isSpellcheckerIncludedInCurrentPlan}
gaEventInfo={{ category: 'User', event: 'upgrade', label: 'spellchecker' }}
>
<Fragment>
<Toggle
field={form.$('enableSpellchecking')}
/>
{form.$('enableSpellchecking').value && !isMac && (
<Select field={form.$('spellcheckerLanguage')} multiple />
)}
{form.$('enableSpellchecking').value && isMac && (
<p>{intl.formatMessage(messages.spellCheckerLanguageInfo)}</p>
)}
</Fragment>
</PremiumFeatureContainer>
<a
href={FRANZ_TRANSLATION}
target="_blank"
className="link"
>
{intl.formatMessage(messages.translationHelp)}
{' '}
<i className="mdi mdi-open-in-new" />
</a>
</div>
)}
{/* Advanced */}
{ this.state.activeSetttingsTab === 'advanced' && (
<div>
<Toggle field={form.$('enableGPUAcceleration')} />
<p className="settings__help">{intl.formatMessage(messages.enableGPUAccelerationInfo)}</p>
<div className="settings__settings-group">
<h3>
{intl.formatMessage(messages.subheadlineCache)}
</h3>
<p>
{intl.formatMessage(messages.cacheInfo, {
size: cacheSize,
})}
</p>
{
notCleared && (
<p>
{intl.formatMessage(messages.cacheNotCleared)}
</p>
)
}
<p>
<Button
buttonType="secondary"
label={intl.formatMessage(messages.buttonClearAllCache)}
onClick={() => { onClearAllCache(); this.onClearCacheClicked(); }}
disabled={isClearingAllCache}
loaded={!isClearingAllCache}
/>
</p>
<div style={{
marginTop: 20,
}}
>
<Button
buttonType="secondary"
label="Open Process Manager"
onClick={openProcessManager}
/>
</div>
</div>
</div>
)}
{/* Updates */}
{ this.state.activeSetttingsTab === 'updates' && (
<div>
<Toggle field={form.$('automaticUpdates')} />
{automaticUpdates && (
<div>
<Toggle field={form.$('beta')} />
{updateIsReadyToInstall ? (
<Button
label={intl.formatMessage(messages.buttonInstallUpdate)}
onClick={installUpdate}
/>
) : (
<Button
buttonType="secondary"
label={intl.formatMessage(updateButtonLabelMessage)}
onClick={checkForUpdates}
disabled={!automaticUpdates || isCheckingForUpdates || isUpdateAvailable}
loaded={!isCheckingForUpdates || !isUpdateAvailable}
/>
)}
<br />
</div>
)}
{intl.formatMessage(messages.currentVersion)}
{' '}
{remote.app.getVersion()}
{noUpdateAvailable && (
<>
<br />
<br />
{intl.formatMessage(messages.updateStatusUpToDate)}
</>
)
}
<p className="settings__message">
<span className="mdi mdi-github-face" />
<span>
Ferdi is based on
{' '}
<a href="https://github.com/meetfranz/franz" target="_blank">Franz</a>
, a project published
under the
{' '}
<a href="https://github.com/meetfranz/franz/blob/master/LICENSE" target="_blank">Apache-2.0 License</a>
</span>
<br />
<span className="mdi mdi-information" />
{intl.formatMessage(messages.languageDisclaimer)}
</p>
</div>
)}
</form>
</div>
</div>
);
}
}
|