aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2021-10-20 10:49:47 +0530
committerLibravatar GitHub <noreply@github.com>2021-10-20 10:49:47 +0530
commit9a64b4322adadbe18929c2da114eb0813426c4f9 (patch)
treee9dfa8b9e14b38720fa4487b7175ed26a8076da7 /src
parent5.6.3-nightly.38 [skip ci] (diff)
downloadferdium-app-9a64b4322adadbe18929c2da114eb0813426c4f9.tar.gz
ferdium-app-9a64b4322adadbe18929c2da114eb0813426c4f9.tar.zst
ferdium-app-9a64b4322adadbe18929c2da114eb0813426c4f9.zip
chore: use 'window['ferdi']' (split out from pr #2092) (#2104)
Co-authored-by: Markus Hatvan <markus_hatvan@aon.at>
Diffstat (limited to 'src')
-rw-r--r--src/I18n.js4
-rw-r--r--src/app.js4
-rw-r--r--src/components/auth/AuthLayout.js2
-rw-r--r--src/components/auth/Login.js4
-rw-r--r--src/components/layout/AppLayout.js2
-rw-r--r--src/components/settings/settings/EditSettingsForm.js4
-rw-r--r--src/features/publishDebugInfo/index.js2
-rw-r--r--src/lib/Menu.js34
-rw-r--r--src/models/Service.js2
-rw-r--r--src/models/UserAgent.js2
-rw-r--r--src/stores/GlobalErrorStore.js6
11 files changed, 33 insertions, 33 deletions
diff --git a/src/I18n.js b/src/I18n.js
index 2a50050ee..b10c5a94b 100644
--- a/src/I18n.js
+++ b/src/I18n.js
@@ -12,7 +12,7 @@ import AppStore from './stores/AppStore';
12@observer 12@observer
13class I18N extends Component { 13class I18N extends Component {
14 componentDidUpdate() { 14 componentDidUpdate() {
15 window.ferdi.menu.rebuild(); 15 window['ferdi'].menu.rebuild();
16 } 16 }
17 17
18 render() { 18 render() {
@@ -22,7 +22,7 @@ class I18N extends Component {
22 <IntlProvider 22 <IntlProvider
23 {...{ locale, key: locale, messages: translations[locale] }} 23 {...{ locale, key: locale, messages: translations[locale] }}
24 ref={intlProvider => { 24 ref={intlProvider => {
25 window.ferdi.intl = intlProvider ? intlProvider.state.intl : null; 25 window['ferdi'].intl = intlProvider ? intlProvider.state.intl : null;
26 }} 26 }}
27 > 27 >
28 {children} 28 {children}
diff --git a/src/app.js b/src/app.js
index aea57a673..f52ecdfdc 100644
--- a/src/app.js
+++ b/src/app.js
@@ -28,7 +28,7 @@ window.addEventListener('load', () => {
28 const menu = new MenuFactory(stores, actions); 28 const menu = new MenuFactory(stores, actions);
29 const touchBar = new TouchBarFactory(stores, actions); 29 const touchBar = new TouchBarFactory(stores, actions);
30 30
31 window.ferdi = { 31 window['ferdi'] = {
32 stores, 32 stores,
33 actions, 33 actions,
34 api, 34 api,
@@ -46,7 +46,7 @@ window.addEventListener('load', () => {
46 render(preparedApp, document.querySelector('#root')); 46 render(preparedApp, document.querySelector('#root'));
47 }, 47 },
48 }; 48 };
49 window.ferdi.render(); 49 window['ferdi'].render();
50}); 50});
51 51
52// Prevent drag and drop into window from redirecting 52// Prevent drag and drop into window from redirecting
diff --git a/src/components/auth/AuthLayout.js b/src/components/auth/AuthLayout.js
index 00eded728..047b10775 100644
--- a/src/components/auth/AuthLayout.js
+++ b/src/components/auth/AuthLayout.js
@@ -54,7 +54,7 @@ class AuthLayout extends Component {
54 <> 54 <>
55 {isWindows && !isFullScreen && ( 55 {isWindows && !isFullScreen && (
56 <TitleBar 56 <TitleBar
57 menu={window.ferdi.menu.template} 57 menu={window['ferdi'].menu.template}
58 icon="assets/images/logo.svg" 58 icon="assets/images/logo.svg"
59 /> 59 />
60 )} 60 )}
diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js
index 9f3f636e3..6ed89afb6 100644
--- a/src/components/auth/Login.js
+++ b/src/components/auth/Login.js
@@ -168,12 +168,12 @@ class Login extends Component {
168 <p className="error-message center"> 168 <p className="error-message center">
169 {intl.formatMessage(messages.invalidCredentials)} 169 {intl.formatMessage(messages.invalidCredentials)}
170 </p> 170 </p>
171 {window.ferdi.stores.settings.all.app.server !== 171 {window['ferdi'].stores.settings.all.app.server !==
172 LIVE_FRANZ_API && ( 172 LIVE_FRANZ_API && (
173 <p className="error-message center"> 173 <p className="error-message center">
174 {intl.formatMessage(messages.customServerQuestion)}{' '} 174 {intl.formatMessage(messages.customServerQuestion)}{' '}
175 <Link 175 <Link
176 to={`${window.ferdi.stores.settings.all.app.server.replace( 176 to={`${window['ferdi'].stores.settings.all.app.server.replace(
177 API_VERSION, 177 API_VERSION,
178 '', 178 '',
179 )}/import`} 179 )}/import`}
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js
index 4bacc547b..9ae72a6c1 100644
--- a/src/components/layout/AppLayout.js
+++ b/src/components/layout/AppLayout.js
@@ -115,7 +115,7 @@ class AppLayout extends Component {
115 <div className="app"> 115 <div className="app">
116 {isWindows && !isFullScreen && ( 116 {isWindows && !isFullScreen && (
117 <TitleBar 117 <TitleBar
118 menu={window.ferdi.menu.template} 118 menu={window['ferdi'].menu.template}
119 icon="assets/images/logo.svg" 119 icon="assets/images/logo.svg"
120 /> 120 />
121 )} 121 )}
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js
index 948e9ccd5..7b028b757 100644
--- a/src/components/settings/settings/EditSettingsForm.js
+++ b/src/components/settings/settings/EditSettingsForm.js
@@ -265,7 +265,7 @@ class EditSettingsForm extends Component {
265 } 265 }
266 266
267 const { lockingFeatureEnabled, scheduledDNDEnabled } = 267 const { lockingFeatureEnabled, scheduledDNDEnabled } =
268 window.ferdi.stores.settings.all.app; 268 window['ferdi'].stores.settings.all.app;
269 269
270 let cacheSize; 270 let cacheSize;
271 let notCleared; 271 let notCleared;
@@ -768,7 +768,7 @@ class EditSettingsForm extends Component {
768 name: 'Nightly builds', 768 name: 'Nightly builds',
769 }} 769 }}
770 onChange={ 770 onChange={
771 window.ferdi.features.nightlyBuilds.toggleFeature 771 window['ferdi'].features.nightlyBuilds.toggleFeature
772 } 772 }
773 /> 773 />
774 {updateIsReadyToInstall ? ( 774 {updateIsReadyToInstall ? (
diff --git a/src/features/publishDebugInfo/index.js b/src/features/publishDebugInfo/index.js
index 51780a34e..43841b530 100644
--- a/src/features/publishDebugInfo/index.js
+++ b/src/features/publishDebugInfo/index.js
@@ -12,7 +12,7 @@ export default function initialize() {
12 state.isModalVisible = true; 12 state.isModalVisible = true;
13 } 13 }
14 14
15 window.ferdi.features.publishDebugInfo = { 15 window['ferdi'].features.publishDebugInfo = {
16 state, 16 state,
17 showModal, 17 showModal,
18 }; 18 };
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index b1cbaf992..1495fc80e 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -313,7 +313,7 @@ const menuItems = defineMessages({
313}); 313});
314 314
315function getActiveService() { 315function getActiveService() {
316 return window.ferdi.stores.services.active; 316 return window['ferdi'].stores.services.active;
317} 317}
318 318
319const _titleBarTemplateFactory = (intl, locked) => [ 319const _titleBarTemplateFactory = (intl, locked) => [
@@ -375,7 +375,7 @@ const _titleBarTemplateFactory = (intl, locked) => [
375 label: intl.formatMessage(menuItems.openQuickSwitch), 375 label: intl.formatMessage(menuItems.openQuickSwitch),
376 accelerator: `${cmdOrCtrlShortcutKey()}+S`, 376 accelerator: `${cmdOrCtrlShortcutKey()}+S`,
377 click() { 377 click() {
378 window.ferdi.features.quickSwitch.state.isModalVisible = true; 378 window['ferdi'].features.quickSwitch.state.isModalVisible = true;
379 }, 379 },
380 }, 380 },
381 { 381 {
@@ -391,7 +391,7 @@ const _titleBarTemplateFactory = (intl, locked) => [
391 // Focus webview so find in page popup gets focused 391 // Focus webview so find in page popup gets focused
392 service.webview.focus(); 392 service.webview.focus();
393 393
394 window.ferdi.actions.service.sendIPCMessage({ 394 window['ferdi'].actions.service.sendIPCMessage({
395 serviceId: service.id, 395 serviceId: service.id,
396 channel: 'find-in-page', 396 channel: 'find-in-page',
397 args: {}, 397 args: {},
@@ -457,12 +457,12 @@ const _titleBarTemplateFactory = (intl, locked) => [
457 label: intl.formatMessage(menuItems.toggleDarkMode), 457 label: intl.formatMessage(menuItems.toggleDarkMode),
458 type: 'checkbox', 458 type: 'checkbox',
459 accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+D`, 459 accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+D`,
460 checked: window.ferdi.stores.settings.app.darkMode, 460 checked: window['ferdi'].stores.settings.app.darkMode,
461 click: () => { 461 click: () => {
462 window.ferdi.actions.settings.update({ 462 window['ferdi'].actions.settings.update({
463 type: 'app', 463 type: 'app',
464 data: { 464 data: {
465 darkMode: !window.ferdi.stores.settings.app.darkMode, 465 darkMode: !window['ferdi'].stores.settings.app.darkMode,
466 }, 466 },
467 }); 467 });
468 }, 468 },
@@ -579,13 +579,13 @@ class FranzMenu {
579 // need to clone object so we don't modify computed (cached) object 579 // need to clone object so we don't modify computed (cached) object
580 const serviceTpl = Object.assign([], this.serviceTpl()); 580 const serviceTpl = Object.assign([], this.serviceTpl());
581 581
582 // Don't initialize when window.ferdi is undefined 582 // Don't initialize when window['ferdi'] is undefined
583 if (window.ferdi === undefined) { 583 if (window['ferdi'] === undefined) {
584 console.log('skipping menu init'); 584 console.log('skipping menu init');
585 return; 585 return;
586 } 586 }
587 587
588 const { intl } = window.ferdi; 588 const { intl } = window['ferdi'];
589 const tpl = _titleBarTemplateFactory(intl, this.stores.settings.app.locked); 589 const tpl = _titleBarTemplateFactory(intl, this.stores.settings.app.locked);
590 const { actions } = this; 590 const { actions } = this;
591 591
@@ -593,13 +593,13 @@ class FranzMenu {
593 tpl[1].submenu.push({ 593 tpl[1].submenu.push({
594 label: intl.formatMessage(menuItems.autohideMenuBar), 594 label: intl.formatMessage(menuItems.autohideMenuBar),
595 type: 'checkbox', 595 type: 'checkbox',
596 checked: window.ferdi.stores.settings.app.autohideMenuBar, 596 checked: window['ferdi'].stores.settings.app.autohideMenuBar,
597 click: () => { 597 click: () => {
598 window.ferdi.actions.settings.update({ 598 window['ferdi'].actions.settings.update({
599 type: 'app', 599 type: 'app',
600 data: { 600 data: {
601 autohideMenuBar: 601 autohideMenuBar:
602 !window.ferdi.stores.settings.app.autohideMenuBar, 602 !window['ferdi'].stores.settings.app.autohideMenuBar,
603 }, 603 },
604 }); 604 });
605 }, 605 },
@@ -893,7 +893,7 @@ class FranzMenu {
893 } 893 }
894 894
895 serviceTpl() { 895 serviceTpl() {
896 const { intl } = window.ferdi; 896 const { intl } = window['ferdi'];
897 const { user, services, settings } = this.stores; 897 const { user, services, settings } = this.stores;
898 if (!user.isLoggedIn) return []; 898 if (!user.isLoggedIn) return [];
899 const menu = []; 899 const menu = [];
@@ -988,7 +988,7 @@ class FranzMenu {
988 workspacesMenu() { 988 workspacesMenu() {
989 const { workspaces, activeWorkspace, isWorkspaceDrawerOpen } = 989 const { workspaces, activeWorkspace, isWorkspaceDrawerOpen } =
990 workspaceStore; 990 workspaceStore;
991 const { intl } = window.ferdi; 991 const { intl } = window['ferdi'];
992 const menu = []; 992 const menu = [];
993 993
994 // Add new workspace item: 994 // Add new workspace item:
@@ -1050,7 +1050,7 @@ class FranzMenu {
1050 1050
1051 todosMenu() { 1051 todosMenu() {
1052 const { isTodosPanelVisible, isFeatureEnabledByUser } = this.stores.todos; 1052 const { isTodosPanelVisible, isFeatureEnabledByUser } = this.stores.todos;
1053 const { intl } = window.ferdi; 1053 const { intl } = window['ferdi'];
1054 const menu = []; 1054 const menu = [];
1055 1055
1056 const drawerLabel = isTodosPanelVisible 1056 const drawerLabel = isTodosPanelVisible
@@ -1084,7 +1084,7 @@ class FranzMenu {
1084 } 1084 }
1085 1085
1086 debugMenu() { 1086 debugMenu() {
1087 const { intl } = window.ferdi; 1087 const { intl } = window['ferdi'];
1088 1088
1089 return [ 1089 return [
1090 { 1090 {
@@ -1107,7 +1107,7 @@ class FranzMenu {
1107 { 1107 {
1108 label: intl.formatMessage(menuItems.publishDebugInfo), 1108 label: intl.formatMessage(menuItems.publishDebugInfo),
1109 click: () => { 1109 click: () => {
1110 window.ferdi.features.publishDebugInfo.state.isModalVisible = true; 1110 window['ferdi'].features.publishDebugInfo.state.isModalVisible = true;
1111 }, 1111 },
1112 }, 1112 },
1113 ]; 1113 ];
diff --git a/src/models/Service.js b/src/models/Service.js
index 12109fb0a..d94f55692 100644
--- a/src/models/Service.js
+++ b/src/models/Service.js
@@ -171,7 +171,7 @@ export default class Service {
171 ); 171 );
172 172
173 // Check if "Hibernate on Startup" is enabled and hibernate all services except active one 173 // Check if "Hibernate on Startup" is enabled and hibernate all services except active one
174 const { hibernateOnStartup } = window.ferdi.stores.settings.app; 174 const { hibernateOnStartup } = window['ferdi'].stores.settings.app;
175 // The service store is probably not loaded yet so we need to use localStorage data to get active service 175 // The service store is probably not loaded yet so we need to use localStorage data to get active service
176 const isActive = 176 const isActive =
177 window.localStorage.service && 177 window.localStorage.service &&
diff --git a/src/models/UserAgent.js b/src/models/UserAgent.js
index 02ff97db1..f971fb08a 100644
--- a/src/models/UserAgent.js
+++ b/src/models/UserAgent.js
@@ -37,7 +37,7 @@ export default class UserAgent {
37 if (typeof this.getUserAgent === 'function') { 37 if (typeof this.getUserAgent === 'function') {
38 return this.getUserAgent(); 38 return this.getUserAgent();
39 } 39 }
40 const globalPref = window.ferdi.stores.settings.all.app.userAgentPref; 40 const globalPref = window['ferdi'].stores.settings.all.app.userAgentPref;
41 if (typeof globalPref === 'string') { 41 if (typeof globalPref === 'string') {
42 const trimmed = globalPref.trim(); 42 const trimmed = globalPref.trim();
43 if (trimmed !== '') { 43 if (trimmed !== '') {
diff --git a/src/stores/GlobalErrorStore.js b/src/stores/GlobalErrorStore.js
index 7cbfdc608..9c851d6f2 100644
--- a/src/stores/GlobalErrorStore.js
+++ b/src/stores/GlobalErrorStore.js
@@ -64,7 +64,7 @@ export default class GlobalErrorStore extends Store {
64 this.response = {}; 64 this.response = {};
65 } 65 }
66 if (this.error.status === 401) { 66 if (this.error.status === 401) {
67 window.ferdi.stores.app.authRequestFailed = true; 67 window['ferdi'].stores.app.authRequestFailed = true;
68 // this.actions.user.logout({ serverLogout: true }); 68 // this.actions.user.logout({ serverLogout: true });
69 } 69 }
70 } 70 }
@@ -78,10 +78,10 @@ export default class GlobalErrorStore extends Store {
78 }, 78 },
79 error: this.error, 79 error: this.error,
80 response: this.response, 80 response: this.response,
81 server: window.ferdi.stores.settings.app.server, 81 server: window['ferdi'].stores.settings.app.server,
82 }); 82 });
83 } else { 83 } else {
84 window.ferdi.stores.app.authRequestFailed = false; 84 window['ferdi'].stores.app.authRequestFailed = false;
85 } 85 }
86 }); 86 });
87} 87}