Cleanup RemoteConfig
This commit is contained in:
parent
7bad05f5a0
commit
b2a3605d77
53 changed files with 121 additions and 614 deletions
|
@ -73,7 +73,6 @@ const createProps = (storyProps: Partial<PropsType> = {}): PropsType => ({
|
|||
getPresentingSources: action('get-presenting-sources'),
|
||||
hangUpActiveCall: action('hang-up-active-call'),
|
||||
i18n,
|
||||
isGroupCallOutboundRingEnabled: true,
|
||||
isGroupCallRaiseHandEnabled: true,
|
||||
isGroupCallReactionsEnabled: true,
|
||||
keyChangeOk: action('key-change-ok'),
|
||||
|
|
|
@ -87,7 +87,6 @@ export type PropsType = {
|
|||
bounceAppIconStop: () => unknown;
|
||||
declineCall: (_: DeclineCallType) => void;
|
||||
i18n: LocalizerType;
|
||||
isGroupCallOutboundRingEnabled: boolean;
|
||||
isGroupCallRaiseHandEnabled: boolean;
|
||||
isGroupCallReactionsEnabled: boolean;
|
||||
me: ConversationType;
|
||||
|
@ -132,7 +131,6 @@ function ActiveCallManager({
|
|||
closeNeedPermissionScreen,
|
||||
hangUpActiveCall,
|
||||
i18n,
|
||||
isGroupCallOutboundRingEnabled,
|
||||
isGroupCallRaiseHandEnabled,
|
||||
isGroupCallReactionsEnabled,
|
||||
keyChangeOk,
|
||||
|
@ -271,7 +269,6 @@ function ActiveCallManager({
|
|||
hasLocalVideo={hasLocalVideo}
|
||||
i18n={i18n}
|
||||
isGroupCall={activeCall.callMode === CallMode.Group}
|
||||
isGroupCallOutboundRingEnabled={isGroupCallOutboundRingEnabled}
|
||||
isCallFull={isCallFull}
|
||||
isConversationTooBigToRing={isConvoTooBigToRing}
|
||||
me={me}
|
||||
|
|
|
@ -51,7 +51,6 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => {
|
|||
hasLocalVideo: overrideProps.hasLocalVideo ?? false,
|
||||
i18n,
|
||||
isGroupCall,
|
||||
isGroupCallOutboundRingEnabled: true,
|
||||
isConversationTooBigToRing: false,
|
||||
isCallFull: overrideProps.isCallFull ?? false,
|
||||
me:
|
||||
|
|
|
@ -49,7 +49,6 @@ export type PropsType = {
|
|||
i18n: LocalizerType;
|
||||
isConversationTooBigToRing: boolean;
|
||||
isGroupCall: boolean;
|
||||
isGroupCallOutboundRingEnabled: boolean;
|
||||
isCallFull?: boolean;
|
||||
me: Readonly<
|
||||
Pick<ConversationType, 'avatarPath' | 'color' | 'id' | 'serviceId'>
|
||||
|
@ -75,7 +74,6 @@ export function CallingLobby({
|
|||
hasLocalVideo,
|
||||
i18n,
|
||||
isGroupCall = false,
|
||||
isGroupCallOutboundRingEnabled,
|
||||
isCallFull = false,
|
||||
isConversationTooBigToRing,
|
||||
me,
|
||||
|
@ -157,7 +155,6 @@ export function CallingLobby({
|
|||
|
||||
const isRingButtonVisible: boolean =
|
||||
isGroupCall &&
|
||||
isGroupCallOutboundRingEnabled &&
|
||||
peekedParticipants.length === 0 &&
|
||||
(groupMembers || []).length > 1;
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ export default {
|
|||
options: Object.keys(RecordingState),
|
||||
mappings: RecordingState,
|
||||
},
|
||||
messageRequestsEnabled: { control: { type: 'boolean' } },
|
||||
announcementsOnly: { control: { type: 'boolean' } },
|
||||
areWePendingApproval: { control: { type: 'boolean' } },
|
||||
},
|
||||
|
@ -45,8 +44,6 @@ export default {
|
|||
sendCounter: 0,
|
||||
i18n,
|
||||
isDisabled: false,
|
||||
isFormattingFlagEnabled: true,
|
||||
isFormattingSpoilersFlagEnabled: true,
|
||||
isFormattingEnabled: true,
|
||||
messageCompositionId: '456',
|
||||
sendEditedMessage: action('sendEditedMessage'),
|
||||
|
@ -111,7 +108,6 @@ export default {
|
|||
blockConversation: action('blockConversation'),
|
||||
blockAndReportSpam: action('blockAndReportSpam'),
|
||||
deleteConversation: action('deleteConversation'),
|
||||
messageRequestsEnabled: false,
|
||||
title: '',
|
||||
// GroupV1 Disabled Actions
|
||||
showGV2MigrationDialog: action('showGV2MigrationDialog'),
|
||||
|
@ -164,7 +160,7 @@ export function StickerButton(args: Props): JSX.Element {
|
|||
|
||||
export function MessageRequest(args: Props): JSX.Element {
|
||||
const theme = useContext(StorybookThemeContext);
|
||||
return <CompositionArea {...args} theme={theme} messageRequestsEnabled />;
|
||||
return <CompositionArea {...args} theme={theme} />;
|
||||
}
|
||||
|
||||
export function SmsOnlyFetchingUuid(args: Props): JSX.Element {
|
||||
|
@ -260,21 +256,3 @@ export function NoFormattingMenu(args: Props): JSX.Element {
|
|||
<CompositionArea {...args} theme={theme} isFormattingEnabled={false} />
|
||||
);
|
||||
}
|
||||
|
||||
export function NoFormattingFlag(args: Props): JSX.Element {
|
||||
const theme = useContext(StorybookThemeContext);
|
||||
return (
|
||||
<CompositionArea {...args} theme={theme} isFormattingFlagEnabled={false} />
|
||||
);
|
||||
}
|
||||
|
||||
export function NoSpoilerFormattingFlag(args: Props): JSX.Element {
|
||||
const theme = useContext(StorybookThemeContext);
|
||||
return (
|
||||
<CompositionArea
|
||||
{...args}
|
||||
theme={theme}
|
||||
isFormattingSpoilersFlagEnabled={false}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -105,8 +105,6 @@ export type OwnProps = Readonly<{
|
|||
isDisabled: boolean;
|
||||
isFetchingUUID?: boolean;
|
||||
isFormattingEnabled: boolean;
|
||||
isFormattingFlagEnabled: boolean;
|
||||
isFormattingSpoilersFlagEnabled: boolean;
|
||||
isGroupV1AndDisabled?: boolean;
|
||||
isMissingMandatoryProfileSharing?: boolean;
|
||||
isSignalConversation?: boolean;
|
||||
|
@ -118,7 +116,6 @@ export type OwnProps = Readonly<{
|
|||
left?: boolean;
|
||||
linkPreviewLoading: boolean;
|
||||
linkPreviewResult?: LinkPreviewType;
|
||||
messageRequestsEnabled?: boolean;
|
||||
onClearAttachments(conversationId: string): unknown;
|
||||
onCloseLinkPreview(conversationId: string): unknown;
|
||||
platform: string;
|
||||
|
@ -276,8 +273,6 @@ export function CompositionArea({
|
|||
getPreferredBadge,
|
||||
getQuotedMessage,
|
||||
isFormattingEnabled,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
onEditorStateChange,
|
||||
onTextTooLong,
|
||||
sendCounter,
|
||||
|
@ -308,7 +303,6 @@ export function CompositionArea({
|
|||
isBlocked,
|
||||
isMissingMandatoryProfileSharing,
|
||||
left,
|
||||
messageRequestsEnabled,
|
||||
removalStage,
|
||||
acceptConversation,
|
||||
blockConversation,
|
||||
|
@ -736,9 +730,7 @@ export function CompositionArea({
|
|||
if (
|
||||
isBlocked ||
|
||||
areWePending ||
|
||||
(messageRequestsEnabled &&
|
||||
!acceptedMessageRequest &&
|
||||
removalStage !== 'justNotification')
|
||||
(!acceptedMessageRequest && removalStage !== 'justNotification')
|
||||
) {
|
||||
return (
|
||||
<MessageRequestActions
|
||||
|
@ -867,8 +859,6 @@ export function CompositionArea({
|
|||
imageToBlurHash={imageToBlurHash}
|
||||
installedPacks={installedPacks}
|
||||
isFormattingEnabled={isFormattingEnabled}
|
||||
isFormattingFlagEnabled={isFormattingFlagEnabled}
|
||||
isFormattingSpoilersFlagEnabled={isFormattingSpoilersFlagEnabled}
|
||||
isSending={false}
|
||||
onClose={() => setAttachmentToEdit(undefined)}
|
||||
onDone={({
|
||||
|
@ -992,8 +982,6 @@ export function CompositionArea({
|
|||
i18n={i18n}
|
||||
inputApi={inputApiRef}
|
||||
isFormattingEnabled={isFormattingEnabled}
|
||||
isFormattingFlagEnabled={isFormattingFlagEnabled}
|
||||
isFormattingSpoilersFlagEnabled={isFormattingSpoilersFlagEnabled}
|
||||
large={large}
|
||||
linkPreviewLoading={linkPreviewLoading}
|
||||
linkPreviewResult={linkPreviewResult}
|
||||
|
|
|
@ -29,14 +29,6 @@ const useProps = (overrideProps: Partial<Props> = {}): Props => ({
|
|||
clearQuotedMessage: action('clearQuotedMessage'),
|
||||
getPreferredBadge: () => undefined,
|
||||
getQuotedMessage: action('getQuotedMessage'),
|
||||
isFormattingFlagEnabled:
|
||||
overrideProps.isFormattingFlagEnabled === false
|
||||
? overrideProps.isFormattingFlagEnabled
|
||||
: true,
|
||||
isFormattingSpoilersFlagEnabled:
|
||||
overrideProps.isFormattingSpoilersFlagEnabled === false
|
||||
? overrideProps.isFormattingSpoilersFlagEnabled
|
||||
: true,
|
||||
isFormattingEnabled:
|
||||
overrideProps.isFormattingEnabled === false
|
||||
? overrideProps.isFormattingEnabled
|
||||
|
@ -140,15 +132,3 @@ export function Mentions(): JSX.Element {
|
|||
export function NoFormattingMenu(): JSX.Element {
|
||||
return <CompositionInput {...useProps({ isFormattingEnabled: false })} />;
|
||||
}
|
||||
|
||||
export function NoFormattingFlag(): JSX.Element {
|
||||
return <CompositionInput {...useProps({ isFormattingFlagEnabled: false })} />;
|
||||
}
|
||||
|
||||
export function NoSpoilerFormattingFlag(): JSX.Element {
|
||||
return (
|
||||
<CompositionInput
|
||||
{...useProps({ isFormattingSpoilersFlagEnabled: false })}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -100,8 +100,6 @@ export type Props = Readonly<{
|
|||
large?: boolean;
|
||||
inputApi?: React.MutableRefObject<InputApi | undefined>;
|
||||
isFormattingEnabled: boolean;
|
||||
isFormattingFlagEnabled: boolean;
|
||||
isFormattingSpoilersFlagEnabled: boolean;
|
||||
sendCounter: number;
|
||||
skinTone?: EmojiPickDataType['skinTone'];
|
||||
draftText?: string;
|
||||
|
@ -155,8 +153,6 @@ export function CompositionInput(props: Props): React.ReactElement {
|
|||
i18n,
|
||||
inputApi,
|
||||
isFormattingEnabled,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
large,
|
||||
linkPreviewLoading,
|
||||
linkPreviewResult,
|
||||
|
@ -250,15 +246,6 @@ export function CompositionInput(props: Props): React.ReactElement {
|
|||
return true;
|
||||
}
|
||||
if (BodyRange.isFormatting(range)) {
|
||||
if (!isFormattingFlagEnabled) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
range.style === BodyRange.Style.SPOILER &&
|
||||
!isFormattingSpoilersFlagEnabled
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
throw missingCaseError(range);
|
||||
|
@ -395,54 +382,27 @@ export function CompositionInput(props: Props): React.ReactElement {
|
|||
isFormattingEnabled,
|
||||
isFormattingEnabled
|
||||
);
|
||||
const previousFormattingFlagEnabled = usePrevious(
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingFlagEnabled
|
||||
);
|
||||
const previousFormattingSpoilersFlagEnabled = usePrevious(
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled
|
||||
);
|
||||
const previousIsMouseDown = usePrevious(isMouseDown, isMouseDown);
|
||||
|
||||
React.useEffect(() => {
|
||||
const formattingChanged =
|
||||
typeof previousFormattingEnabled === 'boolean' &&
|
||||
previousFormattingEnabled !== isFormattingEnabled;
|
||||
const flagChanged =
|
||||
typeof previousFormattingFlagEnabled === 'boolean' &&
|
||||
previousFormattingFlagEnabled !== isFormattingFlagEnabled;
|
||||
const spoilersFlagChanged =
|
||||
typeof previousFormattingSpoilersFlagEnabled === 'boolean' &&
|
||||
previousFormattingSpoilersFlagEnabled !== isFormattingSpoilersFlagEnabled;
|
||||
const mouseDownChanged = previousIsMouseDown !== isMouseDown;
|
||||
|
||||
const quill = quillRef.current;
|
||||
const changed =
|
||||
formattingChanged ||
|
||||
flagChanged ||
|
||||
spoilersFlagChanged ||
|
||||
mouseDownChanged;
|
||||
const changed = formattingChanged || mouseDownChanged;
|
||||
if (quill && changed) {
|
||||
quill.getModule('formattingMenu').updateOptions({
|
||||
isMenuEnabled: isFormattingEnabled,
|
||||
isMouseDown,
|
||||
isEnabled: isFormattingFlagEnabled,
|
||||
isSpoilersEnabled: isFormattingSpoilersFlagEnabled,
|
||||
});
|
||||
quill.options.formats = getQuillFormats({
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
});
|
||||
quill.options.formats = getQuillFormats();
|
||||
}
|
||||
}, [
|
||||
isFormattingEnabled,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
isMouseDown,
|
||||
previousFormattingEnabled,
|
||||
previousFormattingFlagEnabled,
|
||||
previousFormattingSpoilersFlagEnabled,
|
||||
previousIsMouseDown,
|
||||
quillRef,
|
||||
]);
|
||||
|
@ -772,8 +732,6 @@ export function CompositionInput(props: Props): React.ReactElement {
|
|||
formattingMenu: {
|
||||
i18n,
|
||||
isMenuEnabled: isFormattingEnabled,
|
||||
isEnabled: isFormattingFlagEnabled,
|
||||
isSpoilersEnabled: isFormattingSpoilersFlagEnabled,
|
||||
platform,
|
||||
setFormattingChooserElement,
|
||||
},
|
||||
|
@ -788,10 +746,7 @@ export function CompositionInput(props: Props): React.ReactElement {
|
|||
theme,
|
||||
},
|
||||
}}
|
||||
formats={getQuillFormats({
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
})}
|
||||
formats={getQuillFormats()}
|
||||
placeholder={placeholder || i18n('icu:sendMessage')}
|
||||
readOnly={disabled}
|
||||
ref={element => {
|
||||
|
@ -951,30 +906,17 @@ export function CompositionInput(props: Props): React.ReactElement {
|
|||
);
|
||||
}
|
||||
|
||||
function getQuillFormats({
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
}: {
|
||||
isFormattingFlagEnabled: boolean;
|
||||
isFormattingSpoilersFlagEnabled: boolean;
|
||||
}): Array<string> {
|
||||
function getQuillFormats(): Array<string> {
|
||||
return [
|
||||
// For image replacement (local-only)
|
||||
'emoji',
|
||||
// @mentions
|
||||
'mention',
|
||||
...(isFormattingFlagEnabled
|
||||
? [
|
||||
// Custom
|
||||
...(isFormattingSpoilersFlagEnabled
|
||||
? [QuillFormattingStyle.spoiler]
|
||||
: []),
|
||||
QuillFormattingStyle.monospace,
|
||||
// Built-in
|
||||
QuillFormattingStyle.bold,
|
||||
QuillFormattingStyle.italic,
|
||||
QuillFormattingStyle.strike,
|
||||
]
|
||||
: []),
|
||||
QuillFormattingStyle.spoiler,
|
||||
QuillFormattingStyle.monospace,
|
||||
// Built-in
|
||||
QuillFormattingStyle.bold,
|
||||
QuillFormattingStyle.italic,
|
||||
QuillFormattingStyle.strike,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ export type CompositionTextAreaProps = {
|
|||
bodyRanges?: HydratedBodyRangesType;
|
||||
i18n: LocalizerType;
|
||||
isFormattingEnabled: boolean;
|
||||
isFormattingFlagEnabled: boolean;
|
||||
isFormattingSpoilersFlagEnabled: boolean;
|
||||
maxLength?: number;
|
||||
placeholder?: string;
|
||||
whenToShowRemainingCount?: number;
|
||||
|
@ -61,8 +59,6 @@ export function CompositionTextArea({
|
|||
getPreferredBadge,
|
||||
i18n,
|
||||
isFormattingEnabled,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
maxLength,
|
||||
onChange,
|
||||
onPickEmoji,
|
||||
|
@ -144,8 +140,6 @@ export function CompositionTextArea({
|
|||
getQuotedMessage={noop}
|
||||
i18n={i18n}
|
||||
isFormattingEnabled={isFormattingEnabled}
|
||||
isFormattingFlagEnabled={isFormattingFlagEnabled}
|
||||
isFormattingSpoilersFlagEnabled={isFormattingSpoilersFlagEnabled}
|
||||
inputApi={inputApiRef}
|
||||
large
|
||||
moduleClassName="CompositionTextArea__input"
|
||||
|
|
|
@ -59,8 +59,6 @@ const useProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
|
|||
getPreferredBadge={() => undefined}
|
||||
i18n={i18n}
|
||||
isFormattingEnabled
|
||||
isFormattingFlagEnabled
|
||||
isFormattingSpoilersFlagEnabled
|
||||
onPickEmoji={action('onPickEmoji')}
|
||||
onSetSkinTone={action('onSetSkinTone')}
|
||||
onTextTooLong={action('onTextTooLong')}
|
||||
|
|
|
@ -27,8 +27,6 @@ export default {
|
|||
imageSrc: IMAGE_2,
|
||||
installedPacks,
|
||||
isFormattingEnabled: true,
|
||||
isFormattingFlagEnabled: true,
|
||||
isFormattingSpoilersFlagEnabled: true,
|
||||
isSending: false,
|
||||
onClose: action('onClose'),
|
||||
onDone: action('onDone'),
|
||||
|
|
|
@ -86,8 +86,6 @@ export type PropsType = {
|
|||
| 'draftBodyRanges'
|
||||
| 'getPreferredBadge'
|
||||
| 'isFormattingEnabled'
|
||||
| 'isFormattingFlagEnabled'
|
||||
| 'isFormattingSpoilersFlagEnabled'
|
||||
| 'onPickEmoji'
|
||||
| 'onTextTooLong'
|
||||
| 'platform'
|
||||
|
@ -156,8 +154,6 @@ export function MediaEditor({
|
|||
draftBodyRanges,
|
||||
getPreferredBadge,
|
||||
isFormattingEnabled,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
onPickEmoji,
|
||||
onTextTooLong,
|
||||
platform,
|
||||
|
@ -1306,10 +1302,6 @@ export function MediaEditor({
|
|||
i18n={i18n}
|
||||
inputApi={inputApiRef}
|
||||
isFormattingEnabled={isFormattingEnabled}
|
||||
isFormattingFlagEnabled={isFormattingFlagEnabled}
|
||||
isFormattingSpoilersFlagEnabled={
|
||||
isFormattingSpoilersFlagEnabled
|
||||
}
|
||||
moduleClassName="StoryViewsNRepliesModal__input"
|
||||
onCloseLinkPreview={noop}
|
||||
onEditorStateChange={({ bodyRanges, messageText }) => {
|
||||
|
|
|
@ -101,7 +101,6 @@ export default {
|
|||
initialSpellCheckSetting: true,
|
||||
isAutoDownloadUpdatesSupported: true,
|
||||
isAutoLaunchSupported: true,
|
||||
isFormattingFlagEnabled: true,
|
||||
isHideMenuBarSupported: true,
|
||||
isNotificationAttentionSupported: true,
|
||||
isPhoneNumberSharingSupported: true,
|
||||
|
@ -117,7 +116,6 @@ export default {
|
|||
'dfbe6effe70b0611ba0fdc2a9ea3f39f6cb110e6687948f7e5f016c111b7329c',
|
||||
selectedMicrophone: availableMicrophones[0],
|
||||
selectedSpeaker: availableSpeakers[1],
|
||||
shouldShowStoriesSettings: true,
|
||||
sentMediaQualitySetting: 'standard',
|
||||
themeSetting: 'system',
|
||||
universalExpireTimer: DurationInSeconds.HOUR,
|
||||
|
@ -216,8 +214,3 @@ PNPDiscoverabilityDisabled.args = {
|
|||
whoCanFindMe: PhoneNumberDiscoverability.NotDiscoverable,
|
||||
isPhoneNumberSharingSupported: true,
|
||||
};
|
||||
|
||||
export const FormattingDisabled = Template.bind({});
|
||||
FormattingDisabled.args = {
|
||||
isFormattingFlagEnabled: false,
|
||||
};
|
||||
|
|
|
@ -117,10 +117,6 @@ export type PropsDataType = {
|
|||
// Other props
|
||||
hasCustomTitleBar: boolean;
|
||||
initialSpellCheckSetting: boolean;
|
||||
shouldShowStoriesSettings: boolean;
|
||||
|
||||
// Feature flags
|
||||
isFormattingFlagEnabled: boolean;
|
||||
|
||||
// Limited support features
|
||||
isAutoDownloadUpdatesSupported: boolean;
|
||||
|
@ -286,7 +282,6 @@ export function Preferences({
|
|||
initialSpellCheckSetting,
|
||||
isAutoDownloadUpdatesSupported,
|
||||
isAutoLaunchSupported,
|
||||
isFormattingFlagEnabled,
|
||||
isHideMenuBarSupported,
|
||||
isPhoneNumberSharingSupported,
|
||||
isNotificationAttentionSupported,
|
||||
|
@ -339,7 +334,6 @@ export function Preferences({
|
|||
selectedSpeaker,
|
||||
sentMediaQualitySetting,
|
||||
setGlobalDefaultConversationColor,
|
||||
shouldShowStoriesSettings,
|
||||
localeOverride,
|
||||
themeSetting,
|
||||
universalExpireTimer = DurationInSeconds.ZERO,
|
||||
|
@ -846,15 +840,13 @@ export function Preferences({
|
|||
name="spellcheck"
|
||||
onChange={onSpellCheckChange}
|
||||
/>
|
||||
{isFormattingFlagEnabled && (
|
||||
<Checkbox
|
||||
checked={hasTextFormatting}
|
||||
label={i18n('icu:textFormattingDescription')}
|
||||
moduleClassName="Preferences__checkbox"
|
||||
name="textFormatting"
|
||||
onChange={onTextFormattingChange}
|
||||
/>
|
||||
)}
|
||||
<Checkbox
|
||||
checked={hasTextFormatting}
|
||||
label={i18n('icu:textFormattingDescription')}
|
||||
moduleClassName="Preferences__checkbox"
|
||||
name="textFormatting"
|
||||
onChange={onTextFormattingChange}
|
||||
/>
|
||||
<Checkbox
|
||||
checked={hasLinkPreviews}
|
||||
description={i18n('icu:Preferences__link-previews--description')}
|
||||
|
@ -1287,38 +1279,36 @@ export function Preferences({
|
|||
}
|
||||
/>
|
||||
</SettingsRow>
|
||||
{shouldShowStoriesSettings && (
|
||||
<SettingsRow title={i18n('icu:Stories__title')}>
|
||||
<Control
|
||||
left={
|
||||
<label htmlFor={storiesId}>
|
||||
<div>{i18n('icu:Stories__settings-toggle--title')}</div>
|
||||
<div className="Preferences__description">
|
||||
{i18n('icu:Stories__settings-toggle--description')}
|
||||
</div>
|
||||
</label>
|
||||
}
|
||||
right={
|
||||
hasStoriesDisabled ? (
|
||||
<Button
|
||||
onClick={() => onHasStoriesDisabledChanged(false)}
|
||||
variant={ButtonVariant.Secondary}
|
||||
>
|
||||
{i18n('icu:Preferences__turn-stories-on')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
className="Preferences__stories-off"
|
||||
onClick={() => setConfirmStoriesOff(true)}
|
||||
variant={ButtonVariant.SecondaryDestructive}
|
||||
>
|
||||
{i18n('icu:Preferences__turn-stories-off')}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</SettingsRow>
|
||||
)}
|
||||
<SettingsRow title={i18n('icu:Stories__title')}>
|
||||
<Control
|
||||
left={
|
||||
<label htmlFor={storiesId}>
|
||||
<div>{i18n('icu:Stories__settings-toggle--title')}</div>
|
||||
<div className="Preferences__description">
|
||||
{i18n('icu:Stories__settings-toggle--description')}
|
||||
</div>
|
||||
</label>
|
||||
}
|
||||
right={
|
||||
hasStoriesDisabled ? (
|
||||
<Button
|
||||
onClick={() => onHasStoriesDisabledChanged(false)}
|
||||
variant={ButtonVariant.Secondary}
|
||||
>
|
||||
{i18n('icu:Preferences__turn-stories-on')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
className="Preferences__stories-off"
|
||||
onClick={() => setConfirmStoriesOff(true)}
|
||||
variant={ButtonVariant.SecondaryDestructive}
|
||||
>
|
||||
{i18n('icu:Preferences__turn-stories-off')}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow>
|
||||
<Control
|
||||
left={
|
||||
|
|
|
@ -18,14 +18,6 @@ export default {
|
|||
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
||||
i18n,
|
||||
close: action('close'),
|
||||
isFormattingFlagEnabled:
|
||||
overrideProps.isFormattingFlagEnabled === false
|
||||
? overrideProps.isFormattingFlagEnabled
|
||||
: true,
|
||||
isFormattingSpoilersFlagEnabled:
|
||||
overrideProps.isFormattingSpoilersFlagEnabled === false
|
||||
? overrideProps.isFormattingSpoilersFlagEnabled
|
||||
: true,
|
||||
hasInstalledStickers: overrideProps.hasInstalledStickers === true || false,
|
||||
platform: overrideProps.platform || 'other',
|
||||
});
|
||||
|
@ -44,13 +36,3 @@ export function HasStickers(): JSX.Element {
|
|||
const props = createProps({ hasInstalledStickers: true });
|
||||
return <ShortcutGuide {...props} />;
|
||||
}
|
||||
|
||||
export function NoFormatting(): JSX.Element {
|
||||
const props = createProps({ isFormattingFlagEnabled: false });
|
||||
return <ShortcutGuide {...props} />;
|
||||
}
|
||||
|
||||
export function NoSpoilerFormatting(): JSX.Element {
|
||||
const props = createProps({ isFormattingSpoilersFlagEnabled: false });
|
||||
return <ShortcutGuide {...props} />;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ import type { LocalizerType } from '../types/Util';
|
|||
|
||||
export type Props = {
|
||||
hasInstalledStickers: boolean;
|
||||
isFormattingFlagEnabled: boolean;
|
||||
isFormattingSpoilersFlagEnabled: boolean;
|
||||
platform: string;
|
||||
readonly close: () => unknown;
|
||||
readonly i18n: LocalizerType;
|
||||
|
@ -239,11 +237,7 @@ function getMessageShortcuts(i18n: LocalizerType): Array<ShortcutType> {
|
|||
];
|
||||
}
|
||||
|
||||
function getComposerShortcuts(
|
||||
i18n: LocalizerType,
|
||||
isFormattingFlagEnabled: boolean,
|
||||
isFormattingSpoilersFlagEnabled: boolean
|
||||
): Array<ShortcutType> {
|
||||
function getComposerShortcuts(i18n: LocalizerType): Array<ShortcutType> {
|
||||
const shortcuts: Array<ShortcutType> = [
|
||||
{
|
||||
id: 'Keyboard--add-newline',
|
||||
|
@ -280,38 +274,32 @@ function getComposerShortcuts(
|
|||
description: i18n('icu:Keyboard--edit-last-message'),
|
||||
keys: [['↑']],
|
||||
},
|
||||
];
|
||||
|
||||
if (isFormattingFlagEnabled) {
|
||||
shortcuts.push({
|
||||
{
|
||||
id: 'Keyboard--composer--bold',
|
||||
description: i18n('icu:Keyboard--composer--bold'),
|
||||
keys: [['commandOrCtrl', 'B']],
|
||||
});
|
||||
shortcuts.push({
|
||||
},
|
||||
{
|
||||
id: 'Keyboard--composer--italic',
|
||||
description: i18n('icu:Keyboard--composer--italic'),
|
||||
keys: [['commandOrCtrl', 'I']],
|
||||
});
|
||||
shortcuts.push({
|
||||
},
|
||||
{
|
||||
id: 'Keyboard--composer--strikethrough',
|
||||
description: i18n('icu:Keyboard--composer--strikethrough'),
|
||||
keys: [['commandOrCtrl', 'shift', 'X']],
|
||||
});
|
||||
shortcuts.push({
|
||||
},
|
||||
{
|
||||
id: 'Keyboard--composer--monospace',
|
||||
description: i18n('icu:Keyboard--composer--monospace'),
|
||||
keys: [['commandOrCtrl', 'E']],
|
||||
});
|
||||
|
||||
if (isFormattingSpoilersFlagEnabled) {
|
||||
shortcuts.push({
|
||||
id: 'Keyboard--composer--spoiler',
|
||||
description: i18n('icu:Keyboard--composer--spoiler'),
|
||||
keys: [['commandOrCtrl', 'shift', 'B']],
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Keyboard--composer--spoiler',
|
||||
description: i18n('icu:Keyboard--composer--spoiler'),
|
||||
keys: [['commandOrCtrl', 'shift', 'B']],
|
||||
},
|
||||
];
|
||||
|
||||
return shortcuts;
|
||||
}
|
||||
|
@ -362,14 +350,7 @@ function getCallingShortcuts(i18n: LocalizerType): Array<ShortcutType> {
|
|||
}
|
||||
|
||||
export function ShortcutGuide(props: Props): JSX.Element {
|
||||
const {
|
||||
i18n,
|
||||
close,
|
||||
hasInstalledStickers,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
platform,
|
||||
} = props;
|
||||
const { i18n, close, hasInstalledStickers, platform } = props;
|
||||
const isMacOS = platform === 'darwin';
|
||||
|
||||
// Restore focus on teardown
|
||||
|
@ -427,11 +408,7 @@ export function ShortcutGuide(props: Props): JSX.Element {
|
|||
{i18n('icu:Keyboard--composer-header')}
|
||||
</div>
|
||||
<div className="module-shortcut-guide__section-list">
|
||||
{getComposerShortcuts(
|
||||
i18n,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled
|
||||
).map((shortcut, index) =>
|
||||
{getComposerShortcuts(i18n).map((shortcut, index) =>
|
||||
renderShortcut(shortcut, index, isMacOS, i18n)
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -8,8 +8,6 @@ import { ShortcutGuide } from './ShortcutGuide';
|
|||
|
||||
export type PropsType = {
|
||||
hasInstalledStickers: boolean;
|
||||
isFormattingFlagEnabled: boolean;
|
||||
isFormattingSpoilersFlagEnabled: boolean;
|
||||
platform: string;
|
||||
readonly closeShortcutGuideModal: () => unknown;
|
||||
readonly i18n: LocalizerType;
|
||||
|
@ -18,14 +16,8 @@ export type PropsType = {
|
|||
export const ShortcutGuideModal = React.memo(function ShortcutGuideModalInner(
|
||||
props: PropsType
|
||||
) {
|
||||
const {
|
||||
i18n,
|
||||
closeShortcutGuideModal,
|
||||
hasInstalledStickers,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
platform,
|
||||
} = props;
|
||||
const { i18n, closeShortcutGuideModal, hasInstalledStickers, platform } =
|
||||
props;
|
||||
const [root, setRoot] = React.useState<HTMLElement | null>(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
@ -45,8 +37,6 @@ export const ShortcutGuideModal = React.memo(function ShortcutGuideModalInner(
|
|||
<ShortcutGuide
|
||||
close={closeShortcutGuideModal}
|
||||
hasInstalledStickers={hasInstalledStickers}
|
||||
isFormattingFlagEnabled={isFormattingFlagEnabled}
|
||||
isFormattingSpoilersFlagEnabled={isFormattingSpoilersFlagEnabled}
|
||||
i18n={i18n}
|
||||
platform={platform}
|
||||
/>
|
||||
|
|
|
@ -96,12 +96,7 @@ export type PropsType = {
|
|||
> &
|
||||
Pick<
|
||||
MediaEditorPropsType,
|
||||
| 'isFormattingEnabled'
|
||||
| 'isFormattingFlagEnabled'
|
||||
| 'isFormattingSpoilersFlagEnabled'
|
||||
| 'onPickEmoji'
|
||||
| 'onTextTooLong'
|
||||
| 'platform'
|
||||
'isFormattingEnabled' | 'onPickEmoji' | 'onTextTooLong' | 'platform'
|
||||
>;
|
||||
|
||||
export function StoryCreator({
|
||||
|
@ -117,8 +112,6 @@ export function StoryCreator({
|
|||
imageToBlurHash,
|
||||
installedPacks,
|
||||
isFormattingEnabled,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
isSending,
|
||||
linkPreview,
|
||||
me,
|
||||
|
@ -254,8 +247,6 @@ export function StoryCreator({
|
|||
imageToBlurHash={imageToBlurHash}
|
||||
installedPacks={installedPacks}
|
||||
isFormattingEnabled={isFormattingEnabled}
|
||||
isFormattingFlagEnabled={isFormattingFlagEnabled}
|
||||
isFormattingSpoilersFlagEnabled={isFormattingSpoilersFlagEnabled}
|
||||
isSending={isSending}
|
||||
onClose={onClose}
|
||||
onDone={({
|
||||
|
|
|
@ -87,8 +87,6 @@ export type PropsType = {
|
|||
hasViewReceiptSetting: boolean;
|
||||
i18n: LocalizerType;
|
||||
isFormattingEnabled: boolean;
|
||||
isFormattingFlagEnabled: boolean;
|
||||
isFormattingSpoilersFlagEnabled: boolean;
|
||||
isInternalUser?: boolean;
|
||||
isSignalConversation?: boolean;
|
||||
isWindowActive: boolean;
|
||||
|
@ -150,8 +148,6 @@ export function StoryViewer({
|
|||
hasViewReceiptSetting,
|
||||
i18n,
|
||||
isFormattingEnabled,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
isInternalUser,
|
||||
isSignalConversation,
|
||||
isWindowActive,
|
||||
|
@ -946,8 +942,6 @@ export function StoryViewer({
|
|||
i18n={i18n}
|
||||
platform={platform}
|
||||
isFormattingEnabled={isFormattingEnabled}
|
||||
isFormattingFlagEnabled={isFormattingFlagEnabled}
|
||||
isFormattingSpoilersFlagEnabled={isFormattingSpoilersFlagEnabled}
|
||||
isInternalUser={isInternalUser}
|
||||
group={group}
|
||||
onClose={() => setCurrentViewTarget(null)}
|
||||
|
|
|
@ -91,8 +91,6 @@ export type PropsType = {
|
|||
i18n: LocalizerType;
|
||||
platform: string;
|
||||
isFormattingEnabled: boolean;
|
||||
isFormattingFlagEnabled: boolean;
|
||||
isFormattingSpoilersFlagEnabled: boolean;
|
||||
isInternalUser?: boolean;
|
||||
onChangeViewTarget: (target: StoryViewTargetType) => unknown;
|
||||
onClose: () => unknown;
|
||||
|
@ -128,8 +126,6 @@ export function StoryViewsNRepliesModal({
|
|||
i18n,
|
||||
platform,
|
||||
isFormattingEnabled,
|
||||
isFormattingFlagEnabled,
|
||||
isFormattingSpoilersFlagEnabled,
|
||||
isInternalUser,
|
||||
onChangeViewTarget,
|
||||
onClose,
|
||||
|
@ -241,8 +237,6 @@ export function StoryViewsNRepliesModal({
|
|||
i18n={i18n}
|
||||
inputApi={inputApiRef}
|
||||
isFormattingEnabled={isFormattingEnabled}
|
||||
isFormattingFlagEnabled={isFormattingFlagEnabled}
|
||||
isFormattingSpoilersFlagEnabled={isFormattingSpoilersFlagEnabled}
|
||||
moduleClassName="StoryViewsNRepliesModal__input"
|
||||
onCloseLinkPreview={noop}
|
||||
onEditorStateChange={({ messageText }) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue