keep read-receipts disabled by default (#2071)

This commit is contained in:
Audric Ackermann 2021-12-08 17:44:24 +11:00 committed by GitHub
parent 48e7a0e25f
commit 95e40c9509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 41 deletions

View File

@ -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",

View File

@ -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<any>) {
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<any>) => {
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<any>) => {
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

View File

@ -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';

View File

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

View File

@ -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);