Remove edit message/formatting onboarding

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Fedor Indutny 2024-04-29 20:05:44 +02:00 committed by GitHub
parent d64f77627c
commit bef5fd6b34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 33 additions and 319 deletions

View file

@ -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 doesnt support formatted text. They will not be able to see the formatting changes youve 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?",

View file

@ -867,17 +867,6 @@ export async function startApp(): Promise<void> {
});
}
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<void> {
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(

View file

@ -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 (
<ConfirmationDialog
actions={[
{
action: onSendAnyway,
autoClose: true,
style: 'affirmative',
text: i18n('icu:sendAnyway'),
},
]}
dialogName="FormattingWarningModal"
i18n={i18n}
onCancel={onCancel}
onClose={onCancel}
title={i18n('icu:SendFormatting--dialog--title')}
>
{i18n('icu:SendFormatting--dialog--body')}
</ConfirmationDialog>
);
}

View file

@ -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<boolean> | 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<boolean> | 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 (
<FormattingWarningModal
i18n={i18n}
onSendAnyway={() => {
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 (
<SendEditWarningModal
i18n={i18n}
onSendAnyway={() => {
showSendEditWarningModal(undefined);
resolve(true);
}}
onCancel={() => {
showSendEditWarningModal(undefined);
resolve(false);
}}
/>
);
}
if (isShortcutGuideModalVisible) {
return renderShortcutGuideModal();
}

View file

@ -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 (
<ConfirmationDialog
actions={[
{
action: onSendAnyway,
autoClose: true,
style: 'affirmative',
text: i18n('icu:sendAnyway'),
},
]}
dialogName="SendEditWarningModal"
i18n={i18n}
onCancel={onCancel}
onClose={onCancel}
title={i18n('icu:SendEdit--dialog--title2')}
>
{i18n('icu:SendEdit--dialog--body2')}
</ConfirmationDialog>
);
}

View file

@ -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,11 +491,7 @@ function sendEditedMessage(
targetMessageId,
} = options;
await withPreSendChecks(
conversationId,
{ ...options, isEditedMessage: true },
dispatch,
async () => {
await withPreSendChecks(conversationId, options, dispatch, async () => {
try {
await doSendEditedMessage(conversationId, {
body: message,
@ -559,14 +512,14 @@ function sendEditedMessage(
});
}
}
}
);
});
};
}
function sendMultiMediaMessage(
conversationId: string,
options: WithPreSendChecksOptions & {
bodyRanges?: DraftBodyRanges;
draftAttachments?: ReadonlyArray<AttachmentDraftType>;
timestamp?: number;
}

View file

@ -73,12 +73,6 @@ export type SafetyNumberChangedBlockingDataType = ReadonlyDeep<{
promiseUuid: SingleServePromise.SingleServePromiseIdString;
source?: SafetyNumberChangeSource;
}>;
export type FormattingWarningDataType = ReadonlyDeep<{
explodedPromise: ExplodePromiseResultType<boolean>;
}>;
export type SendEditWarningDataType = ReadonlyDeep<{
explodedPromise: ExplodePromiseResultType<boolean>;
}>;
export type AuthorizeArtCreatorDataType =
ReadonlyDeep<AuthorizeArtCreatorOptionsType>;
@ -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<boolean> | undefined;
};
}>;
type ShowSendEditWarningModalActionType = ReadonlyDeep<{
type: typeof SHOW_SEND_EDIT_WARNING_MODAL;
payload: {
explodedPromise: ExplodePromiseResultType<boolean> | 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<boolean> | undefined
): ShowFormattingWarningModalActionType {
return { type: SHOW_FORMATTING_WARNING_MODAL, payload: { explodedPromise } };
}
function showSendEditWarningModal(
explodedPromise: ExplodePromiseResultType<boolean> | undefined
): ShowSendEditWarningModalActionType {
return { type: SHOW_SEND_EDIT_WARNING_MODAL, payload: { explodedPromise } };
}
function showGV2MigrationDialog(
conversationId: string
): ThunkAction<void, RootStateType, unknown, StartMigrationToGV2ActionType> {
@ -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,

View file

@ -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}

View file

@ -67,7 +67,6 @@ export type StorageAccessType = {
customColors: CustomColorsItemType;
device_name: string;
existingOnboardingStoryMessageIds: ReadonlyArray<string> | undefined;
formattingWarningShown: boolean;
hasRegisterSupportForUnauthenticatedDelivery: boolean;
hasSetMyStoriesPrivacy: boolean;
hasCompletedUsernameOnboarding: boolean;
@ -92,7 +91,6 @@ export type StorageAccessType = {
regionCode: string;
registrationIdMap: Record<ServiceIdString, number>;
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 = {

View file

@ -20,7 +20,6 @@ export const STORAGE_UI_KEYS: ReadonlyArray<keyof StorageAccessType> = [
'customColors',
'defaultConversationColor',
'existingOnboardingStoryMessageIds',
'formattingWarningShown',
'hasCompletedSafetyNumberOnboarding',
'hasCompletedUsernameLinkOnboarding',
'hide-menu-bar',
@ -34,7 +33,6 @@ export const STORAGE_UI_KEYS: ReadonlyArray<keyof StorageAccessType> = [
'preferred-video-input-device',
'preferredLeftPaneWidth',
'preferredReactionEmoji',
'sendEditWarningShown',
'sent-media-quality',
'showStickerPickerHint',
'showStickersIntroduction',

View file

@ -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<boolean> {
const explodedPromise = explodePromise<boolean>();
window.reduxActions.globalModals.showSendEditWarningModal(explodedPromise);
return explodedPromise.promise;
}

View file

@ -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<boolean> {
const explodedPromise = explodePromise<boolean>();
window.reduxActions.globalModals.showFormattingWarningModal(explodedPromise);
return explodedPromise.promise;
}