• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { Action, ActionData } from '../actions/Action'
17
18export type SettingState = {
19  isAssGridViewShow: string,
20  isShowtimeLapse: boolean,
21  isCloseFlag: boolean,
22  isShowSettingView: boolean
23}
24
25const initState = {
26  isAssGridViewShow: '0',
27  isShowtimeLapse: false,
28  isCloseFlag: false,
29  isShowSettingView: false
30}
31
32export default function SettingReducer(state = initState, action: ActionData): SettingState {
33  switch (action.type) {
34  case Action.ACTION_ASSISTIVE_GRID_VIEW:
35    return {...state, isAssGridViewShow: action.data.isAssGridViewShow}
36  case Action.ACTION_CHANGE_TIME_LAPSE:
37    return { ...state, isShowtimeLapse: action.data.isShowtimeLapse}
38  case Action.ACTION_CLOSE_DIALOG:
39    return { ...state, isCloseFlag: action.data.isCloseFlag }
40  case Action.ACTION_SHOW_SETTING_VIEW:
41    return { ...state, isShowSettingView: action.data.isShowSettingView }
42  default:
43    return state;
44  }
45}