2021-05-28 16:15:17 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-07-01 00:52:03 +00:00
|
|
|
import type { ThunkAction } from 'redux-thunk';
|
2022-08-16 23:59:11 +00:00
|
|
|
import type { ExplodePromiseResultType } from '../../util/explodePromise';
|
2022-07-01 00:52:03 +00:00
|
|
|
import type { PropsForMessage } from '../selectors/message';
|
2022-08-16 23:59:11 +00:00
|
|
|
import type { SafetyNumberChangeSource } from '../../components/SafetyNumberChangeDialog';
|
|
|
|
import type { StateType as RootStateType } from '../reducer';
|
|
|
|
import type { UUIDStringType } from '../../types/UUID';
|
|
|
|
import * as SingleServePromise from '../../services/singleServePromise';
|
2022-07-01 00:52:03 +00:00
|
|
|
import { getMessageById } from '../../messages/getMessageById';
|
|
|
|
import { getMessagePropsSelector } from '../selectors/message';
|
|
|
|
import { useBoundActions } from '../../hooks/useBoundActions';
|
|
|
|
|
2021-05-28 16:15:17 +00:00
|
|
|
// State
|
|
|
|
|
2022-07-01 00:52:03 +00:00
|
|
|
export type ForwardMessagePropsType = Omit<PropsForMessage, 'renderingContext'>;
|
2022-09-26 16:24:52 +00:00
|
|
|
export type SafetyNumberChangedBlockingDataType = Readonly<{
|
|
|
|
promiseUuid: UUIDStringType;
|
|
|
|
source?: SafetyNumberChangeSource;
|
|
|
|
}>;
|
|
|
|
|
|
|
|
export type GlobalModalsStateType = Readonly<{
|
|
|
|
contactModalState?: ContactModalStateType;
|
|
|
|
forwardMessageProps?: ForwardMessagePropsType;
|
|
|
|
isProfileEditorVisible: boolean;
|
|
|
|
isSignalConnectionsVisible: boolean;
|
|
|
|
isStoriesSettingsVisible: boolean;
|
|
|
|
isWhatsNewVisible: boolean;
|
|
|
|
profileEditorHasError: boolean;
|
|
|
|
safetyNumberChangedBlockingData?: SafetyNumberChangedBlockingDataType;
|
|
|
|
safetyNumberModalContactId?: string;
|
|
|
|
addUserToAnotherGroupModalContactId?: string;
|
|
|
|
userNotFoundModalState?: UserNotFoundModalStateType;
|
|
|
|
}>;
|
2021-05-28 16:15:17 +00:00
|
|
|
|
|
|
|
// Actions
|
|
|
|
|
2021-09-21 22:37:10 +00:00
|
|
|
const HIDE_CONTACT_MODAL = 'globalModals/HIDE_CONTACT_MODAL';
|
|
|
|
const SHOW_CONTACT_MODAL = 'globalModals/SHOW_CONTACT_MODAL';
|
2022-07-01 00:52:03 +00:00
|
|
|
const HIDE_WHATS_NEW_MODAL = 'globalModals/HIDE_WHATS_NEW_MODAL_MODAL';
|
2021-10-23 00:41:45 +00:00
|
|
|
const SHOW_WHATS_NEW_MODAL = 'globalModals/SHOW_WHATS_NEW_MODAL_MODAL';
|
2022-04-05 00:38:22 +00:00
|
|
|
const HIDE_UUID_NOT_FOUND_MODAL = 'globalModals/HIDE_UUID_NOT_FOUND_MODAL';
|
2022-07-01 00:52:03 +00:00
|
|
|
const SHOW_UUID_NOT_FOUND_MODAL = 'globalModals/SHOW_UUID_NOT_FOUND_MODAL';
|
2022-07-21 00:07:09 +00:00
|
|
|
const SHOW_STORIES_SETTINGS = 'globalModals/SHOW_STORIES_SETTINGS';
|
|
|
|
const HIDE_STORIES_SETTINGS = 'globalModals/HIDE_STORIES_SETTINGS';
|
2022-07-01 00:52:03 +00:00
|
|
|
const TOGGLE_FORWARD_MESSAGE_MODAL =
|
|
|
|
'globalModals/TOGGLE_FORWARD_MESSAGE_MODAL';
|
2021-07-19 19:26:06 +00:00
|
|
|
const TOGGLE_PROFILE_EDITOR = 'globalModals/TOGGLE_PROFILE_EDITOR';
|
|
|
|
export const TOGGLE_PROFILE_EDITOR_ERROR =
|
|
|
|
'globalModals/TOGGLE_PROFILE_EDITOR_ERROR';
|
2021-10-06 20:27:14 +00:00
|
|
|
const TOGGLE_SAFETY_NUMBER_MODAL = 'globalModals/TOGGLE_SAFETY_NUMBER_MODAL';
|
2022-09-26 16:24:52 +00:00
|
|
|
const TOGGLE_ADD_USER_TO_ANOTHER_GROUP_MODAL =
|
|
|
|
'globalModals/TOGGLE_ADD_USER_TO_ANOTHER_GROUP_MODAL';
|
2022-07-21 00:07:09 +00:00
|
|
|
const TOGGLE_SIGNAL_CONNECTIONS_MODAL =
|
|
|
|
'globalModals/TOGGLE_SIGNAL_CONNECTIONS_MODAL';
|
2022-08-16 23:59:11 +00:00
|
|
|
export const SHOW_SEND_ANYWAY_DIALOG = 'globalModals/SHOW_SEND_ANYWAY_DIALOG';
|
|
|
|
const HIDE_SEND_ANYWAY_DIALOG = 'globalModals/HIDE_SEND_ANYWAY_DIALOG';
|
2021-05-28 16:15:17 +00:00
|
|
|
|
2021-09-21 22:37:10 +00:00
|
|
|
export type ContactModalStateType = {
|
|
|
|
contactId: string;
|
|
|
|
conversationId?: string;
|
|
|
|
};
|
|
|
|
|
2022-04-05 00:38:22 +00:00
|
|
|
export type UserNotFoundModalStateType =
|
|
|
|
| {
|
|
|
|
type: 'phoneNumber';
|
|
|
|
phoneNumber: string;
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
type: 'username';
|
|
|
|
username: string;
|
|
|
|
};
|
2021-11-12 01:17:29 +00:00
|
|
|
|
2021-09-21 22:37:10 +00:00
|
|
|
type HideContactModalActionType = {
|
|
|
|
type: typeof HIDE_CONTACT_MODAL;
|
|
|
|
};
|
|
|
|
|
|
|
|
type ShowContactModalActionType = {
|
|
|
|
type: typeof SHOW_CONTACT_MODAL;
|
|
|
|
payload: ContactModalStateType;
|
|
|
|
};
|
|
|
|
|
2021-10-23 00:41:45 +00:00
|
|
|
type HideWhatsNewModalActionType = {
|
|
|
|
type: typeof HIDE_WHATS_NEW_MODAL;
|
|
|
|
};
|
|
|
|
|
|
|
|
type ShowWhatsNewModalActionType = {
|
|
|
|
type: typeof SHOW_WHATS_NEW_MODAL;
|
|
|
|
};
|
|
|
|
|
2022-04-05 00:38:22 +00:00
|
|
|
type HideUserNotFoundModalActionType = {
|
|
|
|
type: typeof HIDE_UUID_NOT_FOUND_MODAL;
|
2021-11-12 01:17:29 +00:00
|
|
|
};
|
|
|
|
|
2022-04-05 00:38:22 +00:00
|
|
|
export type ShowUserNotFoundModalActionType = {
|
|
|
|
type: typeof SHOW_UUID_NOT_FOUND_MODAL;
|
|
|
|
payload: UserNotFoundModalStateType;
|
2021-11-12 01:17:29 +00:00
|
|
|
};
|
|
|
|
|
2022-07-01 00:52:03 +00:00
|
|
|
type ToggleForwardMessageModalActionType = {
|
|
|
|
type: typeof TOGGLE_FORWARD_MESSAGE_MODAL;
|
|
|
|
payload: ForwardMessagePropsType | undefined;
|
|
|
|
};
|
|
|
|
|
2021-07-19 19:26:06 +00:00
|
|
|
type ToggleProfileEditorActionType = {
|
|
|
|
type: typeof TOGGLE_PROFILE_EDITOR;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ToggleProfileEditorErrorActionType = {
|
|
|
|
type: typeof TOGGLE_PROFILE_EDITOR_ERROR;
|
|
|
|
};
|
|
|
|
|
2021-10-06 20:27:14 +00:00
|
|
|
type ToggleSafetyNumberModalActionType = {
|
|
|
|
type: typeof TOGGLE_SAFETY_NUMBER_MODAL;
|
|
|
|
payload: string | undefined;
|
|
|
|
};
|
|
|
|
|
2022-09-26 16:24:52 +00:00
|
|
|
type ToggleAddUserToAnotherGroupModalActionType = {
|
|
|
|
type: typeof TOGGLE_ADD_USER_TO_ANOTHER_GROUP_MODAL;
|
|
|
|
payload: string | undefined;
|
|
|
|
};
|
|
|
|
|
2022-07-21 00:07:09 +00:00
|
|
|
type ToggleSignalConnectionsModalActionType = {
|
|
|
|
type: typeof TOGGLE_SIGNAL_CONNECTIONS_MODAL;
|
|
|
|
};
|
|
|
|
|
|
|
|
type ShowStoriesSettingsActionType = {
|
|
|
|
type: typeof SHOW_STORIES_SETTINGS;
|
|
|
|
};
|
|
|
|
|
|
|
|
type HideStoriesSettingsActionType = {
|
|
|
|
type: typeof HIDE_STORIES_SETTINGS;
|
|
|
|
};
|
|
|
|
|
2022-08-16 23:59:11 +00:00
|
|
|
export type ShowSendAnywayDialogActiontype = {
|
|
|
|
type: typeof SHOW_SEND_ANYWAY_DIALOG;
|
|
|
|
payload: SafetyNumberChangedBlockingDataType & {
|
|
|
|
conversationsToPause: Map<string, Set<string>>;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
type HideSendAnywayDialogActiontype = {
|
|
|
|
type: typeof HIDE_SEND_ANYWAY_DIALOG;
|
|
|
|
};
|
|
|
|
|
2021-07-19 19:26:06 +00:00
|
|
|
export type GlobalModalsActionType =
|
2021-09-21 22:37:10 +00:00
|
|
|
| HideContactModalActionType
|
|
|
|
| ShowContactModalActionType
|
2021-10-23 00:41:45 +00:00
|
|
|
| HideWhatsNewModalActionType
|
|
|
|
| ShowWhatsNewModalActionType
|
2022-04-05 00:38:22 +00:00
|
|
|
| HideUserNotFoundModalActionType
|
|
|
|
| ShowUserNotFoundModalActionType
|
2022-07-21 00:07:09 +00:00
|
|
|
| HideStoriesSettingsActionType
|
|
|
|
| ShowStoriesSettingsActionType
|
2022-08-16 23:59:11 +00:00
|
|
|
| HideSendAnywayDialogActiontype
|
|
|
|
| ShowSendAnywayDialogActiontype
|
2022-07-01 00:52:03 +00:00
|
|
|
| ToggleForwardMessageModalActionType
|
2021-07-19 19:26:06 +00:00
|
|
|
| ToggleProfileEditorActionType
|
2021-10-06 20:27:14 +00:00
|
|
|
| ToggleProfileEditorErrorActionType
|
2022-07-21 00:07:09 +00:00
|
|
|
| ToggleSafetyNumberModalActionType
|
2022-09-26 16:24:52 +00:00
|
|
|
| ToggleAddUserToAnotherGroupModalActionType
|
2022-07-21 00:07:09 +00:00
|
|
|
| ToggleSignalConnectionsModalActionType;
|
2021-05-28 16:15:17 +00:00
|
|
|
|
|
|
|
// Action Creators
|
|
|
|
|
|
|
|
export const actions = {
|
2021-09-21 22:37:10 +00:00
|
|
|
hideContactModal,
|
|
|
|
showContactModal,
|
2021-10-23 00:41:45 +00:00
|
|
|
hideWhatsNewModal,
|
|
|
|
showWhatsNewModal,
|
2022-04-05 00:38:22 +00:00
|
|
|
hideUserNotFoundModal,
|
|
|
|
showUserNotFoundModal,
|
2022-07-21 00:07:09 +00:00
|
|
|
hideStoriesSettings,
|
|
|
|
showStoriesSettings,
|
2022-08-16 23:59:11 +00:00
|
|
|
hideBlockingSafetyNumberChangeDialog,
|
|
|
|
showBlockingSafetyNumberChangeDialog,
|
2022-07-01 00:52:03 +00:00
|
|
|
toggleForwardMessageModal,
|
2021-07-19 19:26:06 +00:00
|
|
|
toggleProfileEditor,
|
|
|
|
toggleProfileEditorHasError,
|
2021-10-06 20:27:14 +00:00
|
|
|
toggleSafetyNumberModal,
|
2022-09-26 16:24:52 +00:00
|
|
|
toggleAddUserToAnotherGroupModal,
|
2022-07-21 00:07:09 +00:00
|
|
|
toggleSignalConnectionsModal,
|
2021-05-28 16:15:17 +00:00
|
|
|
};
|
|
|
|
|
2022-07-01 00:52:03 +00:00
|
|
|
export const useGlobalModalActions = (): typeof actions =>
|
|
|
|
useBoundActions(actions);
|
|
|
|
|
2021-09-21 22:37:10 +00:00
|
|
|
function hideContactModal(): HideContactModalActionType {
|
|
|
|
return {
|
|
|
|
type: HIDE_CONTACT_MODAL,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function showContactModal(
|
|
|
|
contactId: string,
|
|
|
|
conversationId?: string
|
|
|
|
): ShowContactModalActionType {
|
|
|
|
return {
|
|
|
|
type: SHOW_CONTACT_MODAL,
|
|
|
|
payload: {
|
|
|
|
contactId,
|
|
|
|
conversationId,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-10-23 00:41:45 +00:00
|
|
|
function hideWhatsNewModal(): HideWhatsNewModalActionType {
|
|
|
|
return {
|
|
|
|
type: HIDE_WHATS_NEW_MODAL,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function showWhatsNewModal(): ShowWhatsNewModalActionType {
|
|
|
|
return {
|
|
|
|
type: SHOW_WHATS_NEW_MODAL,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-04-05 00:38:22 +00:00
|
|
|
function hideUserNotFoundModal(): HideUserNotFoundModalActionType {
|
2021-11-12 01:17:29 +00:00
|
|
|
return {
|
2022-04-05 00:38:22 +00:00
|
|
|
type: HIDE_UUID_NOT_FOUND_MODAL,
|
2021-11-12 01:17:29 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-04-05 00:38:22 +00:00
|
|
|
function showUserNotFoundModal(
|
|
|
|
payload: UserNotFoundModalStateType
|
|
|
|
): ShowUserNotFoundModalActionType {
|
2021-11-12 01:17:29 +00:00
|
|
|
return {
|
2022-04-05 00:38:22 +00:00
|
|
|
type: SHOW_UUID_NOT_FOUND_MODAL,
|
|
|
|
payload,
|
2021-11-12 01:17:29 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-07-21 00:07:09 +00:00
|
|
|
function hideStoriesSettings(): HideStoriesSettingsActionType {
|
|
|
|
return { type: HIDE_STORIES_SETTINGS };
|
|
|
|
}
|
|
|
|
|
|
|
|
function showStoriesSettings(): ShowStoriesSettingsActionType {
|
|
|
|
return { type: SHOW_STORIES_SETTINGS };
|
|
|
|
}
|
|
|
|
|
2022-07-01 00:52:03 +00:00
|
|
|
function toggleForwardMessageModal(
|
|
|
|
messageId?: string
|
|
|
|
): ThunkAction<
|
|
|
|
void,
|
|
|
|
RootStateType,
|
|
|
|
unknown,
|
|
|
|
ToggleForwardMessageModalActionType
|
|
|
|
> {
|
|
|
|
return async (dispatch, getState) => {
|
|
|
|
if (!messageId) {
|
|
|
|
dispatch({
|
|
|
|
type: TOGGLE_FORWARD_MESSAGE_MODAL,
|
|
|
|
payload: undefined,
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const message = await getMessageById(messageId);
|
|
|
|
|
|
|
|
if (!message) {
|
|
|
|
throw new Error(
|
|
|
|
`toggleForwardMessageModal: no message found for ${messageId}`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const messagePropsSelector = getMessagePropsSelector(getState());
|
|
|
|
const messageProps = messagePropsSelector(message.attributes);
|
|
|
|
|
|
|
|
dispatch({
|
|
|
|
type: TOGGLE_FORWARD_MESSAGE_MODAL,
|
|
|
|
payload: messageProps,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-07-19 19:26:06 +00:00
|
|
|
function toggleProfileEditor(): ToggleProfileEditorActionType {
|
|
|
|
return { type: TOGGLE_PROFILE_EDITOR };
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleProfileEditorHasError(): ToggleProfileEditorErrorActionType {
|
|
|
|
return { type: TOGGLE_PROFILE_EDITOR_ERROR };
|
|
|
|
}
|
|
|
|
|
2021-10-06 20:27:14 +00:00
|
|
|
function toggleSafetyNumberModal(
|
|
|
|
safetyNumberModalContactId?: string
|
|
|
|
): ToggleSafetyNumberModalActionType {
|
|
|
|
return {
|
|
|
|
type: TOGGLE_SAFETY_NUMBER_MODAL,
|
|
|
|
payload: safetyNumberModalContactId,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-09-26 16:24:52 +00:00
|
|
|
function toggleAddUserToAnotherGroupModal(
|
|
|
|
contactId?: string
|
|
|
|
): ToggleAddUserToAnotherGroupModalActionType {
|
|
|
|
return {
|
|
|
|
type: TOGGLE_ADD_USER_TO_ANOTHER_GROUP_MODAL,
|
|
|
|
payload: contactId,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-07-21 00:07:09 +00:00
|
|
|
function toggleSignalConnectionsModal(): ToggleSignalConnectionsModalActionType {
|
|
|
|
return {
|
|
|
|
type: TOGGLE_SIGNAL_CONNECTIONS_MODAL,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-08-16 23:59:11 +00:00
|
|
|
function showBlockingSafetyNumberChangeDialog(
|
|
|
|
conversationsToPause: Map<string, Set<string>>,
|
|
|
|
explodedPromise: ExplodePromiseResultType<boolean>,
|
|
|
|
source?: SafetyNumberChangeSource
|
|
|
|
): ThunkAction<void, RootStateType, unknown, ShowSendAnywayDialogActiontype> {
|
|
|
|
const promiseUuid = SingleServePromise.set<boolean>(explodedPromise);
|
|
|
|
|
|
|
|
return dispatch => {
|
|
|
|
dispatch({
|
|
|
|
type: SHOW_SEND_ANYWAY_DIALOG,
|
|
|
|
payload: {
|
|
|
|
conversationsToPause,
|
|
|
|
promiseUuid,
|
|
|
|
source,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function hideBlockingSafetyNumberChangeDialog(): HideSendAnywayDialogActiontype {
|
|
|
|
return {
|
|
|
|
type: HIDE_SEND_ANYWAY_DIALOG,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-05-28 16:15:17 +00:00
|
|
|
// Reducer
|
|
|
|
|
|
|
|
export function getEmptyState(): GlobalModalsStateType {
|
|
|
|
return {
|
2021-07-19 19:26:06 +00:00
|
|
|
isProfileEditorVisible: false,
|
2022-07-21 00:07:09 +00:00
|
|
|
isSignalConnectionsVisible: false,
|
|
|
|
isStoriesSettingsVisible: false,
|
2021-10-23 00:41:45 +00:00
|
|
|
isWhatsNewVisible: false,
|
2022-07-21 00:07:09 +00:00
|
|
|
profileEditorHasError: false,
|
2021-05-28 16:15:17 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function reducer(
|
|
|
|
state: Readonly<GlobalModalsStateType> = getEmptyState(),
|
|
|
|
action: Readonly<GlobalModalsActionType>
|
|
|
|
): GlobalModalsStateType {
|
2021-07-19 19:26:06 +00:00
|
|
|
if (action.type === TOGGLE_PROFILE_EDITOR) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isProfileEditorVisible: !state.isProfileEditorVisible,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action.type === TOGGLE_PROFILE_EDITOR_ERROR) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
profileEditorHasError: !state.profileEditorHasError,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-10-23 00:41:45 +00:00
|
|
|
if (action.type === SHOW_WHATS_NEW_MODAL) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isWhatsNewVisible: true,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action.type === HIDE_WHATS_NEW_MODAL) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isWhatsNewVisible: false,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-04-05 00:38:22 +00:00
|
|
|
if (action.type === HIDE_UUID_NOT_FOUND_MODAL) {
|
2021-11-12 01:17:29 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2022-04-05 00:38:22 +00:00
|
|
|
userNotFoundModalState: undefined,
|
2021-11-12 01:17:29 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-04-05 00:38:22 +00:00
|
|
|
if (action.type === SHOW_UUID_NOT_FOUND_MODAL) {
|
2021-11-12 01:17:29 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2022-04-05 00:38:22 +00:00
|
|
|
userNotFoundModalState: {
|
|
|
|
...action.payload,
|
2021-11-12 01:17:29 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-09-21 22:37:10 +00:00
|
|
|
if (action.type === SHOW_CONTACT_MODAL) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
contactModalState: action.payload,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action.type === HIDE_CONTACT_MODAL) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
contactModalState: undefined,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-10-06 20:27:14 +00:00
|
|
|
if (action.type === TOGGLE_SAFETY_NUMBER_MODAL) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
safetyNumberModalContactId: action.payload,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-09-26 16:24:52 +00:00
|
|
|
if (action.type === TOGGLE_ADD_USER_TO_ANOTHER_GROUP_MODAL) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
addUserToAnotherGroupModalContactId: action.payload,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-07-01 00:52:03 +00:00
|
|
|
if (action.type === TOGGLE_FORWARD_MESSAGE_MODAL) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
forwardMessageProps: action.payload,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-07-21 00:07:09 +00:00
|
|
|
if (action.type === HIDE_STORIES_SETTINGS) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isStoriesSettingsVisible: false,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action.type === SHOW_STORIES_SETTINGS) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isStoriesSettingsVisible: true,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action.type === TOGGLE_SIGNAL_CONNECTIONS_MODAL) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isSignalConnectionsVisible: !state.isSignalConnectionsVisible,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-08-16 23:59:11 +00:00
|
|
|
if (action.type === SHOW_SEND_ANYWAY_DIALOG) {
|
|
|
|
const { promiseUuid, source } = action.payload;
|
|
|
|
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
safetyNumberChangedBlockingData: {
|
|
|
|
promiseUuid,
|
|
|
|
source,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (action.type === HIDE_SEND_ANYWAY_DIALOG) {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
safetyNumberChangedBlockingData: undefined,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-05-28 16:15:17 +00:00
|
|
|
return state;
|
|
|
|
}
|