|
@@ -8,22 +8,29 @@ import {
|
8
|
8
|
SET_CALENDAR_AUTHORIZATION,
|
9
|
9
|
SET_CALENDAR_EVENTS
|
10
|
10
|
} from './actionTypes';
|
11
|
|
-import { CALENDAR_ENABLED } from './constants';
|
12
|
|
-
|
13
|
|
-const DEFAULT_STATE = {
|
14
|
|
- /**
|
15
|
|
- * Note: If features/calendar-sync ever gets persisted, do not persist the
|
16
|
|
- * authorization value as it's needed to remain a runtime value to see if we
|
17
|
|
- * need to re-request the calendar permission from the user.
|
18
|
|
- */
|
19
|
|
- authorization: undefined,
|
20
|
|
- events: []
|
21
|
|
-};
|
22
|
|
-
|
|
11
|
+import { CALENDAR_ENABLED, DEFAULT_STATE } from './constants';
|
|
12
|
+
|
|
13
|
+/**
|
|
14
|
+ * Constant for the Redux subtree of the calendar feature.
|
|
15
|
+ *
|
|
16
|
+ * NOTE: Please do not access this subtree directly outside of this feature.
|
|
17
|
+ * This feature can be disabled (see {@code constants.js} for details), and in
|
|
18
|
+ * that case, accessing this subtree directly will return undefined and will
|
|
19
|
+ * need a bunch of repetitive type checks in other features. Use the
|
|
20
|
+ * {@code getCalendarState} function instead, or make sure you take care of
|
|
21
|
+ * those checks, or consider using the {@code CALENDAR_ENABLED} const to gate
|
|
22
|
+ * features if needed.
|
|
23
|
+ */
|
23
|
24
|
const STORE_NAME = 'features/calendar-sync';
|
24
|
25
|
|
25
|
|
-// XXX For legacy purposes, read any {@code knownDomains} persisted by the
|
26
|
|
-// feature calendar-sync.
|
|
26
|
+/**
|
|
27
|
+ * NOTE 1: For legacy purposes, read any {@code knownDomains} persisted by the
|
|
28
|
+ * feature calendar-sync.
|
|
29
|
+ *
|
|
30
|
+ * NOTE 2: Never persist the authorization value as it's needed to remain a
|
|
31
|
+ * runtime value to see if we need to re-request the calendar permission from
|
|
32
|
+ * the user.
|
|
33
|
+ */
|
27
|
34
|
CALENDAR_ENABLED
|
28
|
35
|
&& PersistenceRegistry.register(STORE_NAME, {
|
29
|
36
|
knownDomains: true
|