2017-06-25 11:12:34 +09:00
|
|
|
import { LOCAL_SETTING_CHANGE } from '../actions/local_settings';
|
|
|
|
import { STORE_HYDRATE } from '../actions/store';
|
|
|
|
import Immutable from 'immutable';
|
|
|
|
|
2017-06-29 14:11:21 +09:00
|
|
|
const initialState = Immutable.fromJS({
|
2017-06-29 14:00:54 +09:00
|
|
|
layout : 'auto',
|
|
|
|
stretch : true,
|
|
|
|
collapsed : {
|
|
|
|
enabled : true,
|
|
|
|
auto : {
|
|
|
|
all : false,
|
|
|
|
notifications : true,
|
|
|
|
lengthy : true,
|
|
|
|
replies : false,
|
|
|
|
media : false,
|
|
|
|
},
|
|
|
|
backgrounds : {
|
|
|
|
user_backgrounds : false,
|
|
|
|
preview_images : false,
|
|
|
|
},
|
|
|
|
},
|
2017-06-30 18:15:18 +09:00
|
|
|
media : {
|
|
|
|
letterbox : true,
|
2017-07-08 18:01:56 +09:00
|
|
|
fullwidth : true,
|
2017-06-30 18:15:18 +09:00
|
|
|
},
|
2017-06-25 11:12:34 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
const hydrate = (state, localSettings) => state.mergeDeep(localSettings);
|
|
|
|
|
|
|
|
export default function localSettings(state = initialState, action) {
|
|
|
|
switch(action.type) {
|
|
|
|
case STORE_HYDRATE:
|
2017-06-29 14:00:54 +09:00
|
|
|
return hydrate(state, action.state.get('local_settings'));
|
2017-06-25 11:12:34 +09:00
|
|
|
case LOCAL_SETTING_CHANGE:
|
|
|
|
return state.setIn(action.key, action.value);
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|