1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// @flow
import { getAvatarURL } from 'js-utils';
import {
SET_ALWAYS_ON_TOP_WINDOW_ENABLED,
SET_AUDIO_MUTED,
SET_AVATAR_URL,
SET_EMAIL,
SET_NAME,
SET_SERVER_URL,
SET_SERVER_TIMEOUT,
SET_VIDEO_MUTED
} from './actionTypes';
type State = {
avatarURL: string,
email: string,
name: string,
serverURL: ?string,
serverTimeout: ?number,
startWithAudioMuted: boolean,
startWithVideoMuted: boolean,
alwaysOnTopWindowEnabled: boolean,
};
const username = window.jitsiNodeAPI.osUserInfo().username;
const DEFAULT_STATE = {
alwaysOnTopWindowEnabled: true,
avatarURL: getAvatarURL({ id: username }),
email: '',
name: username,
serverURL: undefined,
serverTimeout: undefined,
startWithAudioMuted: false,
startWithVideoMuted: false
};
/**
* Reduces redux actions for features/settings.
*
* @param {State} state - Current reduced redux state.
* @param {Object} action - Action which was dispatched.
* @returns {State} - Updated reduced redux state.
*/
export default (state: State = DEFAULT_STATE, action: Object) => {
switch (action.type) {
case SET_ALWAYS_ON_TOP_WINDOW_ENABLED:
return {
...state,
alwaysOnTopWindowEnabled: action.alwaysOnTopWindowEnabled
};
case SET_AUDIO_MUTED:
return {
...state,
startWithAudioMuted: action.startWithAudioMuted
};
case SET_AVATAR_URL:
return {
...state,
avatarURL: action.avatarURL
};
case SET_EMAIL:
return {
...state,
email: action.email
};
case SET_NAME:
return {
...state,
name: action.name
};
case SET_SERVER_URL:
return {
...state,
serverURL: action.serverURL
};
case SET_SERVER_TIMEOUT:
return {
...state,
serverTimeout: action.serverTimeout
};
case SET_VIDEO_MUTED:
return {
...state,
startWithVideoMuted: action.startWithVideoMuted
};
default:
return state;
}
};
|