Story view receipts setting

This commit is contained in:
Fedor Indutny 2022-10-25 15:18:42 -07:00 committed by GitHub
parent ad42d98774
commit 3702a67975
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 161 additions and 35 deletions

View file

@ -5623,6 +5623,14 @@
"message": "Story settings", "message": "Story settings",
"description": "Button label to get to story settings" "description": "Button label to get to story settings"
}, },
"StoriesSettings__view-receipts--label": {
"message": "View Receipts",
"description": "Label of view receipts checkbox in story settings"
},
"StoriesSettings__view-receipts--description": {
"message": "To change this setting, open the Signal app on your mobile device and navigate to Settings -> Stories",
"description": "Description of how view receipts can be changed in story settings"
},
"SendStoryModal__choose-who-can-view": { "SendStoryModal__choose-who-can-view": {
"message": "Choose who can view your story", "message": "Choose who can view your story",
"description": "Shown during the first time posting a story" "description": "Shown during the first time posting a story"
@ -5732,7 +5740,7 @@
"description": "Context menu item to help debugging" "description": "Context menu item to help debugging"
}, },
"StoryViewsNRepliesModal__read-receipts-off": { "StoryViewsNRepliesModal__read-receipts-off": {
"message": "Enable read receipts to see who's viewed your stories. Open the Signal app on your mobile device and navigate to Settings > Privacy.", "message": "Enable view receipts to see whos viewed your stories. Open the Signal app on your mobile device and navigate to Settings > Stories.",
"description": "Instructions on how to enable read receipts" "description": "Instructions on how to enable read receipts"
}, },
"StoryViewsNRepliesModal__no-replies": { "StoryViewsNRepliesModal__no-replies": {

View file

@ -6,6 +6,12 @@ package signalservice;
option java_package = "org.whispersystems.signalservice.internal.storage"; option java_package = "org.whispersystems.signalservice.internal.storage";
option java_outer_classname = "SignalStorageProtos"; option java_outer_classname = "SignalStorageProtos";
enum OptionalBool {
UNSET = 0;
ENABLED = 1;
DISABLED = 2;
}
message StorageManifest { message StorageManifest {
optional uint64 version = 1; optional uint64 version = 1;
optional bytes value = 2; optional bytes value = 2;
@ -166,6 +172,7 @@ message AccountRecord {
reserved /* hasViewedOnboardingStory */ 27; reserved /* hasViewedOnboardingStory */ 27;
reserved 28; // deprecatedStoriesDisabled reserved 28; // deprecatedStoriesDisabled
optional bool storiesDisabled = 29; optional bool storiesDisabled = 29;
optional OptionalBool storyViewReceiptsEnabled = 30;
} }
message StoryDistributionListRecord { message StoryDistributionListRecord {

View file

@ -3698,7 +3698,7 @@ export async function startApp(): Promise<void> {
event.confirm(); event.confirm();
if (!window.storage.get('read-receipt-setting') || !sourceConversation) { if (!sourceConversation) {
return; return;
} }

View file

@ -41,6 +41,10 @@ export default {
ourConversationId: { ourConversationId: {
defaultValue: getDefaultConversation().id, defaultValue: getDefaultConversation().id,
}, },
hasViewReceiptSetting: {
control: 'boolean',
defaultValue: false,
},
queueStoryDownload: { queueStoryDownload: {
action: true, action: true,
}, },

View file

@ -23,7 +23,7 @@ export type PropsType = {
onSave: (story: StoryViewType) => unknown; onSave: (story: StoryViewType) => unknown;
queueStoryDownload: (storyId: string) => unknown; queueStoryDownload: (storyId: string) => unknown;
viewStory: ViewStoryActionCreatorType; viewStory: ViewStoryActionCreatorType;
hasReadReceiptSetting: boolean; hasViewReceiptSetting: boolean;
}; };
export const MyStories = ({ export const MyStories = ({
@ -35,7 +35,7 @@ export const MyStories = ({
onSave, onSave,
queueStoryDownload, queueStoryDownload,
viewStory, viewStory,
hasReadReceiptSetting, hasViewReceiptSetting,
}: PropsType): JSX.Element => { }: PropsType): JSX.Element => {
const [confirmDeleteStory, setConfirmDeleteStory] = useState< const [confirmDeleteStory, setConfirmDeleteStory] = useState<
StoryViewType | undefined StoryViewType | undefined
@ -107,7 +107,7 @@ export const MyStories = ({
/> />
</div> </div>
<div className="MyStories__story__details"> <div className="MyStories__story__details">
{hasReadReceiptSetting {hasViewReceiptSetting
? i18n('icu:MyStories__views', { ? i18n('icu:MyStories__views', {
views: story.views ?? 0, views: story.views ?? 0,
}) })

View file

@ -48,7 +48,7 @@ export type PropsType = {
viewStory: ViewStoryActionCreatorType; viewStory: ViewStoryActionCreatorType;
isViewingStory: boolean; isViewingStory: boolean;
isStoriesSettingsVisible: boolean; isStoriesSettingsVisible: boolean;
hasReadReceiptSetting: boolean; hasViewReceiptSetting: boolean;
}; };
type AddStoryType = type AddStoryType =
@ -81,7 +81,7 @@ export const Stories = ({
viewStory, viewStory,
isViewingStory, isViewingStory,
isStoriesSettingsVisible, isStoriesSettingsVisible,
hasReadReceiptSetting, hasViewReceiptSetting,
}: PropsType): JSX.Element => { }: PropsType): JSX.Element => {
const width = getWidthFromPreferredWidth(preferredWidthFromStorage, { const width = getWidthFromPreferredWidth(preferredWidthFromStorage, {
requiresFullWidth: true, requiresFullWidth: true,
@ -118,7 +118,7 @@ export const Stories = ({
onSave={onSaveStory} onSave={onSaveStory}
queueStoryDownload={queueStoryDownload} queueStoryDownload={queueStoryDownload}
viewStory={viewStory} viewStory={viewStory}
hasReadReceiptSetting={hasReadReceiptSetting} hasViewReceiptSetting={hasViewReceiptSetting}
/> />
) : ( ) : (
<StoriesPane <StoriesPane

View file

@ -34,6 +34,7 @@ export default {
me: { me: {
defaultValue: getDefaultConversation(), defaultValue: getDefaultConversation(),
}, },
storyViewReceiptsEnabled: { control: 'boolean' },
onDeleteList: { action: true }, onDeleteList: { action: true },
onDistributionListCreated: { action: true }, onDistributionListCreated: { action: true },
onHideMyStoriesFrom: { action: true }, onHideMyStoriesFrom: { action: true },

View file

@ -60,6 +60,7 @@ export type PropsType = {
viewerUuids: Array<UUIDStringType> viewerUuids: Array<UUIDStringType>
) => unknown; ) => unknown;
setMyStoriesToAllSignalConnections: () => unknown; setMyStoriesToAllSignalConnections: () => unknown;
storyViewReceiptsEnabled: boolean;
toggleSignalConnectionsModal: () => unknown; toggleSignalConnectionsModal: () => unknown;
}; };
@ -102,6 +103,7 @@ export const StoriesSettingsModal = ({
onRepliesNReactionsChanged, onRepliesNReactionsChanged,
onViewersUpdated, onViewersUpdated,
setMyStoriesToAllSignalConnections, setMyStoriesToAllSignalConnections,
storyViewReceiptsEnabled,
toggleSignalConnectionsModal, toggleSignalConnectionsModal,
}: PropsType): JSX.Element => { }: PropsType): JSX.Element => {
const [confirmDiscardModal, confirmDiscardIf] = useConfirmDiscard(i18n); const [confirmDiscardModal, confirmDiscardIf] = useConfirmDiscard(i18n);
@ -239,8 +241,6 @@ export const StoriesSettingsModal = ({
<span className="StoriesSettingsModal__list__viewers" /> <span className="StoriesSettingsModal__list__viewers" />
</button> </button>
<hr className="StoriesSettingsModal__divider" />
<button <button
className="StoriesSettingsModal__list" className="StoriesSettingsModal__list"
onClick={() => { onClick={() => {
@ -280,6 +280,18 @@ export const StoriesSettingsModal = ({
</span> </span>
</button> </button>
))} ))}
<hr className="StoriesSettingsModal__divider" />
<Checkbox
disabled
checked={storyViewReceiptsEnabled}
description={i18n('StoriesSettings__view-receipts--description')}
label={i18n('StoriesSettings__view-receipts--label')}
moduleClassName="StoriesSettingsModal__checkbox"
name="view-receipts"
onChange={noop}
/>
</ModalPage> </ModalPage>
); );
} }

View file

@ -29,9 +29,11 @@ export default {
defaultValue: undefined, defaultValue: undefined,
}, },
hasAllStoriesMuted: { hasAllStoriesMuted: {
control: 'boolean',
defaultValue: false, defaultValue: false,
}, },
hasReadReceiptSetting: { hasViewReceiptSetting: {
control: 'boolean',
defaultValue: true, defaultValue: true,
}, },
i18n: { i18n: {
@ -194,7 +196,7 @@ export const ReadReceiptsOff = Template.bind({});
'/fixtures/nathan-anderson-316188-unsplash.jpg' '/fixtures/nathan-anderson-316188-unsplash.jpg'
); );
ReadReceiptsOff.args = { ReadReceiptsOff.args = {
hasReadReceiptSetting: false, hasViewReceiptSetting: false,
story: { story: {
...storyView, ...storyView,
sender: { sender: {

View file

@ -67,7 +67,7 @@ export type PropsType = {
>; >;
hasActiveCall?: boolean; hasActiveCall?: boolean;
hasAllStoriesMuted: boolean; hasAllStoriesMuted: boolean;
hasReadReceiptSetting: boolean; hasViewReceiptSetting: boolean;
i18n: LocalizerType; i18n: LocalizerType;
loadStoryReplies: (conversationId: string, messageId: string) => unknown; loadStoryReplies: (conversationId: string, messageId: string) => unknown;
markStoryRead: (mId: string) => unknown; markStoryRead: (mId: string) => unknown;
@ -117,7 +117,7 @@ export const StoryViewer = ({
group, group,
hasActiveCall, hasActiveCall,
hasAllStoriesMuted, hasAllStoriesMuted,
hasReadReceiptSetting, hasViewReceiptSetting,
i18n, i18n,
loadStoryReplies, loadStoryReplies,
markStoryRead, markStoryRead,
@ -722,11 +722,11 @@ export const StoryViewer = ({
<> <>
{isSent || replyCount > 0 ? ( {isSent || replyCount > 0 ? (
<span className="StoryViewer__reply__chevron"> <span className="StoryViewer__reply__chevron">
{isSent && !hasReadReceiptSetting && !replyCount && ( {isSent && !hasViewReceiptSetting && !replyCount && (
<>{i18n('StoryViewer__views-off')}</> <>{i18n('StoryViewer__views-off')}</>
)} )}
{isSent && {isSent &&
hasReadReceiptSetting && hasViewReceiptSetting &&
(viewCount === 1 ? ( (viewCount === 1 ? (
<Intl <Intl
i18n={i18n} i18n={i18n}
@ -795,7 +795,7 @@ export const StoryViewer = ({
authorTitle={firstName || title} authorTitle={firstName || title}
canReply={Boolean(canReply)} canReply={Boolean(canReply)}
getPreferredBadge={getPreferredBadge} getPreferredBadge={getPreferredBadge}
hasReadReceiptSetting={hasReadReceiptSetting} hasViewReceiptSetting={hasViewReceiptSetting}
hasViewsCapability={isSent} hasViewsCapability={isSent}
i18n={i18n} i18n={i18n}
group={group} group={group}

View file

@ -30,10 +30,12 @@ export default {
defaultValue: true, defaultValue: true,
}, },
getPreferredBadge: { action: true }, getPreferredBadge: { action: true },
hasReadReceiptSetting: { hasViewReceiptSetting: {
control: 'boolean',
defaultValue: true, defaultValue: true,
}, },
hasViewsCapability: { hasViewsCapability: {
control: 'boolean',
defaultValue: false, defaultValue: false,
}, },
i18n: { i18n: {
@ -243,7 +245,7 @@ InAGroupCantReply.storyName = "In a group (can't reply)";
export const ReadReceiptsTurnedOff = Template.bind({}); export const ReadReceiptsTurnedOff = Template.bind({});
ReadReceiptsTurnedOff.args = { ReadReceiptsTurnedOff.args = {
canReply: false, canReply: false,
hasReadReceiptSetting: false, hasViewReceiptSetting: false,
hasViewsCapability: true, hasViewsCapability: true,
views: getViewsAndReplies().views, views: getViewsAndReplies().views,
}; };
@ -263,7 +265,7 @@ export const GroupReadReceiptsOff = Template.bind({});
{ {
const { views, replies } = getViewsAndReplies(); const { views, replies } = getViewsAndReplies();
GroupReadReceiptsOff.args = { GroupReadReceiptsOff.args = {
hasReadReceiptSetting: false, hasViewReceiptSetting: false,
hasViewsCapability: true, hasViewsCapability: true,
group: {}, group: {},
replies, replies,

View file

@ -94,7 +94,7 @@ export type PropsType = {
authorTitle: string; authorTitle: string;
canReply: boolean; canReply: boolean;
getPreferredBadge: PreferredBadgeSelectorType; getPreferredBadge: PreferredBadgeSelectorType;
hasReadReceiptSetting: boolean; hasViewReceiptSetting: boolean;
hasViewsCapability: boolean; hasViewsCapability: boolean;
i18n: LocalizerType; i18n: LocalizerType;
group: Pick<ConversationType, 'left'> | undefined; group: Pick<ConversationType, 'left'> | undefined;
@ -124,7 +124,7 @@ export const StoryViewsNRepliesModal = ({
authorTitle, authorTitle,
canReply, canReply,
getPreferredBadge, getPreferredBadge,
hasReadReceiptSetting, hasViewReceiptSetting,
hasViewsCapability, hasViewsCapability,
i18n, i18n,
group, group,
@ -396,7 +396,7 @@ export const StoryViewsNRepliesModal = ({
} }
let viewsElement: JSX.Element | undefined; let viewsElement: JSX.Element | undefined;
if (hasViewsCapability && !hasReadReceiptSetting) { if (hasViewsCapability && !hasViewReceiptSetting) {
viewsElement = ( viewsElement = (
<div className="StoryViewsNRepliesModal__read-receipts-off"> <div className="StoryViewsNRepliesModal__read-receipts-off">
{i18n('StoryViewsNRepliesModal__read-receipts-off')} {i18n('StoryViewsNRepliesModal__read-receipts-off')}

View file

@ -118,6 +118,26 @@ const wasDeliveredWithSealedSender = (
conversationId conversationId
); );
const shouldDropReceipt = (
receipt: MessageReceiptModel,
message: MessageModel
): boolean => {
const type = receipt.get('type');
switch (type) {
case MessageReceiptType.Delivery:
return false;
case MessageReceiptType.Read:
return !window.storage.get('read-receipt-setting');
case MessageReceiptType.View:
if (isStory(message.attributes)) {
return !window.Events.getStoryViewReceiptsEnabled();
}
return !window.storage.get('read-receipt-setting');
default:
throw missingCaseError(type);
}
};
export class MessageReceipts extends Collection<MessageReceiptModel> { export class MessageReceipts extends Collection<MessageReceiptModel> {
static getSingleton(): MessageReceipts { static getSingleton(): MessageReceipts {
if (!singleton) { if (!singleton) {
@ -140,16 +160,27 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
} else { } else {
ids = conversation.getMemberIds(); ids = conversation.getMemberIds();
} }
const sentAt = message.get('sent_at');
const receipts = this.filter( const receipts = this.filter(
receipt => receipt =>
receipt.get('messageSentAt') === message.get('sent_at') && receipt.get('messageSentAt') === sentAt &&
ids.includes(receipt.get('sourceConversationId')) ids.includes(receipt.get('sourceConversationId'))
); );
if (receipts.length) { if (receipts.length) {
log.info('Found early receipts for message'); log.info(`MessageReceipts: found early receipts for message ${sentAt}`);
this.remove(receipts); this.remove(receipts);
} }
return receipts; return receipts.filter(receipt => {
if (shouldDropReceipt(receipt, message)) {
log.info(
`MessageReceipts: Dropping an early receipt ${receipt.get('type')} ` +
`for message ${sentAt}`
);
return false;
}
return true;
});
} }
private async updateMessageSendState( private async updateMessageSendState(
@ -157,6 +188,15 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
message: MessageModel message: MessageModel
): Promise<void> { ): Promise<void> {
const messageSentAt = receipt.get('messageSentAt'); const messageSentAt = receipt.get('messageSentAt');
if (shouldDropReceipt(receipt, message)) {
log.info(
`MessageReceipts: Dropping a receipt ${receipt.get('type')} ` +
`for message ${messageSentAt}`
);
return;
}
const receiptTimestamp = receipt.get('receiptTimestamp'); const receiptTimestamp = receipt.get('receiptTimestamp');
const sourceConversationId = receipt.get('sourceConversationId'); const sourceConversationId = receipt.get('sourceConversationId');
const type = receipt.get('type'); const type = receipt.get('type');
@ -272,7 +312,7 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
// Nope, no target message was found // Nope, no target message was found
if (!targetMessages.length) { if (!targetMessages.length) {
log.info( log.info(
'No message for receipt', 'MessageReceipts: No message for receipt',
type, type,
sourceConversationId, sourceConversationId,
sourceUuid, sourceUuid,

View file

@ -362,6 +362,17 @@ export function toAccountRecord(
const hasStoriesDisabled = window.storage.get('hasStoriesDisabled'); const hasStoriesDisabled = window.storage.get('hasStoriesDisabled');
accountRecord.storiesDisabled = hasStoriesDisabled === true; accountRecord.storiesDisabled = hasStoriesDisabled === true;
const storyViewReceiptsEnabled = window.storage.get(
'storyViewReceiptsEnabled'
);
if (storyViewReceiptsEnabled !== undefined) {
accountRecord.storyViewReceiptsEnabled = storyViewReceiptsEnabled
? Proto.OptionalBool.ENABLED
: Proto.OptionalBool.DISABLED;
} else {
accountRecord.storyViewReceiptsEnabled = Proto.OptionalBool.UNSET;
}
applyUnknownFields(accountRecord, conversation); applyUnknownFields(accountRecord, conversation);
return accountRecord; return accountRecord;
@ -1093,6 +1104,7 @@ export async function mergeAccountRecord(
keepMutedChatsArchived, keepMutedChatsArchived,
hasSetMyStoriesPrivacy, hasSetMyStoriesPrivacy,
storiesDisabled, storiesDisabled,
storyViewReceiptsEnabled,
} = accountRecord; } = accountRecord;
const updatedConversations = new Array<ConversationModel>(); const updatedConversations = new Array<ConversationModel>();
@ -1292,6 +1304,19 @@ export async function mergeAccountRecord(
window.textsecure.server?.onHasStoriesDisabledChange(hasStoriesDisabled); window.textsecure.server?.onHasStoriesDisabledChange(hasStoriesDisabled);
} }
switch (storyViewReceiptsEnabled) {
case Proto.OptionalBool.ENABLED:
window.storage.put('storyViewReceiptsEnabled', true);
break;
case Proto.OptionalBool.DISABLED:
window.storage.put('storyViewReceiptsEnabled', false);
break;
case Proto.OptionalBool.UNSET:
default:
// Do nothing
break;
}
const ourID = window.ConversationController.getOurConversationId(); const ourID = window.ConversationController.getOurConversationId();
if (!ourID) { if (!ourID) {

View file

@ -320,7 +320,9 @@ function markStoryRead(
viewSyncJobQueue.add({ viewSyncs }); viewSyncJobQueue.add({ viewSyncs });
} }
viewedReceiptsJobQueue.add({ viewedReceipt }); if (window.Events.getStoryViewReceiptsEnabled()) {
viewedReceiptsJobQueue.add({ viewedReceipt });
}
await dataInterface.addNewStoryRead({ await dataInterface.addNewStoryRead({
authorId: message.attributes.sourceUuid, authorId: message.attributes.sourceUuid,

View file

@ -177,3 +177,11 @@ export const getHasReadReceiptSetting = createSelector(
getItems, getItems,
(state: ItemsStateType): boolean => Boolean(state['read-receipt-setting']) (state: ItemsStateType): boolean => Boolean(state['read-receipt-setting'])
); );
export const getHasStoryViewReceiptSetting = createSelector(
getItems,
(state: ItemsStateType): boolean =>
Boolean(
state.storyViewReceiptsEnabled ?? state['read-receipt-setting'] ?? false
)
);

View file

@ -13,7 +13,7 @@ import { getMe } from '../selectors/conversations';
import { getIntl } from '../selectors/user'; import { getIntl } from '../selectors/user';
import { getPreferredBadgeSelector } from '../selectors/badges'; import { getPreferredBadgeSelector } from '../selectors/badges';
import { import {
getHasReadReceiptSetting, getHasStoryViewReceiptSetting,
getPreferredLeftPaneWidth, getPreferredLeftPaneWidth,
} from '../selectors/items'; } from '../selectors/items';
import { import {
@ -62,7 +62,7 @@ export function SmartStories(): JSX.Element | null {
(state: StateType) => state.globalModals.isStoriesSettingsVisible (state: StateType) => state.globalModals.isStoriesSettingsVisible
); );
const hasReadReceiptSetting = useSelector(getHasReadReceiptSetting); const hasViewReceiptSetting = useSelector(getHasStoryViewReceiptSetting);
if (!isShowingStoriesView) { if (!isShowingStoriesView) {
return null; return null;
@ -92,7 +92,7 @@ export function SmartStories(): JSX.Element | null {
toggleHideStories={toggleHideStories} toggleHideStories={toggleHideStories}
isViewingStory={selectedStoryData !== undefined} isViewingStory={selectedStoryData !== undefined}
isStoriesSettingsVisible={isStoriesSettingsVisible} isStoriesSettingsVisible={isStoriesSettingsVisible}
hasReadReceiptSetting={hasReadReceiptSetting} hasViewReceiptSetting={hasViewReceiptSetting}
{...storiesActions} {...storiesActions}
/> />
); );

View file

@ -14,6 +14,7 @@ import {
import { getDistributionListsWithMembers } from '../selectors/storyDistributionLists'; import { getDistributionListsWithMembers } from '../selectors/storyDistributionLists';
import { getIntl } from '../selectors/user'; import { getIntl } from '../selectors/user';
import { getPreferredBadgeSelector } from '../selectors/badges'; import { getPreferredBadgeSelector } from '../selectors/badges';
import { getHasStoryViewReceiptSetting } from '../selectors/items';
import { useGlobalModalActions } from '../ducks/globalModals'; import { useGlobalModalActions } from '../ducks/globalModals';
import { useStoryDistributionListsActions } from '../ducks/storyDistributionLists'; import { useStoryDistributionListsActions } from '../ducks/storyDistributionLists';
@ -31,6 +32,7 @@ export function SmartStoriesSettingsModal(): JSX.Element | null {
} = useStoryDistributionListsActions(); } = useStoryDistributionListsActions();
const getPreferredBadge = useSelector(getPreferredBadgeSelector); const getPreferredBadge = useSelector(getPreferredBadgeSelector);
const storyViewReceiptsEnabled = useSelector(getHasStoryViewReceiptSetting);
const i18n = useSelector<StateType, LocalizerType>(getIntl); const i18n = useSelector<StateType, LocalizerType>(getIntl);
const me = useSelector(getMe); const me = useSelector(getMe);
@ -52,6 +54,7 @@ export function SmartStoriesSettingsModal(): JSX.Element | null {
onRepliesNReactionsChanged={allowsRepliesChanged} onRepliesNReactionsChanged={allowsRepliesChanged}
onViewersUpdated={updateStoryViewers} onViewersUpdated={updateStoryViewers}
setMyStoriesToAllSignalConnections={setMyStoriesToAllSignalConnections} setMyStoriesToAllSignalConnections={setMyStoriesToAllSignalConnections}
storyViewReceiptsEnabled={storyViewReceiptsEnabled}
toggleSignalConnectionsModal={toggleSignalConnectionsModal} toggleSignalConnectionsModal={toggleSignalConnectionsModal}
/> />
); );

View file

@ -14,7 +14,7 @@ import { getConversationSelector } from '../selectors/conversations';
import { import {
getEmojiSkinTone, getEmojiSkinTone,
getHasAllStoriesMuted, getHasAllStoriesMuted,
getHasReadReceiptSetting, getHasStoryViewReceiptSetting,
getPreferredReactionEmoji, getPreferredReactionEmoji,
} from '../selectors/items'; } from '../selectors/items';
import { getIntl } from '../selectors/user'; import { getIntl } from '../selectors/user';
@ -67,8 +67,8 @@ export function SmartStoryViewer(): JSX.Element | null {
); );
const hasActiveCall = useSelector(isInFullScreenCall); const hasActiveCall = useSelector(isInFullScreenCall);
const hasReadReceiptSetting = useSelector<StateType, boolean>( const hasViewReceiptSetting = useSelector<StateType, boolean>(
getHasReadReceiptSetting getHasStoryViewReceiptSetting
); );
const storyInfo = getStoryById( const storyInfo = getStoryById(
@ -90,7 +90,7 @@ export function SmartStoryViewer(): JSX.Element | null {
group={conversationStory.group} group={conversationStory.group}
hasActiveCall={hasActiveCall} hasActiveCall={hasActiveCall}
hasAllStoriesMuted={hasAllStoriesMuted} hasAllStoriesMuted={hasAllStoriesMuted}
hasReadReceiptSetting={hasReadReceiptSetting} hasViewReceiptSetting={hasViewReceiptSetting}
i18n={i18n} i18n={i18n}
numStories={selectedStoryData.numStories} numStories={selectedStoryData.numStories}
onHideStory={toggleHideStories} onHideStory={toggleHideStories}

View file

@ -68,6 +68,7 @@ export type StorageAccessType = {
hasRegisterSupportForUnauthenticatedDelivery: boolean; hasRegisterSupportForUnauthenticatedDelivery: boolean;
hasSetMyStoriesPrivacy: boolean; hasSetMyStoriesPrivacy: boolean;
hasStoriesDisabled: boolean; hasStoriesDisabled: boolean;
storyViewReceiptsEnabled: boolean;
identityKeyMap: IdentityKeyMap; identityKeyMap: IdentityKeyMap;
lastHeartbeat: number; lastHeartbeat: number;
lastStartup: number; lastStartup: number;

View file

@ -68,6 +68,7 @@ export type IPCEventsValuesType = {
themeSetting: ThemeType; themeSetting: ThemeType;
universalExpireTimer: number; universalExpireTimer: number;
zoomFactor: ZoomFactorType; zoomFactor: ZoomFactorType;
storyViewReceiptsEnabled: boolean;
// Optional // Optional
mediaPermissions: boolean; mediaPermissions: boolean;
@ -193,6 +194,16 @@ export function createIPCEvents(
account.captureChange('hasStoriesDisabled'); account.captureChange('hasStoriesDisabled');
window.textsecure.server?.onHasStoriesDisabledChange(value); window.textsecure.server?.onHasStoriesDisabledChange(value);
}, },
getStoryViewReceiptsEnabled: () => {
return (
window.storage.get('storyViewReceiptsEnabled') ??
window.storage.get('read-receipt-setting') ??
false
);
},
setStoryViewReceiptsEnabled: async (value: boolean) => {
await window.storage.put('storyViewReceiptsEnabled', value);
},
getPreferredAudioInputDevice: () => getPreferredAudioInputDevice: () =>
window.storage.get('preferred-audio-input-device'), window.storage.get('preferred-audio-input-device'),