|
1 | 1 | import { createAsyncThunk, createSlice, type PayloadAction } from '@reduxjs/toolkit';
|
2 | 2 | import { ToastUtils } from '../../session/utils';
|
3 | 3 | import { Storage } from '../../util/storage';
|
4 |
| -import { DURATION } from '../../session/constants'; |
5 |
| -import { isValidUnixTimestamp } from '../../session/utils/Timestamps'; |
6 |
| -import { handleReleaseNotification } from '../../util/releasedFeatures'; |
7 |
| -import { tr } from '../../localization/localeTools'; |
8 | 4 |
|
9 | 5 | export interface ReleasedFeaturesState {
|
10 | 6 | refreshedAt: number;
|
11 |
| - sesh101Ready: boolean; |
12 |
| - sesh101NotificationAt: number; |
13 | 7 | }
|
14 | 8 |
|
15 | 9 | export const initialReleasedFeaturesState = {
|
16 | 10 | refreshedAt: Date.now(),
|
17 |
| - sesh101Ready: window.sessionFeatureFlags.useSESH101, |
18 |
| - sesh101NotificationAt: 0, |
19 | 11 | };
|
20 | 12 |
|
21 | 13 | // #region - Async Thunks
|
22 | 14 |
|
23 | 15 | // NOTE as features are released in production they will be removed from this list
|
24 | 16 | const resetExperiments = createAsyncThunk(
|
25 | 17 | 'releasedFeatures/resetExperiments',
|
26 |
| - async (_, payloadCreator): Promise<void> => { |
27 |
| - // reset the feature flags |
28 |
| - window.sessionFeatureFlags.useReleaseChannels = false; |
29 |
| - window.sessionFeatureFlags.useSESH101 = false; |
30 |
| - |
| 18 | + async (_, _payloadCreator): Promise<void> => { |
31 | 19 | // reset the redux state
|
32 |
| - payloadCreator.dispatch(releasedFeaturesActions.updateSesh101Ready(false)); |
33 |
| - payloadCreator.dispatch(releasedFeaturesActions.updateSesh101NotificationAt(0)); |
| 20 | + // payloadCreator.dispatch(releasedFeaturesActions.updateSesh101NotificationAt(0)); |
34 | 21 |
|
35 | 22 | // reset the storage
|
36 | 23 | await Storage.remove(`releaseNotification-useSESH101`);
|
@@ -58,35 +45,28 @@ const releasedFeaturesSlice = createSlice({
|
58 | 45 | const { refreshedAt } = action.payload;
|
59 | 46 |
|
60 | 47 | state.refreshedAt = refreshedAt;
|
61 |
| - state.sesh101Ready = window.sessionFeatureFlags.useSESH101; |
62 | 48 |
|
63 |
| - if (state.sesh101Ready) { |
64 |
| - state.sesh101NotificationAt = handleReleaseNotification({ |
65 |
| - featureName: 'useSESH101', |
66 |
| - message: tr('sessionNetworkNotificationLive'), |
67 |
| - lastRefreshedAt: state.refreshedAt, |
68 |
| - notifyAt: state.sesh101NotificationAt, |
69 |
| - delayMs: 1 * DURATION.HOURS, |
70 |
| - }); |
71 |
| - } |
| 49 | + // state.sesh101NotificationAt = handleReleaseNotification({ |
| 50 | + // featureName: 'useSESH101', |
| 51 | + // message: tr('sessionNetworkNotificationLive').toString(), |
| 52 | + // lastRefreshedAt: state.refreshedAt, |
| 53 | + // notifyAt: state.sesh101NotificationAt, |
| 54 | + // delayMs: 1 * DURATION.HOURS, |
| 55 | + // }); |
72 | 56 |
|
73 | 57 | return state;
|
74 | 58 | },
|
75 |
| - updateSesh101Ready: (state, action: PayloadAction<boolean>) => { |
76 |
| - state.sesh101Ready = action.payload; |
77 |
| - return state; |
78 |
| - }, |
79 |
| - updateSesh101NotificationAt(state, action: PayloadAction<number>) { |
80 |
| - if (isValidUnixTimestamp(action.payload)) { |
81 |
| - state.sesh101NotificationAt = action.payload; |
82 |
| - } else { |
83 |
| - window.log.error( |
84 |
| - `[releasedFeatures/updateSesh101NotificationAt] invalid timestamp ${action.payload}` |
85 |
| - ); |
86 |
| - } |
| 59 | + // updateSesh101NotificationAt(state, action: PayloadAction<number>) { |
| 60 | + // if (isValidUnixTimestamp(action.payload)) { |
| 61 | + // state.sesh101NotificationAt = action.payload; |
| 62 | + // } else { |
| 63 | + // window.log.error( |
| 64 | + // `[releasedFeatures/updateSesh101NotificationAt] invalid timestamp ${action.payload}` |
| 65 | + // ); |
| 66 | + // } |
87 | 67 |
|
88 |
| - return state; |
89 |
| - }, |
| 68 | + // return state; |
| 69 | + // }, |
90 | 70 | },
|
91 | 71 | extraReducers: builder => {
|
92 | 72 | builder.addCase(resetExperiments.fulfilled, (_state, _action) => {
|
|
0 commit comments