2017-01-09 15:00:55 +02:00
|
|
|
import { SETTING_CHANGE } from '../actions/settings';
|
|
|
|
import { STORE_HYDRATE } from '../actions/store';
|
|
|
|
import Immutable from 'immutable';
|
|
|
|
|
|
|
|
const initialState = Immutable.Map({
|
2017-04-16 21:32:00 +03:00
|
|
|
onboarded: false,
|
|
|
|
|
2017-01-10 18:25:10 +02:00
|
|
|
home: Immutable.Map({
|
|
|
|
shows: Immutable.Map({
|
|
|
|
reblog: true,
|
2017-05-20 18:31:47 +03:00
|
|
|
reply: true,
|
2017-05-03 03:04:16 +03:00
|
|
|
}),
|
|
|
|
|
|
|
|
regex: Immutable.Map({
|
2017-05-20 18:31:47 +03:00
|
|
|
body: '',
|
|
|
|
}),
|
2017-01-10 18:25:10 +02:00
|
|
|
}),
|
|
|
|
|
2017-01-09 15:00:55 +02:00
|
|
|
notifications: Immutable.Map({
|
|
|
|
alerts: Immutable.Map({
|
|
|
|
follow: true,
|
|
|
|
favourite: true,
|
|
|
|
reblog: true,
|
2017-05-20 18:31:47 +03:00
|
|
|
mention: true,
|
2017-01-09 15:00:55 +02:00
|
|
|
}),
|
|
|
|
|
|
|
|
shows: Immutable.Map({
|
|
|
|
follow: true,
|
|
|
|
favourite: true,
|
|
|
|
reblog: true,
|
2017-05-20 18:31:47 +03:00
|
|
|
mention: true,
|
2017-01-17 21:09:03 +02:00
|
|
|
}),
|
|
|
|
|
|
|
|
sounds: Immutable.Map({
|
|
|
|
follow: true,
|
|
|
|
favourite: true,
|
|
|
|
reblog: true,
|
2017-05-20 18:31:47 +03:00
|
|
|
mention: true,
|
|
|
|
}),
|
|
|
|
}),
|
2017-01-09 15:00:55 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export default function settings(state = initialState, action) {
|
|
|
|
switch(action.type) {
|
|
|
|
case STORE_HYDRATE:
|
2017-01-17 21:09:03 +02:00
|
|
|
return state.mergeDeep(action.state.get('settings'));
|
2017-01-09 15:00:55 +02:00
|
|
|
case SETTING_CHANGE:
|
|
|
|
return state.setIn(action.key, action.value);
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|