From 95e40c95094bd2237e227dd0c399e2b574dec1fb Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 8 Dec 2021 17:44:24 +1100 Subject: [PATCH] keep read-receipts disabled by default (#2071) --- _locales/en/messages.json | 1 - ts/components/session/ActionsPanel.tsx | 40 +++---------------- .../settings/section/CategoryPrivacy.tsx | 2 +- ts/types/LocalizerKeys.ts | 3 +- ts/util/accountManager.ts | 5 +-- 5 files changed, 9 insertions(+), 42 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 182541cc9..ad32e9b07 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -156,7 +156,6 @@ "spellCheckDirty": "You must restart Session to apply your new settings", "notifications": "Notifications", "readReceiptSettingDescription": "See and share when messages have been read (enables read receipts in all sessions).", - "readReceiptDialogDescription": "Read Receipts are now turned ON by default. Click \"Cancel\" to turn them down.", "readReceiptSettingTitle": "Read Receipts", "typingIndicatorsSettingDescription": "See and share when messages are being typed (applies to all sessions).", "typingIndicatorsSettingTitle": "Typing Indicators", diff --git a/ts/components/session/ActionsPanel.tsx b/ts/components/session/ActionsPanel.tsx index ef7800b1a..7ad2f323b 100644 --- a/ts/components/session/ActionsPanel.tsx +++ b/ts/components/session/ActionsPanel.tsx @@ -1,4 +1,4 @@ -import React, { Dispatch, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { SessionIconButton } from './icon'; import { Avatar, AvatarSize } from '../Avatar'; import { SessionToastContainer } from './SessionToastContainer'; @@ -6,7 +6,6 @@ import { getConversationController } from '../../session/conversations'; import { syncConfigurationIfNeeded } from '../../session/utils/syncUtils'; import { - createOrUpdateItem, generateAttachmentKeyIfEmpty, getAllOpenGroupV1Conversations, getItemById, @@ -37,11 +36,7 @@ import { forceRefreshRandomSnodePool } from '../../session/snode_api/snodePool'; import { getSwarmPollingInstance } from '../../session/snode_api'; import { DURATION } from '../../session/constants'; import { conversationChanged, conversationRemoved } from '../../state/ducks/conversations'; -import { - editProfileModal, - onionPathModal, - updateConfirmModal, -} from '../../state/ducks/modalDialog'; +import { editProfileModal, onionPathModal } from '../../state/ducks/modalDialog'; import { uploadOurAvatar } from '../../interactions/conversationInteractions'; import { ModalContainer } from '../dialog/ModalContainer'; import { debounce } from 'underscore'; @@ -54,29 +49,7 @@ import { switchHtmlToDarkTheme, switchHtmlToLightTheme } from '../../state/ducks import { DraggableCallContainer } from './calling/DraggableCallContainer'; import { IncomingCallDialog } from './calling/IncomingCallDialog'; import { CallInFullScreenContainer } from './calling/CallInFullScreenContainer'; -import { SessionButtonColor } from './SessionButton'; -import { settingsReadReceipt } from './settings/section/CategoryPrivacy'; - -async function showTurnOnReadAck(dispatch: Dispatch) { - const singleShotSettingId = 'read-receipt-turn-on-asked'; - const item = (await getItemById(singleShotSettingId))?.value || false; - - if (!item) { - await createOrUpdateItem({ id: singleShotSettingId, value: true }); - // set it to true by default, user will be asked to willingfully turn it off - window.setSettingValue(settingsReadReceipt, true); - dispatch( - updateConfirmModal({ - title: window.i18n('readReceiptSettingTitle'), - messageSub: window.i18n('readReceiptDialogDescription'), - okTheme: SessionButtonColor.Green, - onClickCancel: () => { - window.setSettingValue(settingsReadReceipt, false); - }, - }) - ); - } -} + const Section = (props: { type: SectionType }) => { const ourNumber = useSelector(getOurNumber); const unreadMessageCount = useSelector(getUnreadMessageCount); @@ -254,7 +227,7 @@ const triggerAvatarReUploadIfNeeded = async () => { /** * This function is called only once: on app startup with a logged in user */ -const doAppStartUp = (dispatch: Dispatch) => { +const doAppStartUp = () => { // init the messageQueue. In the constructor, we add all not send messages // this call does nothing except calling the constructor, which will continue sending message in the pipeline void getMessageQueue().processAllPending(); @@ -273,8 +246,6 @@ const doAppStartUp = (dispatch: Dispatch) => { void loadDefaultRooms(); - void showTurnOnReadAck(dispatch); - debounce(triggerAvatarReUploadIfNeeded, 200); }; @@ -296,11 +267,10 @@ export const ActionsPanel = () => { const [startCleanUpMedia, setStartCleanUpMedia] = useState(false); const ourPrimaryConversation = useSelector(getOurPrimaryConversation); - const dispatch = useDispatch(); // this maxi useEffect is called only once: when the component is mounted. // For the action panel, it means this is called only one per app start/with a user loggedin useEffect(() => { - void doAppStartUp(dispatch); + void doAppStartUp(); }, []); // wait for cleanUpMediasInterval and then start cleaning up medias diff --git a/ts/components/session/settings/section/CategoryPrivacy.tsx b/ts/components/session/settings/section/CategoryPrivacy.tsx index c6eea2df3..0ed432602 100644 --- a/ts/components/session/settings/section/CategoryPrivacy.tsx +++ b/ts/components/session/settings/section/CategoryPrivacy.tsx @@ -10,7 +10,7 @@ import { PasswordAction } from '../../../dialog/SessionPasswordDialog'; import { SessionButtonColor } from '../../SessionButton'; import { SessionSettingButtonItem, SessionToggleWithDescription } from '../SessionSettingListItem'; -export const settingsReadReceipt = 'read-receipt-setting'; +const settingsReadReceipt = 'read-receipt-setting'; const settingsTypingIndicator = 'typing-indicators-setting'; const settingsAutoUpdate = 'auto-update'; diff --git a/ts/types/LocalizerKeys.ts b/ts/types/LocalizerKeys.ts index 148244bbd..0cd644596 100644 --- a/ts/types/LocalizerKeys.ts +++ b/ts/types/LocalizerKeys.ts @@ -209,7 +209,6 @@ export type LocalizerKeys = | 'timerOption_0_seconds_abbreviated' | 'timerOption_5_minutes_abbreviated' | 'enterOptionalPassword' - | 'userRemovedFromModerators' | 'goToReleaseNotes' | 'unpinConversation' | 'viewMenuResetZoom' @@ -341,7 +340,7 @@ export type LocalizerKeys = | 'youDisabledDisappearingMessages' | 'updateGroupDialogTitle' | 'surveyTitle' - | 'readReceiptDialogDescription' + | 'userRemovedFromModerators' | 'timerOption_5_seconds' | 'failedToRemoveFromModerator' | 'conversationsHeader' diff --git a/ts/util/accountManager.ts b/ts/util/accountManager.ts index 218a4ac2a..ecd2f5eaa 100644 --- a/ts/util/accountManager.ts +++ b/ts/util/accountManager.ts @@ -149,9 +149,8 @@ async function createAccount(identityKeyPair: any) { await window.textsecure.storage.put('identityKey', identityKeyPair); await window.textsecure.storage.put('password', password); - // enable read-receipt by default - await window.textsecure.storage.put('read-receipt-setting', true); - await window.textsecure.storage.put('read-receipt-turn-on-asked', true); // this can be removed once enough people upgraded 8/12/2021 + // disable read-receipt by default + await window.textsecure.storage.put('read-receipt-setting', false); // Enable typing indicators by default await window.textsecure.storage.put('typing-indicators-setting', true);