|
|
@ -1,20 +1,6 @@
|
|
|
|
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
|
|
|
|
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
|
|
|
|
import { DURATION } from '../../session/constants';
|
|
|
|
|
|
|
|
import { NetworkTime } from '../../util/NetworkTime';
|
|
|
|
import { NetworkTime } from '../../util/NetworkTime';
|
|
|
|
|
|
|
|
import { FEATURE_RELEASE_TIMESTAMPS } from '../../session/constants';
|
|
|
|
// update this to be when we ship desktop groups REMOVE AFTER QA
|
|
|
|
|
|
|
|
const GROUP_DESKTOP_RELEASE = 1767225600 * 1000; // currently 1st Jan 2026
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 3+7 days after the release of groups (more or less), we force new groups to be created as new groups
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
const START_CREATE_NEW_GROUP_TIMESTAMP_MS = GROUP_DESKTOP_RELEASE + DURATION.DAYS * 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 2 weeks after `START_CREATE_NEW_GROUP_TIMESTAMP_MS`, we mark legacy groups readonly
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
const LEGACY_GROUP_DEPRECATED_TIMESTAMP_MS =
|
|
|
|
|
|
|
|
START_CREATE_NEW_GROUP_TIMESTAMP_MS + DURATION.WEEKS * 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export interface ReleasedFeaturesState {
|
|
|
|
export interface ReleasedFeaturesState {
|
|
|
|
legacyGroupDeprecationTimestampRefreshAtMs: number;
|
|
|
|
legacyGroupDeprecationTimestampRefreshAtMs: number;
|
|
|
@ -24,8 +10,8 @@ export interface ReleasedFeaturesState {
|
|
|
|
|
|
|
|
|
|
|
|
export const initialReleasedFeaturesState = {
|
|
|
|
export const initialReleasedFeaturesState = {
|
|
|
|
legacyGroupDeprecationTimestampRefreshAtMs: Date.now(),
|
|
|
|
legacyGroupDeprecationTimestampRefreshAtMs: Date.now(),
|
|
|
|
canCreateGroupV2: Date.now() >= START_CREATE_NEW_GROUP_TIMESTAMP_MS,
|
|
|
|
canCreateGroupV2: Date.now() >= FEATURE_RELEASE_TIMESTAMPS.START_CREATE_NEW_GROUP,
|
|
|
|
legacyGroupsReadOnly: Date.now() >= LEGACY_GROUP_DEPRECATED_TIMESTAMP_MS,
|
|
|
|
legacyGroupsReadOnly: Date.now() >= FEATURE_RELEASE_TIMESTAMPS.LEGACY_GROUP_READONLY,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const releasedFeaturesSlice = createSlice({
|
|
|
|
const releasedFeaturesSlice = createSlice({
|
|
|
@ -34,8 +20,10 @@ const releasedFeaturesSlice = createSlice({
|
|
|
|
reducers: {
|
|
|
|
reducers: {
|
|
|
|
updateLegacyGroupDeprecationTimestampUpdatedAt: (state, action: PayloadAction<number>) => {
|
|
|
|
updateLegacyGroupDeprecationTimestampUpdatedAt: (state, action: PayloadAction<number>) => {
|
|
|
|
state.legacyGroupDeprecationTimestampRefreshAtMs = action.payload;
|
|
|
|
state.legacyGroupDeprecationTimestampRefreshAtMs = action.payload;
|
|
|
|
state.canCreateGroupV2 = NetworkTime.now() >= START_CREATE_NEW_GROUP_TIMESTAMP_MS;
|
|
|
|
state.canCreateGroupV2 =
|
|
|
|
state.legacyGroupsReadOnly = NetworkTime.now() >= LEGACY_GROUP_DEPRECATED_TIMESTAMP_MS;
|
|
|
|
NetworkTime.now() >= FEATURE_RELEASE_TIMESTAMPS.START_CREATE_NEW_GROUP;
|
|
|
|
|
|
|
|
state.legacyGroupsReadOnly =
|
|
|
|
|
|
|
|
NetworkTime.now() >= FEATURE_RELEASE_TIMESTAMPS.LEGACY_GROUP_READONLY;
|
|
|
|
return state;
|
|
|
|
return state;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|