2020-07-10 17:04:36 -04:00
|
|
|
import { Lbry, ACTIONS, SHARED_PREFERENCES, doWalletReconnect, SETTINGS, DAEMON_SETTINGS } from 'lbry-redux';
|
2020-06-12 16:44:25 -04:00
|
|
|
import { doToast } from 'redux/actions/notifications';
|
2019-11-08 15:51:42 -05:00
|
|
|
import * as LOCAL_ACTIONS from 'constants/action_types';
|
2018-02-16 01:16:50 -08:00
|
|
|
import analytics from 'analytics';
|
2019-11-05 13:54:58 -05:00
|
|
|
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
2019-11-18 10:30:15 -08:00
|
|
|
import { launcher } from 'util/autoLaunch';
|
|
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
2021-01-21 14:50:51 -05:00
|
|
|
import { doSyncLoop, doSyncUnsubscribe, doSetSyncLock } from 'redux/actions/sync';
|
2020-10-05 14:31:51 -04:00
|
|
|
import { doAlertWaitingForSync, doGetAndPopulatePreferences } from 'redux/actions/app';
|
|
|
|
import { selectPrefsReady } from 'redux/selectors/sync';
|
2020-11-11 12:56:31 -08:00
|
|
|
import { Lbryio } from 'lbryinc';
|
2021-01-06 13:13:56 -05:00
|
|
|
import { getDefaultLanguage } from 'util/default-languages';
|
2020-09-04 11:02:30 -04:00
|
|
|
|
2020-05-07 14:44:11 -04:00
|
|
|
const { DEFAULT_LANGUAGE } = require('config');
|
2020-07-10 17:04:36 -04:00
|
|
|
const { SDK_SYNC_KEYS } = SHARED_PREFERENCES;
|
2018-01-14 20:14:15 +11:00
|
|
|
|
2019-11-18 10:30:15 -08:00
|
|
|
export const IS_MAC = process.platform === 'darwin';
|
2019-08-18 13:54:55 -03:00
|
|
|
const UPDATE_IS_NIGHT_INTERVAL = 5 * 60 * 1000;
|
2017-12-26 17:13:05 -03:00
|
|
|
|
2017-05-17 17:52:45 -04:00
|
|
|
export function doFetchDaemonSettings() {
|
2017-12-27 20:48:11 -03:00
|
|
|
return dispatch => {
|
2017-12-21 14:32:51 -03:00
|
|
|
Lbry.settings_get().then(settings => {
|
2020-02-19 01:31:40 -05:00
|
|
|
analytics.toggleInternal(settings.share_usage_data);
|
2017-05-17 17:52:45 -04:00
|
|
|
dispatch({
|
2017-12-21 14:32:51 -03:00
|
|
|
type: ACTIONS.DAEMON_SETTINGS_RECEIVED,
|
2017-05-17 17:52:45 -04:00
|
|
|
data: {
|
2017-06-06 17:19:12 -04:00
|
|
|
settings,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
2017-05-17 17:52:45 -04:00
|
|
|
}
|
|
|
|
|
2020-03-24 13:57:17 -04:00
|
|
|
export function doFindFFmpeg() {
|
|
|
|
return dispatch => {
|
|
|
|
dispatch({
|
|
|
|
type: LOCAL_ACTIONS.FINDING_FFMPEG_STARTED,
|
|
|
|
});
|
|
|
|
return Lbry.ffmpeg_find().then(done => {
|
2020-03-26 12:28:48 -04:00
|
|
|
dispatch(doGetDaemonStatus());
|
2020-03-24 13:57:17 -04:00
|
|
|
dispatch({
|
|
|
|
type: LOCAL_ACTIONS.FINDING_FFMPEG_COMPLETED,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-12-12 15:18:13 -05:00
|
|
|
export function doGetDaemonStatus() {
|
|
|
|
return dispatch => {
|
|
|
|
return Lbry.status().then(status => {
|
|
|
|
dispatch({
|
|
|
|
type: ACTIONS.DAEMON_STATUS_RECEIVED,
|
|
|
|
data: {
|
|
|
|
status,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return status;
|
2020-02-19 01:31:40 -05:00
|
|
|
});
|
2019-12-12 15:18:13 -05:00
|
|
|
};
|
2020-02-19 01:31:40 -05:00
|
|
|
}
|
2019-12-12 15:18:13 -05:00
|
|
|
|
2019-12-11 15:09:27 -05:00
|
|
|
export function doClearDaemonSetting(key) {
|
2020-10-05 14:31:51 -04:00
|
|
|
return (dispatch, getState) => {
|
|
|
|
const state = getState();
|
|
|
|
const ready = selectPrefsReady(state);
|
|
|
|
|
|
|
|
if (!ready) {
|
|
|
|
return dispatch(doAlertWaitingForSync());
|
|
|
|
}
|
|
|
|
|
2019-12-11 15:09:27 -05:00
|
|
|
const clearKey = {
|
|
|
|
key,
|
|
|
|
};
|
2020-10-05 14:31:51 -04:00
|
|
|
// not if syncLocked
|
2019-12-11 15:09:27 -05:00
|
|
|
Lbry.settings_clear(clearKey).then(defaultSettings => {
|
2020-07-10 17:04:36 -04:00
|
|
|
if (SDK_SYNC_KEYS.includes(key)) {
|
2019-12-11 15:09:27 -05:00
|
|
|
dispatch({
|
|
|
|
type: ACTIONS.SHARED_PREFERENCE_SET,
|
2019-12-13 11:13:49 -05:00
|
|
|
data: { key: key, value: null },
|
2019-12-11 15:09:27 -05:00
|
|
|
});
|
|
|
|
}
|
2020-07-10 17:04:36 -04:00
|
|
|
if (key === DAEMON_SETTINGS.LBRYUM_SERVERS) {
|
2019-12-11 15:09:27 -05:00
|
|
|
dispatch(doWalletReconnect());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
Lbry.settings_get().then(settings => {
|
2020-02-19 01:31:40 -05:00
|
|
|
analytics.toggleInternal(settings.share_usage_data);
|
2019-12-11 15:09:27 -05:00
|
|
|
dispatch({
|
|
|
|
type: ACTIONS.DAEMON_SETTINGS_RECEIVED,
|
|
|
|
data: {
|
|
|
|
settings,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
2020-02-19 01:31:40 -05:00
|
|
|
// if doPopulate is applying settings, we don't want to cause a loop; doNotDispatch = true.
|
|
|
|
export function doSetDaemonSetting(key, value, doNotDispatch = false) {
|
2020-10-05 14:31:51 -04:00
|
|
|
return (dispatch, getState) => {
|
|
|
|
const state = getState();
|
|
|
|
const ready = selectPrefsReady(state);
|
|
|
|
|
|
|
|
if (!ready) {
|
|
|
|
return dispatch(doAlertWaitingForSync());
|
|
|
|
}
|
|
|
|
|
2019-02-12 12:26:50 -05:00
|
|
|
const newSettings = {
|
|
|
|
key,
|
|
|
|
value: !value && value !== false ? null : value,
|
|
|
|
};
|
2019-12-11 15:09:27 -05:00
|
|
|
Lbry.settings_set(newSettings).then(newSetting => {
|
2020-07-10 17:04:36 -04:00
|
|
|
if (SDK_SYNC_KEYS.includes(key) && !doNotDispatch) {
|
2019-12-11 15:09:27 -05:00
|
|
|
dispatch({
|
|
|
|
type: ACTIONS.SHARED_PREFERENCE_SET,
|
2020-02-19 01:31:40 -05:00
|
|
|
data: { key: key, value: newSetting[key] },
|
2019-12-11 15:09:27 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
// hardcoding this in lieu of a better solution
|
2020-07-10 17:04:36 -04:00
|
|
|
if (key === DAEMON_SETTINGS.LBRYUM_SERVERS) {
|
2019-12-11 15:09:27 -05:00
|
|
|
dispatch(doWalletReconnect());
|
2020-02-19 01:31:40 -05:00
|
|
|
// todo: add sdk reloadsettings() (or it happens automagically?)
|
2019-12-11 15:09:27 -05:00
|
|
|
}
|
|
|
|
});
|
2017-12-26 17:13:05 -03:00
|
|
|
Lbry.settings_get().then(settings => {
|
2020-02-19 01:31:40 -05:00
|
|
|
analytics.toggleInternal(settings.share_usage_data);
|
2017-05-17 17:52:45 -04:00
|
|
|
dispatch({
|
2017-12-21 14:32:51 -03:00
|
|
|
type: ACTIONS.DAEMON_SETTINGS_RECEIVED,
|
2017-05-17 17:52:45 -04:00
|
|
|
data: {
|
2017-12-26 17:13:05 -03:00
|
|
|
settings,
|
2017-06-06 17:19:12 -04:00
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
2017-06-05 21:21:55 -07:00
|
|
|
}
|
2017-06-28 14:12:01 +07:00
|
|
|
|
2019-12-12 15:18:13 -05:00
|
|
|
export function doSaveCustomWalletServers(servers) {
|
2019-12-11 15:09:27 -05:00
|
|
|
return {
|
2019-12-12 15:18:13 -05:00
|
|
|
type: ACTIONS.SAVE_CUSTOM_WALLET_SERVERS,
|
2019-12-11 15:09:27 -05:00
|
|
|
data: servers,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-09-04 11:02:30 -04:00
|
|
|
export function doSetClientSetting(key, value, pushPrefs) {
|
2020-10-05 14:31:51 -04:00
|
|
|
return (dispatch, getState) => {
|
|
|
|
const state = getState();
|
|
|
|
const ready = selectPrefsReady(state);
|
|
|
|
|
2020-11-10 15:26:00 -05:00
|
|
|
if (!ready && pushPrefs) {
|
2020-10-05 14:31:51 -04:00
|
|
|
return dispatch(doAlertWaitingForSync());
|
|
|
|
}
|
|
|
|
|
2020-02-19 01:31:40 -05:00
|
|
|
dispatch({
|
|
|
|
type: ACTIONS.CLIENT_SETTING_CHANGED,
|
|
|
|
data: {
|
|
|
|
key,
|
|
|
|
value,
|
|
|
|
},
|
|
|
|
});
|
2020-11-10 15:26:00 -05:00
|
|
|
|
2020-09-04 11:02:30 -04:00
|
|
|
if (pushPrefs) {
|
|
|
|
dispatch(doPushSettingsToPrefs());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-01-14 20:14:15 +11:00
|
|
|
export function doUpdateIsNight() {
|
|
|
|
return {
|
|
|
|
type: ACTIONS.UPDATE_IS_NIGHT,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-03-07 18:03:45 -05:00
|
|
|
export function doUpdateIsNightAsync() {
|
|
|
|
return dispatch => {
|
|
|
|
dispatch(doUpdateIsNight());
|
2019-02-12 12:26:50 -05:00
|
|
|
|
2019-03-04 23:46:57 -05:00
|
|
|
setInterval(() => dispatch(doUpdateIsNight()), UPDATE_IS_NIGHT_INTERVAL);
|
2018-03-07 18:03:45 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-08-18 13:54:55 -03:00
|
|
|
export function doSetDarkTime(value, options) {
|
|
|
|
const { fromTo, time } = options;
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
const state = getState();
|
2019-09-17 14:49:03 -04:00
|
|
|
const darkModeTimes = state.settings.clientSettings[SETTINGS.DARK_MODE_TIMES];
|
2019-08-18 13:54:55 -03:00
|
|
|
const { hour, min } = darkModeTimes[fromTo];
|
|
|
|
const newHour = time === 'hour' ? value : hour;
|
|
|
|
const newMin = time === 'min' ? value : min;
|
|
|
|
const modifiedTimes = {
|
|
|
|
[fromTo]: {
|
|
|
|
hour: newHour,
|
|
|
|
min: newMin,
|
|
|
|
formattedTime: newHour + ':' + newMin,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
const mergedTimes = { ...darkModeTimes, ...modifiedTimes };
|
|
|
|
|
2019-09-23 19:47:58 -04:00
|
|
|
dispatch(doSetClientSetting(SETTINGS.DARK_MODE_TIMES, mergedTimes));
|
2019-08-18 13:54:55 -03:00
|
|
|
dispatch(doUpdateIsNight());
|
|
|
|
};
|
|
|
|
}
|
2019-11-05 13:54:58 -05:00
|
|
|
|
2020-09-11 14:35:50 -04:00
|
|
|
export function doGetWalletSyncPreference() {
|
|
|
|
const SYNC_KEY = 'enable-sync';
|
|
|
|
return dispatch => {
|
|
|
|
return Lbry.preference_get({ key: SYNC_KEY }).then(result => {
|
|
|
|
const enabled = result && result[SYNC_KEY];
|
|
|
|
if (enabled !== null) {
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.ENABLE_SYNC, enabled));
|
|
|
|
}
|
|
|
|
return enabled;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function doSetWalletSyncPreference(pref) {
|
|
|
|
const SYNC_KEY = 'enable-sync';
|
|
|
|
return dispatch => {
|
|
|
|
return Lbry.preference_set({ key: SYNC_KEY, value: pref }).then(result => {
|
|
|
|
const enabled = result && result[SYNC_KEY];
|
|
|
|
if (enabled !== null) {
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.ENABLE_SYNC, enabled));
|
|
|
|
}
|
|
|
|
return enabled;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-09-04 11:02:30 -04:00
|
|
|
export function doPushSettingsToPrefs() {
|
|
|
|
return dispatch => {
|
|
|
|
return new Promise((resolve, reject) => {
|
2020-07-28 22:52:44 -04:00
|
|
|
dispatch({
|
|
|
|
type: LOCAL_ACTIONS.SYNC_CLIENT_SETTINGS,
|
|
|
|
});
|
2020-09-04 11:02:30 -04:00
|
|
|
resolve();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function doEnterSettingsPage() {
|
|
|
|
return async (dispatch, getState) => {
|
|
|
|
const state = getState();
|
|
|
|
const syncEnabled = makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state);
|
|
|
|
const hasVerifiedEmail = state.user && state.user.user && state.user.user.has_verified_email;
|
2020-09-11 14:35:50 -04:00
|
|
|
if (IS_WEB && !hasVerifiedEmail) {
|
|
|
|
return;
|
|
|
|
}
|
2020-09-04 11:02:30 -04:00
|
|
|
dispatch(doSyncUnsubscribe());
|
|
|
|
if (syncEnabled && hasVerifiedEmail) {
|
2021-01-21 14:50:51 -05:00
|
|
|
await dispatch(doSyncLoop(true));
|
2020-09-04 11:02:30 -04:00
|
|
|
} else {
|
|
|
|
await dispatch(doGetAndPopulatePreferences());
|
2020-07-28 22:52:44 -04:00
|
|
|
}
|
2020-09-04 11:02:30 -04:00
|
|
|
dispatch(doSetSyncLock(true));
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function doExitSettingsPage() {
|
|
|
|
return (dispatch, getState) => {
|
2020-09-11 14:35:50 -04:00
|
|
|
const state = getState();
|
|
|
|
const hasVerifiedEmail = state.user && state.user.user && state.user.user.has_verified_email;
|
|
|
|
if (IS_WEB && !hasVerifiedEmail) {
|
|
|
|
return;
|
|
|
|
}
|
2020-09-04 11:02:30 -04:00
|
|
|
dispatch(doSetSyncLock(false));
|
|
|
|
dispatch(doPushSettingsToPrefs());
|
2021-01-21 14:50:51 -05:00
|
|
|
// syncLoop is restarted in store.js sharedStateCB if necessary
|
2020-07-10 17:04:36 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-05-07 14:44:11 -04:00
|
|
|
export function doFetchLanguage(language) {
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
const { settings } = getState();
|
|
|
|
|
|
|
|
if (settings.language !== language || (settings.loadedLanguages && !settings.loadedLanguages.includes(language))) {
|
|
|
|
// this should match the behavior/logic in index-web.html
|
|
|
|
fetch('https://lbry.com/i18n/get/lbry-desktop/app-strings/' + language + '.json')
|
|
|
|
.then(r => r.json())
|
|
|
|
.then(j => {
|
|
|
|
window.i18n_messages[language] = j;
|
|
|
|
dispatch({
|
|
|
|
type: LOCAL_ACTIONS.DOWNLOAD_LANGUAGE_SUCCESS,
|
|
|
|
data: {
|
|
|
|
language,
|
|
|
|
},
|
|
|
|
});
|
2020-06-18 11:41:37 -04:00
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
dispatch({
|
|
|
|
type: LOCAL_ACTIONS.DOWNLOAD_LANGUAGE_FAILURE,
|
|
|
|
});
|
2020-05-07 14:44:11 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-11-20 08:21:31 -05:00
|
|
|
export function doSetHomepage(code) {
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
let languageCode;
|
2021-01-06 13:13:56 -05:00
|
|
|
if (code === getDefaultLanguage()) {
|
2020-11-20 08:21:31 -05:00
|
|
|
languageCode = null;
|
|
|
|
} else {
|
|
|
|
languageCode = code;
|
|
|
|
}
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.HOMEPAGE, languageCode));
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-11-05 13:54:58 -05:00
|
|
|
export function doSetLanguage(language) {
|
2019-11-12 17:25:44 -05:00
|
|
|
return (dispatch, getState) => {
|
|
|
|
const { settings } = getState();
|
2020-11-11 12:56:31 -08:00
|
|
|
const { daemonSettings } = settings;
|
|
|
|
const { share_usage_data: shareSetting } = daemonSettings;
|
|
|
|
const isSharingData = shareSetting || IS_WEB;
|
2020-11-20 08:21:31 -05:00
|
|
|
let languageSetting;
|
2021-01-06 13:13:56 -05:00
|
|
|
if (language === getDefaultLanguage()) {
|
2020-11-20 08:21:31 -05:00
|
|
|
languageSetting = null;
|
|
|
|
} else {
|
|
|
|
languageSetting = language;
|
|
|
|
}
|
2020-11-11 12:56:31 -08:00
|
|
|
|
2020-11-20 08:21:31 -05:00
|
|
|
if (
|
|
|
|
settings.language !== languageSetting ||
|
|
|
|
(settings.loadedLanguages && !settings.loadedLanguages.includes(language))
|
|
|
|
) {
|
2019-11-12 17:25:44 -05:00
|
|
|
// this should match the behavior/logic in index-web.html
|
|
|
|
fetch('https://lbry.com/i18n/get/lbry-desktop/app-strings/' + language + '.json')
|
|
|
|
.then(r => r.json())
|
|
|
|
.then(j => {
|
|
|
|
window.i18n_messages[language] = j;
|
|
|
|
dispatch({
|
|
|
|
type: LOCAL_ACTIONS.DOWNLOAD_LANGUAGE_SUCCESS,
|
|
|
|
data: {
|
|
|
|
language,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
// set on localStorage so it can be read outside of redux
|
|
|
|
window.localStorage.setItem(SETTINGS.LANGUAGE, language);
|
2020-11-20 08:21:31 -05:00
|
|
|
dispatch(doSetClientSetting(SETTINGS.LANGUAGE, languageSetting));
|
2020-11-11 12:56:31 -08:00
|
|
|
if (isSharingData) {
|
|
|
|
Lbryio.call('user', 'language', {
|
|
|
|
language: language,
|
|
|
|
});
|
|
|
|
}
|
2019-11-12 17:25:44 -05:00
|
|
|
})
|
|
|
|
.catch(e => {
|
2020-05-07 14:44:11 -04:00
|
|
|
window.localStorage.setItem(SETTINGS.LANGUAGE, DEFAULT_LANGUAGE);
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.LANGUAGE, DEFAULT_LANGUAGE));
|
2019-11-12 17:25:44 -05:00
|
|
|
const languageName = SUPPORTED_LANGUAGES[language] ? SUPPORTED_LANGUAGES[language] : language;
|
|
|
|
dispatch(
|
|
|
|
doToast({
|
|
|
|
message: __('Failed to load %language% translations.', { language: languageName }),
|
2019-11-13 18:54:41 -05:00
|
|
|
isError: true,
|
2019-11-12 17:25:44 -05:00
|
|
|
})
|
|
|
|
);
|
2019-11-08 15:51:42 -05:00
|
|
|
});
|
2019-11-12 17:25:44 -05:00
|
|
|
}
|
2019-11-05 13:54:58 -05:00
|
|
|
};
|
|
|
|
}
|
2019-11-18 10:30:15 -08:00
|
|
|
|
|
|
|
export function doSetAutoLaunch(value) {
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
const state = getState();
|
|
|
|
const autoLaunch = makeSelectClientSetting(SETTINGS.AUTO_LAUNCH)(state);
|
|
|
|
|
2019-11-27 20:55:29 -05:00
|
|
|
if (IS_MAC || process.env.NODE_ENV !== 'production') {
|
2019-11-18 10:30:15 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value === undefined) {
|
|
|
|
launcher.isEnabled().then(isEnabled => {
|
|
|
|
if (isEnabled) {
|
|
|
|
if (!autoLaunch) {
|
|
|
|
launcher.disable().then(() => {
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.AUTO_LAUNCH, false));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (autoLaunch || autoLaunch === null || autoLaunch === undefined) {
|
|
|
|
launcher.enable().then(() => {
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.AUTO_LAUNCH, true));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (value === true) {
|
|
|
|
launcher.isEnabled().then(function(isEnabled) {
|
|
|
|
if (!isEnabled) {
|
|
|
|
launcher.enable().then(() => {
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.AUTO_LAUNCH, true));
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.AUTO_LAUNCH, true));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// value = false
|
|
|
|
launcher.isEnabled().then(function(isEnabled) {
|
|
|
|
if (isEnabled) {
|
|
|
|
launcher.disable().then(() => {
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.AUTO_LAUNCH, false));
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.AUTO_LAUNCH, false));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2020-08-13 13:57:00 -03:00
|
|
|
|
|
|
|
export function doSetAppToTrayWhenClosed(value) {
|
|
|
|
return dispatch => {
|
|
|
|
window.localStorage.setItem(SETTINGS.TO_TRAY_WHEN_CLOSED, value);
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.TO_TRAY_WHEN_CLOSED, value));
|
|
|
|
};
|
|
|
|
}
|
2021-01-08 10:21:27 -05:00
|
|
|
|
|
|
|
export function toggleVideoTheaterMode() {
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
const state = getState();
|
|
|
|
const videoTheaterMode = makeSelectClientSetting(SETTINGS.VIDEO_THEATER_MODE)(state);
|
|
|
|
|
|
|
|
dispatch(doSetClientSetting(SETTINGS.VIDEO_THEATER_MODE, !videoTheaterMode));
|
|
|
|
};
|
|
|
|
}
|