-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathindex.js
More file actions
96 lines (94 loc) · 2.73 KB
/
Copy pathindex.js
File metadata and controls
96 lines (94 loc) · 2.73 KB
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
import AppConstants from '../../core/AppConstants';
import { AvatarAccountType } from '../../component-library/components/Avatars/Avatar/variants/AvatarAccount/AvatarAccount.types';
const initialState = {
searchEngine: AppConstants.DEFAULT_SEARCH_ENGINE,
primaryCurrency: 'ETH',
lockTime: -1, // Disabled by default,
avatarAccountType: AvatarAccountType.Maskicon,
hideZeroBalanceTokens: true,
basicFunctionalityEnabled: true,
deepLinkModalDisabled: false,
hapticsEnabled: true,
// Whether this account is shown on the Top Traders leaderboard. Local mirror
// of the backend opt-in/out state; defaults to shown. Not persisted to AUS.
showAccountOnLeaderboard: true,
// Perps chart preferences
perpsChartPreferences: {
preferredCandlePeriod: '15m', // Default to 15 minutes
},
};
const settingsReducer = (state = initialState, action) => {
switch (action.type) {
case 'SET_SEARCH_ENGINE':
return {
...state,
searchEngine: action.searchEngine,
};
case 'SET_LOCK_TIME':
return {
...state,
lockTime: action.lockTime,
};
case 'SET_SHOW_HEX_DATA':
return {
...state,
showHexData: action.showHexData,
};
case 'SET_HIDE_ZERO_BALANCE_TOKENS':
return {
...state,
hideZeroBalanceTokens: action.hideZeroBalanceTokens,
};
case 'SET_AVATAR_ACCOUNT_TYPE':
return {
...state,
avatarAccountType: action.avatarAccountType,
};
case 'SET_PRIMARY_CURRENCY':
return {
...state,
primaryCurrency: action.primaryCurrency,
};
case 'SET_SHOW_FIAT_ON_TESTNETS':
return {
...state,
showFiatOnTestnets: action.showFiatOnTestnets,
};
case 'TOGGLE_BASIC_FUNCTIONALITY':
return {
...state,
basicFunctionalityEnabled: action.basicFunctionalityEnabled,
};
case 'TOGGLE_DEVICE_NOTIFICATIONS':
return {
...state,
deviceNotificationEnabled: action.deviceNotificationEnabled,
};
case 'SET_DEEP_LINK_MODAL_DISABLED':
return {
...state,
deepLinkModalDisabled: action.deepLinkModalDisabled,
};
case 'SET_HAPTICS_ENABLED':
return {
...state,
hapticsEnabled: action.hapticsEnabled,
};
case 'SET_SHOW_ACCOUNT_ON_LEADERBOARD':
return {
...state,
showAccountOnLeaderboard: action.showAccountOnLeaderboard,
};
case 'SET_PERPS_CHART_PREFERRED_CANDLE_PERIOD':
return {
...state,
perpsChartPreferences: {
...state.perpsChartPreferences,
preferredCandlePeriod: action.preferredCandlePeriod,
},
};
default:
return state;
}
};
export default settingsReducer;