Skip to content

Commit

Permalink
Remove edit message/formatting onboarding
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Nonnenberg <scott@signal.org>
  • Loading branch information
indutny-signal and scottnonnenberg-signal committed Apr 29, 2024
1 parent d64f776 commit bef5fd6
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 319 deletions.
8 changes: 4 additions & 4 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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?",
Expand Down
16 changes: 5 additions & 11 deletions ts/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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(
Expand Down
38 changes: 0 additions & 38 deletions ts/components/FormattingWarningModal.tsx

This file was deleted.

55 changes: 0 additions & 55 deletions ts/components/GlobalModalContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -138,9 +123,6 @@ export function GlobalModalContainer({
// DeleteMessageModal
deleteMessagesProps,
renderDeleteMessagesModal,
// FormattingWarningModal
showFormattingWarningModal,
formattingWarningData,
// ForwardMessageModal
forwardMessagesProps,
renderForwardMessagesModal,
Expand All @@ -156,9 +138,6 @@ export function GlobalModalContainer({
// SafetyNumberModal
safetyNumberModalContactId,
renderSafetyNumber,
// SendEditWarningDataType
showSendEditWarningModal,
sendEditWarningData,
// ShortcutGuideModal
isShortcutGuideModalVisible,
renderShortcutGuideModal,
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down
38 changes: 0 additions & 38 deletions ts/components/SendEditWarningModal.tsx

This file was deleted.

91 changes: 22 additions & 69 deletions ts/state/ducks/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}>;

Expand All @@ -416,7 +411,7 @@ async function withPreSendChecks(
conversation.attributes,
]);

const { bodyRanges, isEditedMessage, message, voiceNoteAttachment } = options;
const { message, voiceNoteAttachment } = options;

try {
dispatch(setComposerDisabledState(conversationId, true));
Expand All @@ -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({
Expand Down Expand Up @@ -510,6 +466,7 @@ async function withPreSendChecks(
function sendEditedMessage(
conversationId: string,
options: WithPreSendChecksOptions & {
bodyRanges?: DraftBodyRanges;
targetMessageId: string;
quoteAuthorAci?: AciString;
quoteSentAt?: number;
Expand All @@ -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<AttachmentDraftType>;
timestamp?: number;
}
Expand Down

0 comments on commit bef5fd6

Please sign in to comment.