Skip to content

Commit 334da8f

Browse files
authored
Merge pull request #1496 from Bilb/remove-uneeded-feature-flags
chore: remove uneeded feature flags
2 parents 5457b29 + 2f10ee2 commit 334da8f

File tree

7 files changed

+40
-112
lines changed

7 files changed

+40
-112
lines changed

preload.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ window.sessionFeatureFlags = {
5858
// Hooks
5959
useClosedGroupV2QAButtons: false, // TODO DO NOT MERGE
6060
useOnionRequests: true,
61-
useReleaseChannels: true,
62-
useSESH101: true,
6361
useTestNet: isTestNet() || isTestIntegration(),
6462
debugInputCommands: !isEmpty(process.env.SESSION_DEBUG),
6563
alwaysShowRemainingChars: false,

ts/components/dialog/debug/ReleaseChannel.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ const items = [
2424
export const ReleaseChannel = () => {
2525
const { releaseChannel, setReleaseChannel } = useReleaseChannel();
2626

27-
if (!window.sessionFeatureFlags.useReleaseChannels) {
28-
return null;
29-
}
30-
3127
return (
3228
<Flex
3329
$container={true}

ts/components/dialog/debug/components.tsx

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ import { ConversationTypeEnum } from '../../../models/types';
3232
import { ContactsWrapperActions } from '../../../webworker/workers/browser/libsession_worker_interface';
3333
import { usePolling } from '../../../hooks/usePolling';
3434
import { releasedFeaturesActions } from '../../../state/ducks/releasedFeatures';
35-
import {
36-
useReleasedFeaturesRefreshedAt,
37-
useSesh101NotificationAt,
38-
} from '../../../state/selectors/releasedFeatures';
39-
import { formatAbbreviatedExpireDoubleTimer } from '../../../util/i18n/formatting/expirationTimer';
40-
import { handleReleaseNotification } from '../../../util/releasedFeatures';
4135
import { networkDataActions } from '../../../state/ducks/networkData';
4236
import { DEBUG_MENU_PAGE, type DebugMenuPageProps } from './DebugMenuModal';
4337
import { SimpleSessionInput } from '../../inputs/SessionInput';
@@ -327,9 +321,7 @@ export const DebugActions = () => {
327321
</SessionButton>
328322
<CheckForUpdatesButton />
329323
<CheckVersionButton channelToCheck="stable" />
330-
{window.sessionFeatureFlags.useReleaseChannels ? (
331-
<CheckVersionButton channelToCheck="alpha" />
332-
) : null}
324+
<CheckVersionButton channelToCheck="alpha" />
333325
<SessionButton
334326
width="180px"
335327
onClick={async () => {
@@ -347,12 +339,11 @@ export const DebugActions = () => {
347339

348340
export const ExperimentalActions = ({ forceUpdate }: { forceUpdate: () => void }) => {
349341
const dispatch = useDispatch();
350-
const refreshedAt = useReleasedFeaturesRefreshedAt();
351-
const sesh101NotificationAt = useSesh101NotificationAt();
352-
353-
const [countdown, setCountdown] = useState(false);
342+
// const refreshedAt = useReleasedFeaturesRefreshedAt();
343+
// const sesh101NotificationAt = useSesh101NotificationAt();
354344

355-
const timeLeftMs = sesh101NotificationAt - Date.now();
345+
// const [countdown, setCountdown] = useState(false);
346+
// const timeLeftMs = sesh101NotificationAt - Date.now();
356347

357348
// TODO [SES-2606] uncomment before release but after QA
358349
// if (!process.env.SESSION_DEV) {
@@ -379,31 +370,21 @@ export const ExperimentalActions = ({ forceUpdate }: { forceUpdate: () => void }
379370
>
380371
Reset experiments
381372
</SessionButton>
382-
{window.sessionFeatureFlags.useSESH101 ? (
383-
<SessionButton
384-
onClick={() => {
385-
const notifyAt = handleReleaseNotification({
386-
featureName: 'useSESH101',
387-
message: localize('sessionNetworkNotificationLive').toString(),
388-
lastRefreshedAt: refreshedAt,
389-
notifyAt: sesh101NotificationAt,
390-
delayMs: 10 * DURATION.SECONDS,
391-
force: true,
392-
});
393-
dispatch(releasedFeaturesActions.updateSesh101NotificationAt(notifyAt));
394-
setCountdown(true);
395-
}}
396-
>
397-
Notify Sesh 101
398-
<span style={{ marginInlineStart: 'var(--margins-xs)' }}>
399-
{countdown
400-
? Math.floor(timeLeftMs / 1000) > 0
401-
? `(${formatAbbreviatedExpireDoubleTimer(Math.floor(timeLeftMs / 1000))})`
402-
: '🎉'
403-
: '(10s)'}
404-
</span>
405-
</SessionButton>
406-
) : null}
373+
{/* <SessionButton
374+
onClick={() => {
375+
dispatch(releasedFeaturesActions.updateSesh101NotificationAt(notifyAt));
376+
setCountdown(true);
377+
}}
378+
>
379+
Notify Sesh 101
380+
<span style={{ marginInlineStart: 'var(--margins-xs)' }}>
381+
{countdown
382+
? Math.floor(timeLeftMs / 1000) > 0
383+
? `(${formatAbbreviatedExpireDoubleTimer(Math.floor(timeLeftMs / 1000))})`
384+
: '🎉'
385+
: '(10s)'}
386+
</span>
387+
</SessionButton> */}
407388
<SessionButton
408389
onClick={() => {
409390
dispatch(networkDataActions.fetchInfoFromSeshServer() as any);

ts/components/leftpane/ActionsPanel.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ import { MessageQueue } from '../../session/sending';
5858
import { useCheckReleasedFeatures } from '../../hooks/useCheckReleasedFeatures';
5959
import { useDebugMode } from '../../state/selectors/debug';
6060
import { networkDataActions } from '../../state/ducks/networkData';
61-
import { isSesh101ReadyOutsideRedux } from '../../state/selectors/releasedFeatures';
6261
import { searchActions } from '../../state/ducks/search';
6362
import { LUCIDE_ICONS_UNICODE } from '../icon/lucide';
6463

@@ -224,9 +223,7 @@ const doAppStartUp = async () => {
224223
// eslint-disable-next-line more/no-then
225224
void SnodePool.getFreshSwarmFor(UserUtils.getOurPubKeyStrFromCache()).then(() => {
226225
// trigger any other actions that need to be done after the swarm is ready
227-
if (isSesh101ReadyOutsideRedux()) {
228-
window.inboxStore?.dispatch(networkDataActions.fetchInfoFromSeshServer() as any);
229-
}
226+
window.inboxStore?.dispatch(networkDataActions.fetchInfoFromSeshServer() as any);
230227
}); // refresh our swarm on start to speed up the first message fetching event
231228
void Data.cleanupOrphanedAttachments();
232229

ts/state/ducks/releasedFeatures.tsx

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,23 @@
11
import { createAsyncThunk, createSlice, type PayloadAction } from '@reduxjs/toolkit';
22
import { ToastUtils } from '../../session/utils';
33
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 { localize } from '../../localization/localeTools';
84

95
export interface ReleasedFeaturesState {
106
refreshedAt: number;
11-
sesh101Ready: boolean;
12-
sesh101NotificationAt: number;
137
}
148

159
export const initialReleasedFeaturesState = {
1610
refreshedAt: Date.now(),
17-
sesh101Ready: window.sessionFeatureFlags.useSESH101,
18-
sesh101NotificationAt: 0,
1911
};
2012

2113
// #region - Async Thunks
2214

2315
// NOTE as features are released in production they will be removed from this list
2416
const resetExperiments = createAsyncThunk(
2517
'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> => {
3119
// reset the redux state
32-
payloadCreator.dispatch(releasedFeaturesActions.updateSesh101Ready(false));
33-
payloadCreator.dispatch(releasedFeaturesActions.updateSesh101NotificationAt(0));
20+
// payloadCreator.dispatch(releasedFeaturesActions.updateSesh101NotificationAt(0));
3421

3522
// reset the storage
3623
await Storage.remove(`releaseNotification-useSESH101`);
@@ -58,35 +45,28 @@ const releasedFeaturesSlice = createSlice({
5845
const { refreshedAt } = action.payload;
5946

6047
state.refreshedAt = refreshedAt;
61-
state.sesh101Ready = window.sessionFeatureFlags.useSESH101;
6248

63-
if (state.sesh101Ready) {
64-
state.sesh101NotificationAt = handleReleaseNotification({
65-
featureName: 'useSESH101',
66-
message: localize('sessionNetworkNotificationLive').toString(),
67-
lastRefreshedAt: state.refreshedAt,
68-
notifyAt: state.sesh101NotificationAt,
69-
delayMs: 1 * DURATION.HOURS,
70-
});
71-
}
49+
// state.sesh101NotificationAt = handleReleaseNotification({
50+
// featureName: 'useSESH101',
51+
// message: localize('sessionNetworkNotificationLive').toString(),
52+
// lastRefreshedAt: state.refreshedAt,
53+
// notifyAt: state.sesh101NotificationAt,
54+
// delayMs: 1 * DURATION.HOURS,
55+
// });
7256

7357
return state;
7458
},
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+
// }
8767

88-
return state;
89-
},
68+
// return state;
69+
// },
9070
},
9171
extraReducers: builder => {
9272
builder.addCase(resetExperiments.fulfilled, (_state, _action) => {

ts/state/ducks/types/releasedFeaturesReduxTypes.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ export type SessionFeatureFlags = {
77
useOnionRequests: boolean;
88
useTestNet: boolean;
99
useClosedGroupV2QAButtons: boolean;
10-
useReleaseChannels: boolean;
11-
useSESH101: boolean;
1210
alwaysShowRemainingChars: boolean;
1311
showPopoverAnchors: boolean;
1412
debugInputCommands: boolean;

ts/state/selectors/releasedFeatures.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,3 @@ export const useReleasedFeaturesRefreshedAt = (): number => {
66
return state?.releasedFeatures.refreshedAt || 0;
77
});
88
};
9-
10-
export function useIsSesh101Ready() {
11-
const sesh101 = useSelector((state: StateType) => state.releasedFeatures.sesh101Ready);
12-
return window.sessionFeatureFlags.useSESH101 || sesh101;
13-
}
14-
15-
export function useSesh101NotificationAt() {
16-
const sesh101NotificationAt = useSelector(
17-
(state: StateType) => state.releasedFeatures.sesh101NotificationAt
18-
);
19-
return sesh101NotificationAt;
20-
}
21-
22-
// outside of redux
23-
24-
export function isSesh101ReadyOutsideRedux() {
25-
if (!window.inboxStore) {
26-
return false;
27-
}
28-
const sesh101 = !!window.inboxStore?.getState()?.releasedFeatures.sesh101;
29-
return window.sessionFeatureFlags.useSESH101 || sesh101;
30-
}

0 commit comments

Comments
 (0)