diff --git a/_locales/en/messages.json b/_locales/en/messages.json index d3dd8d021967..2bc7b7681542 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -3096,19 +3096,19 @@ }, "icu:SendEdit--dialog--title2": { "messageformat": "Edit Message", - "description": "Title of the modal shown before sending your first edit message" + "description": "(Deleted 2024/04/29) Title of the modal shown before sending your first edit message" }, "icu:SendEdit--dialog--body2": { "messageformat": "If you edit a message, it will only be visible to people who are on the latest versions of Signal. They will be able to see you edited a message.", - "description": "Body text of the modal shown before sending your first edit message" + "description": "(Deleted 2024/04/29) Body text of the modal shown before sending your first edit message" }, "icu:SendFormatting--dialog--title": { "messageformat": "Sending formatted text", - "description": "Title of the modal shown before sending your first formatting message" + "description": "(Deleted 2024/04/29) Title of the modal shown before sending your first formatting message" }, "icu:SendFormatting--dialog--body": { "messageformat": "Some people may be using a version of Signal that doesn’t support formatted text. They will not be able to see the formatting changes you’ve made to your message.", - "description": "Body text of the modal shown before sending your first formatting message" + "description": "(Deleted 2024/04/29) Body text of the modal shown before sending your first formatting message" }, "icu:AuthArtCreator--dialog--message": { "messageformat": "Would you like to open Signal Sticker Pack Creator?", diff --git a/ts/background.ts b/ts/background.ts index 10f0aa58bfb3..d4e1772f12b2 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -867,17 +867,6 @@ export async function startApp(): Promise { }); } - if (window.isBeforeVersion(lastVersion, '6.22.0-alpha')) { - const formattingWarningShown = window.storage.get( - 'formattingWarningShown', - false - ); - log.info( - `Clearing formattingWarningShown. Previous value was ${formattingWarningShown}` - ); - await window.storage.put('formattingWarningShown', false); - } - if (window.isBeforeVersion(lastVersion, 'v1.29.2-beta.1')) { // Stickers flags await Promise.all([ @@ -946,6 +935,11 @@ export async function startApp(): Promise { await window.storage.remove('lastHeartbeat'); await window.storage.remove('lastStartup'); } + + if (window.isBeforeVersion(lastVersion, 'v7.8.0-beta.1')) { + await window.storage.remove('sendEditWarningShown'); + await window.storage.remove('formattingWarningShown'); + } } setAppLoadingScreenMessage( diff --git a/ts/components/FormattingWarningModal.tsx b/ts/components/FormattingWarningModal.tsx deleted file mode 100644 index b2621b8edfbd..000000000000 --- a/ts/components/FormattingWarningModal.tsx +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import React from 'react'; -import type { LocalizerType } from '../types/Util'; -import { ConfirmationDialog } from './ConfirmationDialog'; - -type PropsType = { - i18n: LocalizerType; - onSendAnyway: () => void; - onCancel: () => void; -}; - -export function FormattingWarningModal({ - i18n, - onSendAnyway, - onCancel, -}: PropsType): JSX.Element | null { - return ( - - {i18n('icu:SendFormatting--dialog--body')} - - ); -} diff --git a/ts/components/GlobalModalContainer.tsx b/ts/components/GlobalModalContainer.tsx index 7132602f4124..60868be521e9 100644 --- a/ts/components/GlobalModalContainer.tsx +++ b/ts/components/GlobalModalContainer.tsx @@ -8,22 +8,17 @@ import type { DeleteMessagesPropsType, EditHistoryMessagesType, EditNicknameAndNoteModalPropsType, - FormattingWarningDataType, ForwardMessagesPropsType, MessageRequestActionsConfirmationPropsType, SafetyNumberChangedBlockingDataType, - SendEditWarningDataType, UserNotFoundModalStateType, } from '../state/ducks/globalModals'; import type { LocalizerType, ThemeType } from '../types/Util'; import { UsernameOnboardingState } from '../types/globalModals'; -import type { ExplodePromiseResultType } from '../util/explodePromise'; import { missingCaseError } from '../util/missingCaseError'; import { ButtonVariant } from './Button'; import { ConfirmationDialog } from './ConfirmationDialog'; -import { FormattingWarningModal } from './FormattingWarningModal'; -import { SendEditWarningModal } from './SendEditWarningModal'; import { SignalConnectionsModal } from './SignalConnectionsModal'; import { WhatsNewModal } from './WhatsNewModal'; @@ -56,11 +51,6 @@ export type PropsType = { // DeleteMessageModal deleteMessagesProps: DeleteMessagesPropsType | undefined; renderDeleteMessagesModal: () => JSX.Element; - // FormattingWarningModal - showFormattingWarningModal: ( - explodedPromise: ExplodePromiseResultType | undefined - ) => void; - formattingWarningData: FormattingWarningDataType | undefined; // ForwardMessageModal forwardMessagesProps: ForwardMessagesPropsType | undefined; renderForwardMessagesModal: () => JSX.Element; @@ -76,11 +66,6 @@ export type PropsType = { // SafetyNumberModal safetyNumberModalContactId: string | undefined; renderSafetyNumber: () => JSX.Element; - // SendEditWarningModal - showSendEditWarningModal: ( - explodedPromise: ExplodePromiseResultType | undefined - ) => void; - sendEditWarningData: SendEditWarningDataType | undefined; // ShortcutGuideModal isShortcutGuideModalVisible: boolean; renderShortcutGuideModal: () => JSX.Element; @@ -138,9 +123,6 @@ export function GlobalModalContainer({ // DeleteMessageModal deleteMessagesProps, renderDeleteMessagesModal, - // FormattingWarningModal - showFormattingWarningModal, - formattingWarningData, // ForwardMessageModal forwardMessagesProps, renderForwardMessagesModal, @@ -156,9 +138,6 @@ export function GlobalModalContainer({ // SafetyNumberModal safetyNumberModalContactId, renderSafetyNumber, - // SendEditWarningDataType - showSendEditWarningModal, - sendEditWarningData, // ShortcutGuideModal isShortcutGuideModalVisible, renderShortcutGuideModal, @@ -226,23 +205,6 @@ export function GlobalModalContainer({ return renderDeleteMessagesModal(); } - if (formattingWarningData) { - const { resolve } = formattingWarningData.explodedPromise; - return ( - { - showFormattingWarningModal(undefined); - resolve(true); - }} - onCancel={() => { - showFormattingWarningModal(undefined); - resolve(false); - }} - /> - ); - } - if (forwardMessagesProps) { return renderForwardMessagesModal(); } @@ -259,23 +221,6 @@ export function GlobalModalContainer({ return renderProfileEditor(); } - if (sendEditWarningData) { - const { resolve } = sendEditWarningData.explodedPromise; - return ( - { - showSendEditWarningModal(undefined); - resolve(true); - }} - onCancel={() => { - showSendEditWarningModal(undefined); - resolve(false); - }} - /> - ); - } - if (isShortcutGuideModalVisible) { return renderShortcutGuideModal(); } diff --git a/ts/components/SendEditWarningModal.tsx b/ts/components/SendEditWarningModal.tsx deleted file mode 100644 index f0379db72d93..000000000000 --- a/ts/components/SendEditWarningModal.tsx +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import React from 'react'; -import type { LocalizerType } from '../types/Util'; -import { ConfirmationDialog } from './ConfirmationDialog'; - -type PropsType = { - i18n: LocalizerType; - onSendAnyway: () => void; - onCancel: () => void; -}; - -export function SendEditWarningModal({ - i18n, - onSendAnyway, - onCancel, -}: PropsType): JSX.Element | null { - return ( - - {i18n('icu:SendEdit--dialog--body2')} - - ); -} diff --git a/ts/state/ducks/composer.ts b/ts/state/ducks/composer.ts index 23b2a2123774..c615cdfc3e63 100644 --- a/ts/state/ducks/composer.ts +++ b/ts/state/ducks/composer.ts @@ -20,7 +20,6 @@ import { } from '../../types/Attachment'; import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions'; import type { DraftBodyRanges } from '../../types/BodyRange'; -import { BodyRange } from '../../types/BodyRange'; import type { LinkPreviewType } from '../../types/message/LinkPreviews'; import type { MessageAttributesType } from '../../model-types.d'; import type { NoopActionType } from './noop'; @@ -90,8 +89,6 @@ import { drop } from '../../util/drop'; import { strictAssert } from '../../util/assert'; import { makeQuote } from '../../util/makeQuote'; import { sendEditedMessage as doSendEditedMessage } from '../../util/sendEditedMessage'; -import { maybeBlockSendForFormattingModal } from '../../util/maybeBlockSendForFormattingModal'; -import { maybeBlockSendForEditWarningModal } from '../../util/maybeBlockSendForEditWarningModal'; import { Sound, SoundType } from '../../util/Sound'; import { isImageTypeSupported, @@ -390,9 +387,7 @@ export function handleLeaveConversation( // eslint-disable-next-line local-rules/type-alias-readonlydeep type WithPreSendChecksOptions = Readonly<{ - bodyRanges?: DraftBodyRanges; message?: string; - isEditedMessage?: boolean; voiceNoteAttachment?: InMemoryAttachmentDraftType; }>; @@ -416,7 +411,7 @@ async function withPreSendChecks( conversation.attributes, ]); - const { bodyRanges, isEditedMessage, message, voiceNoteAttachment } = options; + const { message, voiceNoteAttachment } = options; try { dispatch(setComposerDisabledState(conversationId, true)); @@ -438,45 +433,6 @@ async function withPreSendChecks( return; } - try { - const hasFormatting = bodyRanges?.some(BodyRange.isFormatting); - if (hasFormatting && !window.storage.get('formattingWarningShown')) { - const sendAnyway = await maybeBlockSendForFormattingModal(); - if (!sendAnyway) { - dispatch(setComposerDisabledState(conversationId, false)); - return; - } - drop(window.storage.put('formattingWarningShown', true)); - } - } catch (error) { - log.error( - 'withPreSendChecks block for formatting modal:', - Errors.toLogFormat(error) - ); - return; - } - - try { - if ( - isEditedMessage && - !window.storage.get('sendEditWarningShown') && - !window.SignalCI - ) { - const sendAnyway = await maybeBlockSendForEditWarningModal(); - if (!sendAnyway) { - dispatch(setComposerDisabledState(conversationId, false)); - return; - } - drop(window.storage.put('sendEditWarningShown', true)); - } - } catch (error) { - log.error( - 'withPreSendChecks block for send edit warning modal:', - Errors.toLogFormat(error) - ); - return; - } - const toast = shouldShowInvalidMessageToast(conversation.attributes); if (toast != null) { dispatch({ @@ -510,6 +466,7 @@ async function withPreSendChecks( function sendEditedMessage( conversationId: string, options: WithPreSendChecksOptions & { + bodyRanges?: DraftBodyRanges; targetMessageId: string; quoteAuthorAci?: AciString; quoteSentAt?: number; @@ -534,39 +491,35 @@ function sendEditedMessage( targetMessageId, } = options; - await withPreSendChecks( - conversationId, - { ...options, isEditedMessage: true }, - dispatch, - async () => { - try { - await doSendEditedMessage(conversationId, { - body: message, - bodyRanges, - preview: getLinkPreviewForSend(message), - quoteAuthorAci, - quoteSentAt, - targetMessageId, + await withPreSendChecks(conversationId, options, dispatch, async () => { + try { + await doSendEditedMessage(conversationId, { + body: message, + bodyRanges, + preview: getLinkPreviewForSend(message), + quoteAuthorAci, + quoteSentAt, + targetMessageId, + }); + } catch (error) { + log.error('sendEditedMessage', Errors.toLogFormat(error)); + if (error.toastType) { + dispatch({ + type: SHOW_TOAST, + payload: { + toastType: error.toastType, + }, }); - } catch (error) { - log.error('sendEditedMessage', Errors.toLogFormat(error)); - if (error.toastType) { - dispatch({ - type: SHOW_TOAST, - payload: { - toastType: error.toastType, - }, - }); - } } } - ); + }); }; } function sendMultiMediaMessage( conversationId: string, options: WithPreSendChecksOptions & { + bodyRanges?: DraftBodyRanges; draftAttachments?: ReadonlyArray; timestamp?: number; } diff --git a/ts/state/ducks/globalModals.ts b/ts/state/ducks/globalModals.ts index 5a425385c584..304607f56692 100644 --- a/ts/state/ducks/globalModals.ts +++ b/ts/state/ducks/globalModals.ts @@ -73,12 +73,6 @@ export type SafetyNumberChangedBlockingDataType = ReadonlyDeep<{ promiseUuid: SingleServePromise.SingleServePromiseIdString; source?: SafetyNumberChangeSource; }>; -export type FormattingWarningDataType = ReadonlyDeep<{ - explodedPromise: ExplodePromiseResultType; -}>; -export type SendEditWarningDataType = ReadonlyDeep<{ - explodedPromise: ExplodePromiseResultType; -}>; export type AuthorizeArtCreatorDataType = ReadonlyDeep; @@ -103,7 +97,6 @@ export type GlobalModalsStateType = ReadonlyDeep<{ description?: string; title?: string; }; - formattingWarningData?: FormattingWarningDataType; forwardMessagesProps?: ForwardMessagesPropsType; gv2MigrationProps?: MigrateToGV2PropsType; hasConfirmationModal: boolean; @@ -120,7 +113,6 @@ export type GlobalModalsStateType = ReadonlyDeep<{ profileEditorInitialEditState: ProfileEditorEditState | undefined; safetyNumberChangedBlockingData?: SafetyNumberChangedBlockingDataType; safetyNumberModalContactId?: string; - sendEditWarningData?: SendEditWarningDataType; stickerPackPreviewId?: string; userNotFoundModalState?: UserNotFoundModalStateType; }>; @@ -163,10 +155,6 @@ const TOGGLE_EDIT_NICKNAME_AND_NOTE_MODAL = 'globalModals/TOGGLE_EDIT_NICKNAME_AND_NOTE_MODAL'; const TOGGLE_MESSAGE_REQUEST_ACTIONS_CONFIRMATION = 'globalModals/TOGGLE_MESSAGE_REQUEST_ACTIONS_CONFIRMATION'; -const SHOW_FORMATTING_WARNING_MODAL = - 'globalModals/SHOW_FORMATTING_WARNING_MODAL'; -const SHOW_SEND_EDIT_WARNING_MODAL = - 'globalModals/SHOW_SEND_EDIT_WARNING_MODAL'; const CLOSE_SHORTCUT_GUIDE_MODAL = 'globalModals/CLOSE_SHORTCUT_GUIDE_MODAL'; const SHOW_SHORTCUT_GUIDE_MODAL = 'globalModals/SHOW_SHORTCUT_GUIDE_MODAL'; const SHOW_AUTH_ART_CREATOR = 'globalModals/SHOW_AUTH_ART_CREATOR'; @@ -280,20 +268,6 @@ type ShowStoriesSettingsActionType = ReadonlyDeep<{ type: typeof SHOW_STORIES_SETTINGS; }>; -type ShowFormattingWarningModalActionType = ReadonlyDeep<{ - type: typeof SHOW_FORMATTING_WARNING_MODAL; - payload: { - explodedPromise: ExplodePromiseResultType | undefined; - }; -}>; - -type ShowSendEditWarningModalActionType = ReadonlyDeep<{ - type: typeof SHOW_SEND_EDIT_WARNING_MODAL; - payload: { - explodedPromise: ExplodePromiseResultType | undefined; - }; -}>; - type HideStoriesSettingsActionType = ReadonlyDeep<{ type: typeof HIDE_STORIES_SETTINGS; }>; @@ -409,9 +383,7 @@ export type GlobalModalsActionType = ReadonlyDeep< | ShowErrorModalActionType | ToggleEditNicknameAndNoteModalActionType | ToggleMessageRequestActionsConfirmationActionType - | ShowFormattingWarningModalActionType | ShowSendAnywayDialogActionType - | ShowSendEditWarningModalActionType | ShowShortcutGuideModalActionType | ShowStickerPackPreviewActionType | ShowStoriesSettingsActionType @@ -453,8 +425,6 @@ export const actions = { showErrorModal, toggleEditNicknameAndNoteModal, toggleMessageRequestActionsConfirmation, - showFormattingWarningModal, - showSendEditWarningModal, showGV2MigrationDialog, showShortcutGuideModal, showStickerPackPreview, @@ -532,18 +502,6 @@ function showStoriesSettings(): ShowStoriesSettingsActionType { return { type: SHOW_STORIES_SETTINGS }; } -function showFormattingWarningModal( - explodedPromise: ExplodePromiseResultType | undefined -): ShowFormattingWarningModalActionType { - return { type: SHOW_FORMATTING_WARNING_MODAL, payload: { explodedPromise } }; -} - -function showSendEditWarningModal( - explodedPromise: ExplodePromiseResultType | undefined -): ShowSendEditWarningModalActionType { - return { type: SHOW_SEND_EDIT_WARNING_MODAL, payload: { explodedPromise } }; -} - function showGV2MigrationDialog( conversationId: string ): ThunkAction { @@ -1161,36 +1119,6 @@ export function reducer( }; } - if (action.type === SHOW_FORMATTING_WARNING_MODAL) { - const { explodedPromise } = action.payload; - if (!explodedPromise) { - return { - ...state, - formattingWarningData: undefined, - }; - } - - return { - ...state, - formattingWarningData: { explodedPromise }, - }; - } - - if (action.type === SHOW_SEND_EDIT_WARNING_MODAL) { - const { explodedPromise } = action.payload; - if (!explodedPromise) { - return { - ...state, - sendEditWarningData: undefined, - }; - } - - return { - ...state, - sendEditWarningData: { explodedPromise }, - }; - } - if (action.type === SHOW_STICKER_PACK_PREVIEW) { return { ...state, diff --git a/ts/state/smart/GlobalModalContainer.tsx b/ts/state/smart/GlobalModalContainer.tsx index db031fb611de..589293584778 100644 --- a/ts/state/smart/GlobalModalContainer.tsx +++ b/ts/state/smart/GlobalModalContainer.tsx @@ -96,7 +96,6 @@ export const SmartGlobalModalContainer = memo( editHistoryMessages, editNicknameAndNoteModalProps, errorModalProps, - formattingWarningData, forwardMessagesProps, messageRequestActionsConfirmationProps, notePreviewModalProps, @@ -109,7 +108,6 @@ export const SmartGlobalModalContainer = memo( usernameOnboardingState, safetyNumberChangedBlockingData, safetyNumberModalContactId, - sendEditWarningData, stickerPackPreviewId, userNotFoundModalState, } = useSelector(getGlobalModalsState); @@ -120,8 +118,6 @@ export const SmartGlobalModalContainer = memo( confirmAuthorizeArtCreator, hideUserNotFoundModal, hideWhatsNewModal, - showFormattingWarningModal, - showSendEditWarningModal, toggleSignalConnectionsModal, } = useGlobalModalActions(); @@ -181,7 +177,6 @@ export const SmartGlobalModalContainer = memo( editNicknameAndNoteModalProps={editNicknameAndNoteModalProps} errorModalProps={errorModalProps} deleteMessagesProps={deleteMessagesProps} - formattingWarningData={formattingWarningData} forwardMessagesProps={forwardMessagesProps} messageRequestActionsConfirmationProps={ messageRequestActionsConfirmationProps @@ -218,9 +213,6 @@ export const SmartGlobalModalContainer = memo( renderStoriesSettings={renderStoriesSettings} safetyNumberChangedBlockingData={safetyNumberChangedBlockingData} safetyNumberModalContactId={safetyNumberModalContactId} - sendEditWarningData={sendEditWarningData} - showFormattingWarningModal={showFormattingWarningModal} - showSendEditWarningModal={showSendEditWarningModal} stickerPackPreviewId={stickerPackPreviewId} theme={theme} toggleSignalConnectionsModal={toggleSignalConnectionsModal} diff --git a/ts/types/Storage.d.ts b/ts/types/Storage.d.ts index d86a89b1230d..14079cede7c1 100644 --- a/ts/types/Storage.d.ts +++ b/ts/types/Storage.d.ts @@ -67,7 +67,6 @@ export type StorageAccessType = { customColors: CustomColorsItemType; device_name: string; existingOnboardingStoryMessageIds: ReadonlyArray | undefined; - formattingWarningShown: boolean; hasRegisterSupportForUnauthenticatedDelivery: boolean; hasSetMyStoriesPrivacy: boolean; hasCompletedUsernameOnboarding: boolean; @@ -92,7 +91,6 @@ export type StorageAccessType = { regionCode: string; registrationIdMap: Record; remoteBuildExpiration: number; - sendEditWarningShown: boolean; sessionResets: SessionResetsType; showStickerPickerHint: boolean; showStickersIntroduction: boolean; @@ -175,6 +173,8 @@ export type StorageAccessType = { signedKeyRotationRejected: number; lastHeartbeat: never; lastStartup: never; + sendEditWarningShown: never; + formattingWarningShown: never; }; export type StorageInterface = { diff --git a/ts/types/StorageUIKeys.ts b/ts/types/StorageUIKeys.ts index 831202280578..7b3b3532e2a9 100644 --- a/ts/types/StorageUIKeys.ts +++ b/ts/types/StorageUIKeys.ts @@ -20,7 +20,6 @@ export const STORAGE_UI_KEYS: ReadonlyArray = [ 'customColors', 'defaultConversationColor', 'existingOnboardingStoryMessageIds', - 'formattingWarningShown', 'hasCompletedSafetyNumberOnboarding', 'hasCompletedUsernameLinkOnboarding', 'hide-menu-bar', @@ -34,7 +33,6 @@ export const STORAGE_UI_KEYS: ReadonlyArray = [ 'preferred-video-input-device', 'preferredLeftPaneWidth', 'preferredReactionEmoji', - 'sendEditWarningShown', 'sent-media-quality', 'showStickerPickerHint', 'showStickersIntroduction', diff --git a/ts/util/maybeBlockSendForEditWarningModal.ts b/ts/util/maybeBlockSendForEditWarningModal.ts deleted file mode 100644 index 6516f2987238..000000000000 --- a/ts/util/maybeBlockSendForEditWarningModal.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2023 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import { explodePromise } from './explodePromise'; - -export async function maybeBlockSendForEditWarningModal(): Promise { - const explodedPromise = explodePromise(); - window.reduxActions.globalModals.showSendEditWarningModal(explodedPromise); - return explodedPromise.promise; -} diff --git a/ts/util/maybeBlockSendForFormattingModal.ts b/ts/util/maybeBlockSendForFormattingModal.ts deleted file mode 100644 index 79e340acaade..000000000000 --- a/ts/util/maybeBlockSendForFormattingModal.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2022 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import { explodePromise } from './explodePromise'; - -export async function maybeBlockSendForFormattingModal(): Promise { - const explodedPromise = explodePromise(); - window.reduxActions.globalModals.showFormattingWarningModal(explodedPromise); - return explodedPromise.promise; -}