2017-11-18 04:11:18 +01:00
|
|
|
// Package imports.
|
|
|
|
import { Map as ImmutableMap } from 'immutable';
|
|
|
|
|
|
|
|
// Our imports.
|
2022-05-15 17:30:40 +02:00
|
|
|
import { LOCAL_SETTING_CHANGE, LOCAL_SETTING_DELETE } from 'flavours/glitch/actions/local_settings';
|
2023-05-28 16:38:10 +02:00
|
|
|
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
2017-11-18 04:11:18 +01:00
|
|
|
|
|
|
|
const initialState = ImmutableMap({
|
|
|
|
stretch : true,
|
|
|
|
side_arm : 'none',
|
2018-07-11 22:49:07 +02:00
|
|
|
side_arm_reply_mode : 'keep',
|
2018-08-22 13:17:21 +02:00
|
|
|
show_reply_count : false,
|
2018-08-22 15:58:57 +02:00
|
|
|
always_show_spoilers_field: false,
|
2018-08-29 15:26:24 +02:00
|
|
|
confirm_missing_media_description: false,
|
2019-06-07 18:38:07 +02:00
|
|
|
confirm_boost_missing_media_description: false,
|
2018-11-27 18:25:51 +01:00
|
|
|
confirm_before_clearing_draft: true,
|
2020-01-07 18:11:50 +01:00
|
|
|
prepend_cw_re: true,
|
2018-09-28 20:58:03 +02:00
|
|
|
preselect_on_reply: true,
|
2018-10-30 14:46:48 +01:00
|
|
|
inline_preview_cards: true,
|
2019-05-01 20:22:44 +02:00
|
|
|
hicolor_privacy_icons: false,
|
2019-05-12 21:55:44 +02:00
|
|
|
show_content_type_choice: false,
|
2019-08-01 18:48:16 +02:00
|
|
|
tag_misleading_links: true,
|
2019-08-28 22:13:41 +02:00
|
|
|
rewrite_mentions: 'no',
|
2018-08-28 14:10:26 +02:00
|
|
|
content_warnings : ImmutableMap({
|
2022-07-24 11:10:49 +02:00
|
|
|
filter : null,
|
|
|
|
media_outside: false,
|
2022-07-24 20:01:30 +02:00
|
|
|
shared_state : false,
|
2018-08-28 14:10:26 +02:00
|
|
|
}),
|
2017-11-18 04:11:18 +01:00
|
|
|
collapsed : ImmutableMap({
|
|
|
|
enabled : true,
|
|
|
|
auto : ImmutableMap({
|
|
|
|
all : false,
|
|
|
|
notifications : true,
|
|
|
|
lengthy : true,
|
|
|
|
reblogs : false,
|
|
|
|
replies : false,
|
|
|
|
media : false,
|
2023-01-26 19:36:44 +01:00
|
|
|
height : 400,
|
2017-11-18 04:11:18 +01:00
|
|
|
}),
|
|
|
|
backgrounds : ImmutableMap({
|
|
|
|
user_backgrounds : false,
|
|
|
|
preview_images : false,
|
|
|
|
}),
|
2018-09-30 01:44:02 +02:00
|
|
|
show_action_bar : true,
|
2017-11-18 04:11:18 +01:00
|
|
|
}),
|
|
|
|
media : ImmutableMap({
|
2019-03-10 20:34:51 +01:00
|
|
|
letterbox : true,
|
|
|
|
fullwidth : true,
|
|
|
|
reveal_behind_cw : false,
|
2020-10-26 20:11:35 +01:00
|
|
|
pop_in_player : true,
|
2020-10-26 20:45:25 +01:00
|
|
|
pop_in_position : 'right',
|
2017-11-18 04:11:18 +01:00
|
|
|
}),
|
2018-09-06 20:55:11 +02:00
|
|
|
notifications : ImmutableMap({
|
|
|
|
favicon_badge : false,
|
|
|
|
tab_badge : true,
|
|
|
|
}),
|
2022-05-27 16:34:29 +02:00
|
|
|
status_icons : ImmutableMap({
|
|
|
|
language: true,
|
|
|
|
reply: true,
|
|
|
|
local_only: true,
|
|
|
|
media: true,
|
|
|
|
visibility: true,
|
|
|
|
}),
|
2017-11-18 04:11:18 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
const hydrate = (state, localSettings) => state.mergeDeep(localSettings);
|
|
|
|
|
|
|
|
export default function localSettings(state = initialState, action) {
|
|
|
|
switch(action.type) {
|
|
|
|
case STORE_HYDRATE:
|
|
|
|
return hydrate(state, action.state.get('local_settings'));
|
|
|
|
case LOCAL_SETTING_CHANGE:
|
|
|
|
return state.setIn(action.key, action.value);
|
2022-05-15 17:30:40 +02:00
|
|
|
case LOCAL_SETTING_DELETE:
|
|
|
|
return state.deleteIn(action.key);
|
2017-11-18 04:11:18 +01:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
2023-02-03 20:52:07 +01:00
|
|
|
}
|