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