mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +03:00
Improve Settings handling
This commit is contained in:
parent
e7b1ce7509
commit
34b25eedea
39 changed files with 160 additions and 150 deletions
|
|
@ -1,13 +1,14 @@
|
|||
import ko from 'ko';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
export const AppAdminStore = {
|
||||
weakPassword: ko.observable(false),
|
||||
dataFolderAccess: ko.observable(false),
|
||||
|
||||
populate: function() {
|
||||
this.weakPassword(!!rl.settings.get('WeakPassword'));
|
||||
this.weakPassword(!!SettingsGet('WeakPassword'));
|
||||
/*
|
||||
rl.settings.get('WeakPassword')
|
||||
SettingsGet('WeakPassword')
|
||||
&& fetch('./data/VERSION?' + Math.random()).then(() => this.dataFolderAccess(true));
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import ko from 'ko';
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { Settings } from 'Common/Globals';
|
||||
|
||||
export const CapaAdminStore = {
|
||||
populate: function() {
|
||||
let capa = rl.settings.capa;
|
||||
const capa = Settings.capa;
|
||||
this.additionalAccounts(capa(Capa.AdditionalAccounts));
|
||||
this.identities(capa(Capa.Identities));
|
||||
this.attachmentThumbnails(capa(Capa.AttachmentThumbnails));
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
import ko from 'ko';
|
||||
import { Settings, SettingsGet } from 'Common/Globals';
|
||||
|
||||
export const LanguageStore = {
|
||||
languages: ko.observableArray(),
|
||||
userLanguage: ko.observable(''),
|
||||
|
||||
populate: function() {
|
||||
const Settings = rl.settings,
|
||||
aLanguages = Settings.app('languages');
|
||||
const aLanguages = Settings.app('languages');
|
||||
this.languages(Array.isArray(aLanguages) ? aLanguages : []);
|
||||
this.language(Settings.get('Language'));
|
||||
this.userLanguage(Settings.get('UserLanguage'));
|
||||
this.language(SettingsGet('Language'));
|
||||
this.userLanguage(SettingsGet('UserLanguage'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { $htmlCL, leftPanelDisabled } from 'Common/Globals';
|
||||
import { $htmlCL, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
|
||||
|
||||
export const ThemeStore = {
|
||||
themes: ko.observableArray(),
|
||||
|
|
@ -8,14 +8,13 @@ export const ThemeStore = {
|
|||
isMobile: ko.observable($htmlCL.contains('rl-mobile')),
|
||||
|
||||
populate: function(){
|
||||
const Settings = rl.settings,
|
||||
themes = Settings.app('themes');
|
||||
const themes = Settings.app('themes');
|
||||
|
||||
this.themes(Array.isArray(themes) ? themes : []);
|
||||
this.theme(Settings.get('Theme'));
|
||||
this.theme(SettingsGet('Theme'));
|
||||
if (!this.isMobile()) {
|
||||
this.userBackgroundName(Settings.get('UserBackgroundName'));
|
||||
this.userBackgroundHash(Settings.get('UserBackgroundHash'));
|
||||
this.userBackgroundName(SettingsGet('UserBackgroundName'));
|
||||
this.userBackgroundHash(SettingsGet('UserBackgroundHash'));
|
||||
}
|
||||
|
||||
leftPanelDisabled(this.isMobile());
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
class AccountUserStore {
|
||||
constructor() {
|
||||
|
|
@ -27,8 +28,8 @@ class AccountUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.email(rl.settings.get('Email'));
|
||||
this.parentEmail(rl.settings.get('ParentEmail'));
|
||||
this.email(SettingsGet('Email'));
|
||||
this.parentEmail(SettingsGet('ParentEmail'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import ko from 'ko';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { Focused } from 'Common/EnumsUser';
|
||||
import { keyScope, leftPanelDisabled, Settings } from 'Common/Globals';
|
||||
import { keyScope, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
class AppUserStore {
|
||||
|
|
@ -48,18 +48,18 @@ class AppUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.projectHash(Settings.get('ProjectHash'));
|
||||
this.projectHash(SettingsGet('ProjectHash'));
|
||||
|
||||
this.contactsAutosave(!!Settings.get('ContactsAutosave'));
|
||||
this.useLocalProxyForExternalImages(!!Settings.get('UseLocalProxyForExternalImages'));
|
||||
this.contactsAutosave(!!SettingsGet('ContactsAutosave'));
|
||||
this.useLocalProxyForExternalImages(!!SettingsGet('UseLocalProxyForExternalImages'));
|
||||
|
||||
this.contactsIsAllowed(!!Settings.get('ContactsIsAllowed'));
|
||||
this.contactsIsAllowed(!!SettingsGet('ContactsIsAllowed'));
|
||||
|
||||
const attachmentsActions = Settings.app('attachmentsActions');
|
||||
this.attachmentsActions(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []);
|
||||
|
||||
this.devEmail = Settings.get('DevEmail');
|
||||
this.devPassword = Settings.get('DevPassword');
|
||||
this.devEmail = SettingsGet('DevEmail');
|
||||
this.devPassword = SettingsGet('DevPassword');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
class ContactUserStore {
|
||||
constructor() {
|
||||
|
|
@ -19,13 +20,12 @@ class ContactUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
const settingsGet = rl.settings.get;
|
||||
this.allowContactsSync(!!settingsGet('ContactsSyncIsAllowed'));
|
||||
this.enableContactsSync(!!settingsGet('EnableContactsSync'));
|
||||
this.allowContactsSync(!!SettingsGet('ContactsSyncIsAllowed'));
|
||||
this.enableContactsSync(!!SettingsGet('EnableContactsSync'));
|
||||
|
||||
this.contactsSyncUrl(settingsGet('ContactsSyncUrl'));
|
||||
this.contactsSyncUser(settingsGet('ContactsSyncUser'));
|
||||
this.contactsSyncPass(settingsGet('ContactsSyncPassword'));
|
||||
this.contactsSyncUrl(SettingsGet('ContactsSyncUrl'));
|
||||
this.contactsSyncUser(SettingsGet('ContactsSyncUser'));
|
||||
this.contactsSyncPass(SettingsGet('ContactsSyncPassword'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { FolderType } from 'Common/EnumsUser';
|
|||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
import { folderListOptionsBuilder } from 'Common/UtilsUser';
|
||||
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
class FolderUserStore {
|
||||
constructor() {
|
||||
|
|
@ -40,7 +41,7 @@ class FolderUserStore {
|
|||
|
||||
this.currentFolder = ko.observable(null).extend({ toggleSubscribeProperty: [this, 'selected'] });
|
||||
|
||||
this.sieveAllowFileintoInbox = !!rl.settings.get('SieveAllowFileintoInbox');
|
||||
this.sieveAllowFileintoInbox = !!SettingsGet('SieveAllowFileintoInbox');
|
||||
|
||||
this.draftFolderNotEnabled = ko.computed(
|
||||
() => !this.draftFolder() || UNUSED_OPTION_VALUE === this.draftFolder()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import Audio from 'Common/Audio';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import * as Links from 'Common/Links';
|
||||
|
||||
/**
|
||||
|
|
@ -102,8 +103,8 @@ class NotificationUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.enableSoundNotification(!!rl.settings.get('SoundNotification'));
|
||||
this.enableDesktopNotification(!!rl.settings.get('DesktopNotifications'));
|
||||
this.enableSoundNotification(!!SettingsGet('SoundNotification'));
|
||||
this.enableDesktopNotification(!!SettingsGet('DesktopNotifications'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import ko from 'ko';
|
|||
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
||||
import { Layout, EditorDefaultType } from 'Common/EnumsUser';
|
||||
import { pInt } from 'Common/Utils';
|
||||
import { $htmlCL, Settings } from 'Common/Globals';
|
||||
import { $htmlCL, SettingsGet } from 'Common/Globals';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
class SettingsUserStore {
|
||||
|
|
@ -41,7 +41,7 @@ class SettingsUserStore {
|
|||
let iAutoLogoutTimer;
|
||||
this.delayLogout = (() => {
|
||||
clearTimeout(iAutoLogoutTimer);
|
||||
if (0 < this.autoLogout() && !Settings.get('AccountSignMe')) {
|
||||
if (0 < this.autoLogout() && !SettingsGet('AccountSignMe')) {
|
||||
iAutoLogoutTimer = setTimeout(
|
||||
rl.app.logout,
|
||||
this.autoLogout() * 60000
|
||||
|
|
@ -60,19 +60,18 @@ class SettingsUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
const settingsGet = Settings.get;
|
||||
this.layout(pInt(settingsGet('Layout')));
|
||||
this.editorDefaultType(settingsGet('EditorDefaultType'));
|
||||
this.layout(pInt(SettingsGet('Layout')));
|
||||
this.editorDefaultType(SettingsGet('EditorDefaultType'));
|
||||
|
||||
this.autoLogout(pInt(settingsGet('AutoLogout')));
|
||||
this.messagesPerPage(settingsGet('MPP'));
|
||||
this.autoLogout(pInt(SettingsGet('AutoLogout')));
|
||||
this.messagesPerPage(SettingsGet('MPP'));
|
||||
|
||||
this.showImages(!!settingsGet('ShowImages'));
|
||||
this.removeColors(!!settingsGet('RemoveColors'));
|
||||
this.useCheckboxesInList(!!(ThemeStore.isMobile() || settingsGet('UseCheckboxesInList')));
|
||||
this.allowDraftAutosave(!!settingsGet('AllowDraftAutosave'));
|
||||
this.useThreads(!!settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!settingsGet('ReplySameFolder'));
|
||||
this.showImages(!!SettingsGet('ShowImages'));
|
||||
this.removeColors(!!SettingsGet('RemoveColors'));
|
||||
this.useCheckboxesInList(!!(ThemeStore.isMobile() || SettingsGet('UseCheckboxesInList')));
|
||||
this.allowDraftAutosave(!!SettingsGet('AllowDraftAutosave'));
|
||||
this.useThreads(!!SettingsGet('UseThreads'));
|
||||
this.replySameFolder(!!SettingsGet('ReplySameFolder'));
|
||||
|
||||
this.delayLogout();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue