2017-11-17 22:11:18 -05:00
|
|
|
// Package imports.
|
|
|
|
import { Map as ImmutableMap } from 'immutable';
|
|
|
|
|
|
|
|
// Our imports.
|
2017-12-04 02:26:40 -05:00
|
|
|
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
|
|
|
import { LOCAL_SETTING_CHANGE } from 'flavours/glitch/actions/local_settings';
|
2017-11-17 22:11:18 -05:00
|
|
|
|
|
|
|
const initialState = ImmutableMap({
|
|
|
|
layout : 'auto',
|
|
|
|
stretch : true,
|
|
|
|
navbar_under : false,
|
2019-01-04 12:53:27 -05:00
|
|
|
swipe_to_change_columns: true,
|
2017-11-17 22:11:18 -05:00
|
|
|
side_arm : 'none',
|
2018-07-11 16:49:07 -04:00
|
|
|
side_arm_reply_mode : 'keep',
|
2018-08-22 07:17:21 -04:00
|
|
|
show_reply_count : false,
|
2018-08-22 09:58:57 -04:00
|
|
|
always_show_spoilers_field: false,
|
2018-08-29 09:26:24 -04:00
|
|
|
confirm_missing_media_description: false,
|
2019-06-07 12:38:07 -04:00
|
|
|
confirm_boost_missing_media_description: false,
|
2018-11-27 12:25:51 -05:00
|
|
|
confirm_before_clearing_draft: true,
|
2020-01-07 12:11:50 -05:00
|
|
|
prepend_cw_re: true,
|
2018-09-28 14:58:03 -04:00
|
|
|
preselect_on_reply: true,
|
2018-10-30 09:46:48 -04:00
|
|
|
inline_preview_cards: true,
|
2019-05-01 14:22:44 -04:00
|
|
|
hicolor_privacy_icons: false,
|
2019-05-12 15:55:44 -04:00
|
|
|
show_content_type_choice: false,
|
2019-07-12 12:27:43 -04:00
|
|
|
filtering_behavior: 'hide',
|
2019-08-01 12:48:16 -04:00
|
|
|
tag_misleading_links: true,
|
2019-08-28 16:13:41 -04:00
|
|
|
rewrite_mentions: 'no',
|
2018-08-28 08:10:26 -04:00
|
|
|
content_warnings : ImmutableMap({
|
|
|
|
auto_unfold : false,
|
2018-08-28 11:16:30 -04:00
|
|
|
filter : null,
|
2018-08-28 08:10:26 -04:00
|
|
|
}),
|
2017-11-17 22:11:18 -05:00
|
|
|
collapsed : ImmutableMap({
|
|
|
|
enabled : true,
|
|
|
|
auto : ImmutableMap({
|
|
|
|
all : false,
|
|
|
|
notifications : true,
|
|
|
|
lengthy : true,
|
|
|
|
reblogs : false,
|
|
|
|
replies : false,
|
|
|
|
media : false,
|
|
|
|
}),
|
|
|
|
backgrounds : ImmutableMap({
|
|
|
|
user_backgrounds : false,
|
|
|
|
preview_images : false,
|
|
|
|
}),
|
2018-09-29 19:44:02 -04:00
|
|
|
show_action_bar : true,
|
2017-11-17 22:11:18 -05:00
|
|
|
}),
|
|
|
|
media : ImmutableMap({
|
2019-03-10 15:34:51 -04:00
|
|
|
letterbox : true,
|
|
|
|
fullwidth : true,
|
|
|
|
reveal_behind_cw : false,
|
2020-10-26 15:11:35 -04:00
|
|
|
pop_in_player : true,
|
2017-11-17 22:11:18 -05:00
|
|
|
}),
|
2018-09-06 14:55:11 -04:00
|
|
|
notifications : ImmutableMap({
|
|
|
|
favicon_badge : false,
|
|
|
|
tab_badge : true,
|
|
|
|
}),
|
2017-11-17 22:11:18 -05: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);
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|