-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: decouple shared code from main/renderer imports (#1587)
* chore: remove settings dependency in shared i18next config * chore: move settings out of shared folder * chore: separate setting defs from functions also include the visible providers const in setting defs * chore: move setting methods to polyfills * chore: add preferred language to setting defs * chore: set common i18next options first * chore: update comment
- Loading branch information
Showing
9 changed files
with
63 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 8 additions & 15 deletions
23
app/common/shared/settings.js → app/common/shared/setting-defs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,23 @@ | ||
import {settings} from '../renderer/polyfills'; | ||
// Definitions for all the persistent settings used in the app | ||
|
||
import {fallbackLng} from './i18next.config'; | ||
|
||
export const PREFERRED_LANGUAGE = 'PREFERRED_LANGUAGE'; | ||
export const SAVED_SESSIONS = 'SAVED_SESSIONS'; | ||
export const SET_SAVED_GESTURES = 'SET_SAVED_GESTURES'; | ||
export const SERVER_ARGS = 'SERVER_ARGS'; | ||
export const SESSION_SERVER_PARAMS = 'SESSION_SERVER_PARAMS'; | ||
export const SESSION_SERVER_TYPE = 'SESSION_SERVER_TYPE'; | ||
export const SAVED_FRAMEWORK = 'SAVED_FRAMEWORK'; | ||
export const VISIBLE_PROVIDERS = 'VISIBLE_PROVIDERS'; | ||
|
||
const DEFAULT_SETTINGS = { | ||
export const DEFAULT_SETTINGS = { | ||
[PREFERRED_LANGUAGE]: fallbackLng, | ||
[SAVED_SESSIONS]: [], | ||
[SET_SAVED_GESTURES]: [], | ||
[SERVER_ARGS]: null, | ||
[SESSION_SERVER_PARAMS]: null, | ||
[SESSION_SERVER_TYPE]: null, | ||
[SAVED_FRAMEWORK]: 'java', | ||
[VISIBLE_PROVIDERS]: null, | ||
}; | ||
|
||
export async function getSetting(setting) { | ||
if (await settings.has(setting)) { | ||
return await settings.get(setting); | ||
} | ||
return DEFAULT_SETTINGS[setting]; | ||
} | ||
|
||
export async function setSetting(setting, value) { | ||
await settings.set(setting, value); | ||
} | ||
|
||
export default settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters