diff options
author | 2021-05-26 21:05:50 +0530 | |
---|---|---|
committer | 2021-05-26 21:05:50 +0530 | |
commit | 296ce5ce62bcde6888df291f97105fa912ed7d35 (patch) | |
tree | b28e7d2373f1020c1183469aa3a9feafecede569 /src/stores | |
parent | Added new entry in context menu: 'Download image' (#1449) (diff) | |
download | ferdium-app-296ce5ce62bcde6888df291f97105fa912ed7d35.tar.gz ferdium-app-296ce5ce62bcde6888df291f97105fa912ed7d35.tar.zst ferdium-app-296ce5ce62bcde6888df291f97105fa912ed7d35.zip |
Replace 'remote' with 'electron/remote' (#1448)
* Locked new version of 'recipes' submodule with corresponding changes.
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/AppStore.js | 18 | ||||
-rw-r--r-- | src/stores/PaymentStore.js | 8 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 5 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 9 | ||||
-rw-r--r-- | src/stores/UIStore.js | 4 | ||||
-rw-r--r-- | src/stores/UserStore.js | 4 |
6 files changed, 19 insertions, 29 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index c409b6ac7..4af802460 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -1,7 +1,8 @@ | |||
1 | import { remote, ipcRenderer, shell } from 'electron'; | 1 | import { ipcRenderer, shell } from 'electron'; |
2 | import { | 2 | import { |
3 | action, computed, observable, | 3 | app, screen, powerMonitor, nativeTheme, getCurrentWindow, process as remoteProcess, |
4 | } from 'mobx'; | 4 | } from '@electron/remote'; |
5 | import { action, computed, observable } from 'mobx'; | ||
5 | import moment from 'moment'; | 6 | import moment from 'moment'; |
6 | import AutoLaunch from 'auto-launch'; | 7 | import AutoLaunch from 'auto-launch'; |
7 | import ms from 'ms'; | 8 | import ms from 'ms'; |
@@ -24,18 +25,11 @@ import { sleep } from '../helpers/async-helpers'; | |||
24 | 25 | ||
25 | const debug = require('debug')('Ferdi:AppStore'); | 26 | const debug = require('debug')('Ferdi:AppStore'); |
26 | 27 | ||
27 | const { | 28 | const mainWindow = getCurrentWindow(); |
28 | app, | ||
29 | screen, | ||
30 | powerMonitor, | ||
31 | nativeTheme, | ||
32 | } = remote; | ||
33 | |||
34 | const mainWindow = remote.getCurrentWindow(); | ||
35 | 29 | ||
36 | const defaultLocale = DEFAULT_APP_SETTINGS.locale; | 30 | const defaultLocale = DEFAULT_APP_SETTINGS.locale; |
37 | 31 | ||
38 | const executablePath = isMac ? remote.process.execPath : process.execPath; | 32 | const executablePath = isMac ? remoteProcess.execPath : process.execPath; |
39 | const autoLauncher = new AutoLaunch({ | 33 | const autoLauncher = new AutoLaunch({ |
40 | name: 'Ferdi', | 34 | name: 'Ferdi', |
41 | path: executablePath, | 35 | path: executablePath, |
diff --git a/src/stores/PaymentStore.js b/src/stores/PaymentStore.js index 69e6eb9c3..05bb5b3d0 100644 --- a/src/stores/PaymentStore.js +++ b/src/stores/PaymentStore.js | |||
@@ -1,12 +1,10 @@ | |||
1 | import { action, observable, computed } from 'mobx'; | 1 | import { action, observable, computed } from 'mobx'; |
2 | import { remote } from 'electron'; | 2 | import { BrowserWindow, getCurrentWindow } from '@electron/remote'; |
3 | 3 | ||
4 | import Store from './lib/Store'; | 4 | import Store from './lib/Store'; |
5 | import CachedRequest from './lib/CachedRequest'; | 5 | import CachedRequest from './lib/CachedRequest'; |
6 | import Request from './lib/Request'; | 6 | import Request from './lib/Request'; |
7 | 7 | ||
8 | const { BrowserWindow } = remote; | ||
9 | |||
10 | export default class PaymentStore extends Store { | 8 | export default class PaymentStore extends Store { |
11 | @observable plansRequest = new CachedRequest(this.api.payment, 'plans'); | 9 | @observable plansRequest = new CachedRequest(this.api.payment, 'plans'); |
12 | 10 | ||
@@ -43,7 +41,7 @@ export default class PaymentStore extends Store { | |||
43 | hostedPageURL = this.stores.user.getAuthURL(`${parsedUrl.origin}${parsedUrl.pathname}?${params.toString()}`); | 41 | hostedPageURL = this.stores.user.getAuthURL(`${parsedUrl.origin}${parsedUrl.pathname}?${params.toString()}`); |
44 | 42 | ||
45 | const win = new BrowserWindow({ | 43 | const win = new BrowserWindow({ |
46 | parent: remote.getCurrentWindow(), | 44 | parent: getCurrentWindow(), |
47 | modal: true, | 45 | modal: true, |
48 | title: '🔒 Upgrade Your Franz Account', | 46 | title: '🔒 Upgrade Your Franz Account', |
49 | width: 800, | 47 | width: 800, |
@@ -54,6 +52,8 @@ export default class PaymentStore extends Store { | |||
54 | webPreferences: { | 52 | webPreferences: { |
55 | nodeIntegration: true, | 53 | nodeIntegration: true, |
56 | webviewTag: true, | 54 | webviewTag: true, |
55 | enableRemoteModule: true, | ||
56 | contextIsolation: false, | ||
57 | }, | 57 | }, |
58 | }); | 58 | }); |
59 | win.loadURL(`file://${__dirname}/../index.html#/payment/${encodeURIComponent(hostedPageURL)}`); | 59 | win.loadURL(`file://${__dirname}/../index.html#/payment/${encodeURIComponent(hostedPageURL)}`); |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index afb370341..dc2cb0dbd 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -1,4 +1,4 @@ | |||
1 | import { shell, remote } from 'electron'; | 1 | import { shell } from 'electron'; |
2 | import { | 2 | import { |
3 | action, | 3 | action, |
4 | reaction, | 4 | reaction, |
@@ -7,6 +7,7 @@ import { | |||
7 | } from 'mobx'; | 7 | } from 'mobx'; |
8 | import { debounce, remove } from 'lodash'; | 8 | import { debounce, remove } from 'lodash'; |
9 | import ms from 'ms'; | 9 | import ms from 'ms'; |
10 | import { app } from '@electron/remote'; | ||
10 | import fs from 'fs-extra'; | 11 | import fs from 'fs-extra'; |
11 | import path from 'path'; | 12 | import path from 'path'; |
12 | 13 | ||
@@ -25,8 +26,6 @@ import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | |||
25 | 26 | ||
26 | const debug = require('debug')('Ferdi:ServiceStore'); | 27 | const debug = require('debug')('Ferdi:ServiceStore'); |
27 | 28 | ||
28 | const { app } = remote; | ||
29 | |||
30 | export default class ServicesStore extends Store { | 29 | export default class ServicesStore extends Store { |
31 | @observable allServicesRequest = new CachedRequest(this.api.services, 'all'); | 30 | @observable allServicesRequest = new CachedRequest(this.api.services, 'all'); |
32 | 31 | ||
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index ced286052..15b0db120 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -1,4 +1,5 @@ | |||
1 | import { ipcRenderer, remote } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import { getCurrentWindow } from '@electron/remote'; | ||
2 | import { | 3 | import { |
3 | action, computed, observable, reaction, | 4 | action, computed, observable, reaction, |
4 | } from 'mobx'; | 5 | } from 'mobx'; |
@@ -41,7 +42,7 @@ export default class SettingsStore extends Store { | |||
41 | reaction( | 42 | reaction( |
42 | () => this.all.app.autohideMenuBar, | 43 | () => this.all.app.autohideMenuBar, |
43 | () => { | 44 | () => { |
44 | const currentWindow = remote.getCurrentWindow(); | 45 | const currentWindow = getCurrentWindow(); |
45 | currentWindow.setMenuBarVisibility(!this.all.app.autohideMenuBar); | 46 | currentWindow.setMenuBarVisibility(!this.all.app.autohideMenuBar); |
46 | currentWindow.autoHideMenuBar = this.all.app.autohideMenuBar; | 47 | currentWindow.autoHideMenuBar = this.all.app.autohideMenuBar; |
47 | }, | 48 | }, |
@@ -61,7 +62,7 @@ export default class SettingsStore extends Store { | |||
61 | 62 | ||
62 | // Inactivity lock timer | 63 | // Inactivity lock timer |
63 | let inactivityTimer; | 64 | let inactivityTimer; |
64 | remote.getCurrentWindow().on('blur', () => { | 65 | getCurrentWindow().on('blur', () => { |
65 | if (this.all.app.inactivityLock !== 0) { | 66 | if (this.all.app.inactivityLock !== 0) { |
66 | inactivityTimer = setTimeout(() => { | 67 | inactivityTimer = setTimeout(() => { |
67 | this.actions.settings.update({ | 68 | this.actions.settings.update({ |
@@ -73,7 +74,7 @@ export default class SettingsStore extends Store { | |||
73 | }, this.all.app.inactivityLock * 1000 * 60); | 74 | }, this.all.app.inactivityLock * 1000 * 60); |
74 | } | 75 | } |
75 | }); | 76 | }); |
76 | remote.getCurrentWindow().on('focus', () => { | 77 | getCurrentWindow().on('focus', () => { |
77 | if (inactivityTimer) { | 78 | if (inactivityTimer) { |
78 | clearTimeout(inactivityTimer); | 79 | clearTimeout(inactivityTimer); |
79 | } | 80 | } |
diff --git a/src/stores/UIStore.js b/src/stores/UIStore.js index 05e3f71fe..0ca61046a 100644 --- a/src/stores/UIStore.js +++ b/src/stores/UIStore.js | |||
@@ -2,13 +2,11 @@ import { | |||
2 | action, observable, computed, reaction, | 2 | action, observable, computed, reaction, |
3 | } from 'mobx'; | 3 | } from 'mobx'; |
4 | import { theme } from '@meetfranz/theme'; | 4 | import { theme } from '@meetfranz/theme'; |
5 | import { remote } from 'electron'; | 5 | import { nativeTheme, systemPreferences } from '@electron/remote'; |
6 | 6 | ||
7 | import Store from './lib/Store'; | 7 | import Store from './lib/Store'; |
8 | import { isMac, isWindows } from '../environment'; | 8 | import { isMac, isWindows } from '../environment'; |
9 | 9 | ||
10 | const { nativeTheme, systemPreferences } = remote; | ||
11 | |||
12 | export default class UIStore extends Store { | 10 | export default class UIStore extends Store { |
13 | @observable showServicesUpdatedInfoBar = false; | 11 | @observable showServicesUpdatedInfoBar = false; |
14 | 12 | ||
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js index 7b4d39524..2cb6affa8 100644 --- a/src/stores/UserStore.js +++ b/src/stores/UserStore.js | |||
@@ -3,7 +3,7 @@ import moment from 'moment'; | |||
3 | import jwt from 'jsonwebtoken'; | 3 | import jwt from 'jsonwebtoken'; |
4 | import localStorage from 'mobx-localstorage'; | 4 | import localStorage from 'mobx-localstorage'; |
5 | import ms from 'ms'; | 5 | import ms from 'ms'; |
6 | import { remote } from 'electron'; | 6 | import { session } from '@electron/remote'; |
7 | 7 | ||
8 | import { isDevMode } from '../environment'; | 8 | import { isDevMode } from '../environment'; |
9 | import Store from './lib/Store'; | 9 | import Store from './lib/Store'; |
@@ -14,8 +14,6 @@ import { getPlan } from '../helpers/plan-helpers'; | |||
14 | import { PLANS } from '../config'; | 14 | import { PLANS } from '../config'; |
15 | import { TODOS_PARTITION_ID } from '../features/todos'; | 15 | import { TODOS_PARTITION_ID } from '../features/todos'; |
16 | 16 | ||
17 | const { session } = remote; | ||
18 | |||
19 | const debug = require('debug')('Ferdi:UserStore'); | 17 | const debug = require('debug')('Ferdi:UserStore'); |
20 | 18 | ||
21 | // TODO: split stores into UserStore and AuthStore | 19 | // TODO: split stores into UserStore and AuthStore |