Adding unhiding of message request banner when receiving a new convo request.
This commit is contained in:
parent
8eeec6b96c
commit
bc6edd7774
|
@ -439,7 +439,7 @@
|
|||
"messageRequests": "Message Requests",
|
||||
"requestsSubtitle": "Pending Requests",
|
||||
"requestsPlaceholder": "No requests",
|
||||
"messageRequestsDescription": "Always show the Message Request inbox",
|
||||
"hideRequestBannerDescription": "Hide the Message Request banner until you receive a new message request.",
|
||||
"incomingCallFrom": "Incoming call from '$name$'",
|
||||
"ringing": "Ringing...",
|
||||
"establishingConnection": "Establishing connection...",
|
||||
|
@ -472,7 +472,7 @@
|
|||
"messageRequestAcceptedOursNoName": "You have accepted the message request",
|
||||
"declineRequestMessage": "Are you sure you want to decline this message request?",
|
||||
"respondingToRequestWarning": "Sending a message to this user will automatically accept their message request and reveal your Session ID.",
|
||||
"alwaysShowMessageRequests": "Always show Message Requests",
|
||||
"hideRequestBanner": "Hide Message Request Banner",
|
||||
"openMessageRequestInbox": "View Message Requests",
|
||||
"openMessageRequestInboxDescription": "View your Message Request inbox"
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import { SessionTheme } from '../../state/ducks/SessionTheme';
|
|||
import { getLeftPaneLists } from '../../state/selectors/conversations';
|
||||
import { getQuery, getSearchResults, isSearching } from '../../state/selectors/search';
|
||||
import { getFocusedSection, getOverlayMode } from '../../state/selectors/section';
|
||||
import { getIsMessageRequestsEnabled } from '../../state/selectors/userConfig';
|
||||
import { getHideMessageRequestBanner } from '../../state/selectors/userConfig';
|
||||
import { ActionsPanel } from './ActionsPanel';
|
||||
import { LeftPaneContactSection } from './LeftPaneContactSection';
|
||||
import { LeftPaneMessageSection } from './LeftPaneMessageSection';
|
||||
|
@ -29,7 +29,7 @@ const InnerLeftPaneMessageSection = () => {
|
|||
const searchResults = showSearch ? useSelector(getSearchResults) : undefined;
|
||||
|
||||
const lists = showSearch ? undefined : useSelector(getLeftPaneLists);
|
||||
const messageRequestsEnabled = useSelector(getIsMessageRequestsEnabled);
|
||||
const messageRequestsEnabled = useSelector(getHideMessageRequestBanner);
|
||||
const overlayMode = useSelector(getOverlayMode);
|
||||
|
||||
return (
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import { useSelector } from 'react-redux';
|
||||
import styled from 'styled-components';
|
||||
import { getConversationRequests } from '../../state/selectors/conversations';
|
||||
import { getIsMessageRequestsEnabled } from '../../state/selectors/userConfig';
|
||||
import { getHideMessageRequestBanner } from '../../state/selectors/userConfig';
|
||||
import { SessionIcon, SessionIconSize, SessionIconType } from '../icon';
|
||||
|
||||
const StyledMessageRequestBanner = styled.div`
|
||||
|
@ -85,9 +85,9 @@ export const CirclularIcon = (props: { iconType: SessionIconType; iconSize: Sess
|
|||
export const MessageRequestsBanner = (props: { handleOnClick: () => any }) => {
|
||||
const { handleOnClick } = props;
|
||||
const conversationRequests = useSelector(getConversationRequests);
|
||||
const showRequestBannerEnabled = useSelector(getIsMessageRequestsEnabled);
|
||||
const hideRequestBanner = useSelector(getHideMessageRequestBanner);
|
||||
|
||||
if (!conversationRequests.length || !showRequestBannerEnabled) {
|
||||
if (!conversationRequests.length || hideRequestBanner) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import { setOverlayMode } from '../../../state/ducks/section';
|
|||
import { getConversationController } from '../../../session/conversations';
|
||||
import { forceSyncConfigurationNowIfNeeded } from '../../../session/utils/syncUtils';
|
||||
import { BlockedNumberController } from '../../../util';
|
||||
import { getIsMessageRequestsEnabled } from '../../../state/selectors/userConfig';
|
||||
import useKey from 'react-use/lib/useKey';
|
||||
|
||||
/**
|
||||
|
@ -59,8 +58,6 @@ export const OverlayMessageRequest = () => {
|
|||
dispatch(setOverlayMode(undefined));
|
||||
}
|
||||
|
||||
const messageRequestSetting = useSelector(getIsMessageRequestsEnabled);
|
||||
|
||||
const buttonText = window.i18n('clearAll');
|
||||
|
||||
return (
|
||||
|
@ -73,7 +70,7 @@ export const OverlayMessageRequest = () => {
|
|||
buttonType={SessionButtonType.BrandOutline}
|
||||
text={buttonText}
|
||||
onClick={() => {
|
||||
void handleBlockAllRequestsClick(messageRequestSetting);
|
||||
void handleBlockAllRequestsClick();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,6 @@ import { useDispatch, useSelector } from 'react-redux';
|
|||
import useUpdate from 'react-use/lib/useUpdate';
|
||||
import {
|
||||
createOrUpdateItem,
|
||||
fillWithTestData,
|
||||
hasLinkPreviewPopupBeenDisplayed,
|
||||
} from '../../../data/data';
|
||||
import { ToastUtils } from '../../../session/utils';
|
||||
|
|
|
@ -7,7 +7,7 @@ import { CallManager } from '../../../session/utils';
|
|||
import { sessionPassword, updateConfirmModal } from '../../../state/ducks/modalDialog';
|
||||
import { SectionType, setOverlayMode, showLeftPaneSection } from '../../../state/ducks/section';
|
||||
import { toggleMessageRequests } from '../../../state/ducks/userConfig';
|
||||
import { getIsMessageRequestsEnabled } from '../../../state/selectors/userConfig';
|
||||
import { getHideMessageRequestBanner } from '../../../state/selectors/userConfig';
|
||||
import { SessionButtonColor } from '../../basic/SessionButton';
|
||||
import { PasswordAction } from '../../dialog/SessionPasswordDialog';
|
||||
|
||||
|
@ -115,9 +115,9 @@ export const SettingsCategoryPrivacy = (props: {
|
|||
onClickToggle={() => {
|
||||
dispatch(toggleMessageRequests());
|
||||
}}
|
||||
title={window.i18n('alwaysShowMessageRequests')}
|
||||
description={window.i18n('messageRequestsDescription')}
|
||||
active={useSelector(getIsMessageRequestsEnabled)}
|
||||
title={window.i18n('hideRequestBanner')}
|
||||
description={window.i18n('hideRequestBannerDescription')}
|
||||
active={useSelector(getHideMessageRequestBanner)}
|
||||
/>
|
||||
<SessionSettingButtonItem
|
||||
title={window.i18n('openMessageRequestInbox')}
|
||||
|
|
|
@ -4,7 +4,7 @@ import { getMessageQueue } from '../session';
|
|||
import { getConversationController } from '../session/conversations';
|
||||
import { ClosedGroupVisibleMessage } from '../session/messages/outgoing/visibleMessage/ClosedGroupVisibleMessage';
|
||||
import { PubKey } from '../session/types';
|
||||
import { ToastUtils, UserUtils } from '../session/utils';
|
||||
import { UserUtils } from '../session/utils';
|
||||
import { BlockedNumberController } from '../util';
|
||||
import { leaveClosedGroup } from '../session/group/closed-group';
|
||||
import { SignalService } from '../protobuf';
|
||||
|
@ -19,7 +19,7 @@ import {
|
|||
saveMessages,
|
||||
updateConversation,
|
||||
} from '../../ts/data/data';
|
||||
import { fromHexToArray, toHex } from '../session/utils/String';
|
||||
import { toHex } from '../session/utils/String';
|
||||
import {
|
||||
actions as conversationActions,
|
||||
conversationChanged,
|
||||
|
|
|
@ -19,6 +19,8 @@ import { perfEnd, perfStart } from '../session/utils/Performance';
|
|||
import { getAllCachedECKeyPair } from './closedGroups';
|
||||
import { handleCallMessage } from './callMessage';
|
||||
import { SettingsKey } from '../data/settings-key';
|
||||
import { showMessageRequestBanner } from '../state/ducks/userConfig';
|
||||
import { useUpdate } from 'react-use';
|
||||
|
||||
export async function handleContentMessage(envelope: EnvelopePlus, messageHash: string) {
|
||||
try {
|
||||
|
@ -345,11 +347,19 @@ export async function innerHandleContentMessage(
|
|||
}
|
||||
}
|
||||
|
||||
await getConversationController().getOrCreateAndWait(
|
||||
const newConvo = await getConversationController().getOrCreateAndWait(
|
||||
envelope.source,
|
||||
ConversationTypeEnum.PRIVATE
|
||||
);
|
||||
|
||||
if (
|
||||
newConvo.isPrivate() &&
|
||||
!newConvo.isApproved() &&
|
||||
window.inboxStore?.getState().userConfig.hideMessageRequests
|
||||
) {
|
||||
window.inboxStore?.dispatch(showMessageRequestBanner());
|
||||
}
|
||||
|
||||
if (content.dataMessage) {
|
||||
if (content.dataMessage.profileKey && content.dataMessage.profileKey.length === 0) {
|
||||
content.dataMessage.profileKey = null;
|
||||
|
@ -532,7 +542,6 @@ async function handleMessageRequestResponse(
|
|||
messageRequestResponse: SignalService.MessageRequestResponse
|
||||
) {
|
||||
const { isApproved } = messageRequestResponse;
|
||||
|
||||
if (!messageRequestResponse) {
|
||||
window?.log?.error('handleMessageRequestResponse: Invalid parameters -- dropping message.');
|
||||
await removeFromCache(envelope);
|
||||
|
@ -540,12 +549,7 @@ async function handleMessageRequestResponse(
|
|||
}
|
||||
|
||||
const convoId = envelope.source;
|
||||
|
||||
// TODO: commenting out, including in one larger function for now
|
||||
// await updateConversationDidApproveMe(toHex(publicKey), isApproved);
|
||||
|
||||
const conversationToApprove = getConversationController().get(convoId);
|
||||
|
||||
if (!conversationToApprove || conversationToApprove.didApproveMe() === isApproved) {
|
||||
window?.log?.info(
|
||||
'Conversation already contains the correct value for the didApproveMe field.'
|
||||
|
@ -553,7 +557,6 @@ async function handleMessageRequestResponse(
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO: Maybe move this to conversation interactions
|
||||
await conversationToApprove.setIsApproved(isApproved);
|
||||
await conversationToApprove.setDidApproveMe(isApproved);
|
||||
if (isApproved === true) {
|
||||
|
|
|
@ -35,7 +35,7 @@ export const persistConfig = {
|
|||
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
||||
|
||||
// Exclude logger if we're in production mode
|
||||
const disableLogging = true; //; env === 'production' || true; // ALWAYS TURNED OFF
|
||||
const disableLogging = false; //; env === 'production' || true; // ALWAYS TURNED OFF
|
||||
const middlewareList = disableLogging ? [promiseMiddleware] : [logger, promiseMiddleware];
|
||||
|
||||
export const createStore = (initialState: any) =>
|
||||
|
|
|
@ -7,13 +7,13 @@ import { createSlice } from '@reduxjs/toolkit';
|
|||
export interface UserConfigState {
|
||||
audioAutoplay: boolean;
|
||||
showRecoveryPhrasePrompt: boolean;
|
||||
messageRequests: boolean;
|
||||
hideMessageRequests: boolean;
|
||||
}
|
||||
|
||||
export const initialUserConfigState = {
|
||||
audioAutoplay: false,
|
||||
showRecoveryPhrasePrompt: true,
|
||||
messageRequests: false,
|
||||
hideMessageRequests: false,
|
||||
};
|
||||
|
||||
const userConfigSlice = createSlice({
|
||||
|
@ -27,11 +27,19 @@ const userConfigSlice = createSlice({
|
|||
state.showRecoveryPhrasePrompt = false;
|
||||
},
|
||||
toggleMessageRequests: state => {
|
||||
state.messageRequests = !state.messageRequests;
|
||||
state.hideMessageRequests = !state.hideMessageRequests;
|
||||
},
|
||||
showMessageRequestBanner: state => {
|
||||
state.hideMessageRequests = false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const { actions, reducer } = userConfigSlice;
|
||||
export const { toggleAudioAutoplay, disableRecoveryPhrasePrompt, toggleMessageRequests } = actions;
|
||||
export const {
|
||||
toggleAudioAutoplay,
|
||||
disableRecoveryPhrasePrompt,
|
||||
toggleMessageRequests,
|
||||
showMessageRequestBanner,
|
||||
} = actions;
|
||||
export const userConfigReducer = reducer;
|
||||
|
|
|
@ -18,7 +18,7 @@ import { ConversationTypeEnum } from '../../models/conversation';
|
|||
import { LocalizerType } from '../../types/Util';
|
||||
import { ConversationHeaderTitleProps } from '../../components/conversation/ConversationHeader';
|
||||
import _ from 'lodash';
|
||||
import { getIsMessageRequestsEnabled } from './userConfig';
|
||||
import { getHideMessageRequestBanner } from './userConfig';
|
||||
import { ReplyingToMessageProps } from '../../components/conversation/composition/CompositionBox';
|
||||
import { MessageAttachmentSelectorProps } from '../../components/conversation/message/message-content/MessageAttachment';
|
||||
import { MessageAuthorSelectorProps } from '../../components/conversation/message/message-content/MessageAuthorText';
|
||||
|
@ -444,7 +444,7 @@ const _getConversationRequests = (
|
|||
|
||||
export const getConversationRequests = createSelector(
|
||||
getSortedConversations,
|
||||
getIsMessageRequestsEnabled,
|
||||
getHideMessageRequestBanner,
|
||||
_getConversationRequests
|
||||
);
|
||||
|
||||
|
@ -473,15 +473,10 @@ const _getPrivateContactsPubkeys = (
|
|||
*/
|
||||
export const getPrivateContactsPubkeys = createSelector(
|
||||
getSortedConversations,
|
||||
getIsMessageRequestsEnabled,
|
||||
_getPrivateContactsPubkeys
|
||||
);
|
||||
|
||||
export const getLeftPaneLists = createSelector(
|
||||
getSortedConversations,
|
||||
getIsMessageRequestsEnabled,
|
||||
_getLeftPaneLists
|
||||
);
|
||||
export const getLeftPaneLists = createSelector(getSortedConversations, _getLeftPaneLists);
|
||||
|
||||
export const getMe = createSelector(
|
||||
[getConversationLookup, getOurNumber],
|
||||
|
|
|
@ -14,7 +14,7 @@ export const getShowRecoveryPhrasePrompt = createSelector(
|
|||
(state: UserConfigState): boolean => state.showRecoveryPhrasePrompt
|
||||
);
|
||||
|
||||
export const getIsMessageRequestsEnabled = createSelector(
|
||||
export const getHideMessageRequestBanner = createSelector(
|
||||
getUserConfig,
|
||||
(state: UserConfigState): boolean => state.messageRequests
|
||||
(state: UserConfigState): boolean => state.hideMessageRequests
|
||||
);
|
||||
|
|
|
@ -50,7 +50,7 @@ export type LocalizerKeys =
|
|||
| 'viewMenuToggleDevTools'
|
||||
| 'fileSizeWarning'
|
||||
| 'openGroupURL'
|
||||
| 'messageRequestsDescription'
|
||||
| 'hideRequestBannerDescription'
|
||||
| 'hideMenuBarDescription'
|
||||
| 'search'
|
||||
| 'pickClosedGroupMember'
|
||||
|
@ -473,5 +473,5 @@ export type LocalizerKeys =
|
|||
| 'declineRequestMessage'
|
||||
| 'openMessageRequestInbox'
|
||||
| 'openMessageRequestInboxDescription'
|
||||
| 'alwaysShowMessageRequests'
|
||||
| 'hideRequestBanner'
|
||||
| 'reportIssue';
|
||||
|
|
Loading…
Reference in New Issue