|
@@ -1,6 +1,5 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
|
-import { APP_WILL_MOUNT } from '../base/app';
|
4
|
3
|
import { ReducerRegistry, set } from '../base/redux';
|
5
|
4
|
import { PersistenceRegistry } from '../base/storage';
|
6
|
5
|
|
|
@@ -41,33 +40,19 @@ const DEFAULT_STATE = {
|
41
|
40
|
const STORE_NAME = 'features/calendar-sync';
|
42
|
41
|
|
43
|
42
|
/**
|
44
|
|
- * NOTE 1: For legacy purposes, read any {@code knownDomains} persisted by the
|
45
|
|
- * feature calendar-sync.
|
46
|
|
- *
|
47
|
|
- * NOTE 2: Never persist the authorization value as it's needed to remain a
|
|
43
|
+ * NOTE: Never persist the authorization value as it's needed to remain a
|
48
|
44
|
* runtime value to see if we need to re-request the calendar permission from
|
49
|
45
|
* the user.
|
50
|
46
|
*/
|
51
|
47
|
isCalendarEnabled()
|
52
|
48
|
&& PersistenceRegistry.register(STORE_NAME, {
|
53
|
49
|
integrationType: true,
|
54
|
|
- knownDomains: true,
|
55
|
50
|
msAuthState: true
|
56
|
51
|
});
|
57
|
52
|
|
58
|
53
|
isCalendarEnabled()
|
59
|
54
|
&& ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
|
60
|
55
|
switch (action.type) {
|
61
|
|
- case APP_WILL_MOUNT:
|
62
|
|
- // For legacy purposes, we've allowed the deserialization of
|
63
|
|
- // knownDomains. At this point, it should have already been
|
64
|
|
- // translated into the new state format (namely, base/known-domains)
|
65
|
|
- // and the app no longer needs it.
|
66
|
|
- if (typeof state.knownDomains !== 'undefined') {
|
67
|
|
- return set(state, 'knownDomains', undefined);
|
68
|
|
- }
|
69
|
|
- break;
|
70
|
|
-
|
71
|
56
|
case CLEAR_CALENDAR_INTEGRATION:
|
72
|
57
|
return DEFAULT_STATE;
|
73
|
58
|
|