diff --git a/preload.js b/preload.js index acdffba11..19dad8065 100644 --- a/preload.js +++ b/preload.js @@ -281,7 +281,7 @@ window.setSettingValue = (settingID, value) => { window.storage.put(settingID, value); - // FIXME - This should be called in the settings object in + // FIXME - This should be called in the settings object in // SessionSettings if (settingID === 'zoom-factor-setting') { window.updateZoomFactor(); @@ -293,7 +293,8 @@ window.getMessageTTL = () => window.storage.get('message-ttl', 24); // Media Permissions window.getMediaPermissions = () => ipc.sendSync('get-media-permissions'); -window.setMediaPermissions = value => ipc.send('set-media-permissions', !!value); +window.setMediaPermissions = value => + ipc.send('set-media-permissions', !!value); // Auto update setting window.getAutoUpdateEnabled = () => ipc.sendSync('get-auto-update-setting'); @@ -442,7 +443,7 @@ window.pubkeyPattern = /@[a-fA-F0-9]{64,66}\b/g; window.lokiFeatureFlags = { multiDeviceUnpairing: true, privateGroupChats: true, - useSnodeProxy: !process.env.USE_STUBBED_NETWORK, + useSnodeProxy: false, //!process.env.USE_STUBBED_NETWORK, useSealedSender: true, useOnionRequests: false, }; @@ -485,4 +486,4 @@ if (config.environment.includes('test-integration')) { privateGroupChats: true, useSnodeProxy: !process.env.USE_STUBBED_NETWORK, }; -} \ No newline at end of file +} diff --git a/ts/components/session/conversation/SessionConversation.tsx b/ts/components/session/conversation/SessionConversation.tsx index 9dcc70e5d..85260dbba 100644 --- a/ts/components/session/conversation/SessionConversation.tsx +++ b/ts/components/session/conversation/SessionConversation.tsx @@ -15,6 +15,7 @@ import { getTimestamp } from './SessionConversationManager'; import { SessionScrollButton } from '../SessionScrollButton'; import { SessionGroupSettings } from './SessionGroupSettings'; +import { ResetSessionNotification } from '../../conversation/ResetSessionNotification'; interface State { @@ -76,8 +77,6 @@ export class SessionConversation extends React.Component { this.scrollToBottom = this.scrollToBottom.bind(this); this.renderMessage = this.renderMessage.bind(this); - this.renderTimerNotification = this.renderTimerNotification.bind(this); - this.renderFriendRequest = this.renderFriendRequest.bind(this); // Group settings panel this.toggleGroupSettingsPane = this.toggleGroupSettingsPane.bind(this); @@ -231,20 +230,24 @@ export class SessionConversation extends React.Component { <>{ messages.map((message: any) => { const messageProps = message.propsForMessage; - const timerProps = message.propsForTimerNotification; - const friendRequestProps = message.propsForFriendRequest; + const quoteProps = message.propsForQuote; + + const timerProps = message.propsForTimerNotification && {i18n: window.i18n, ...message.propsForTimerNotification}; + const friendRequestProps = message.propsForFriendRequest && {i18n: window.i18n, ...message.propsForFriendRequest}; + const resetSessionProps = message.propsForResetSessionNotification && {i18n: window.i18n, ...message.propsForResetSessionNotification}; + const attachmentProps = message.propsForAttachment; const groupNotificationProps = message.propsForGroupNotification; - const quoteProps = message.propsForQuote; let item; // firstMessageOfSeries tells us to render the avatar only for the first message // in a series of messages from the same user - item = messageProps ? this.renderMessage(messageProps, message.firstMessageOfSeries) : item; - item = timerProps ? this.renderTimerNotification(timerProps) : item; - item = quoteProps ? this.renderMessage(timerProps, message.firstMessageOfSeries, quoteProps) : item; - item = friendRequestProps - ? this.renderFriendRequest(friendRequestProps): item; + item = messageProps ? this.renderMessage(messageProps, message.firstMessageOfSeries) : item; + item = quoteProps ? this.renderMessage(timerProps, message.firstMessageOfSeries, quoteProps) : item; + + item = timerProps ? : item; + item = friendRequestProps ? : item; + item = resetSessionProps ? : item; // item = attachmentProps ? this.renderMessage(timerProps) : item; return item; @@ -268,7 +271,6 @@ export class SessionConversation extends React.Component { isFriend={headerProps.isFriend} i18n={window.i18n} isGroup={headerProps.isGroup} - isArchived={headerProps.isArchived} isPublic={headerProps.isPublic} isRss={headerProps.isRss} amMod={headerProps.amMod} @@ -287,7 +289,6 @@ export class SessionConversation extends React.Component { onResetSession={headerProps.onResetSession} onCloseOverlay={headerProps.onCloseOverlay} onDeleteSelectedMessages={headerProps.onDeleteSelectedMessages} - onArchive={headerProps.onArchive} onMoveToInbox={headerProps.onMoveToInbox} onShowSafetyNumber={headerProps.onShowSafetyNumber} onShowAllMedia={headerProps.onShowAllMedia} @@ -317,7 +318,8 @@ export class SessionConversation extends React.Component { messageProps.firstMessageOfSeries = firstMessageOfSeries; messageProps.onSelectMessage = (messageId: string) => { this.selectMessage(messageId); - } + }; + messageProps.quote = quoteProps || undefined; return ( @@ -326,23 +328,6 @@ export class SessionConversation extends React.Component { } - public renderTimerNotification(timerProps: any) { - timerProps.i18n = window.i18n; - - return ( - - ); - } - - public renderFriendRequest(friendRequestProps: any) { - friendRequestProps.i18n = window.i18n; - - return ( - - ); - } - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~ GETTER METHODS ~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -393,6 +378,8 @@ export class SessionConversation extends React.Component { } }); + console.log(`[header] messages: `, messages); + return { newTopMessage, previousTopMessage }; } @@ -422,7 +409,6 @@ export class SessionConversation extends React.Component { isBlocked: conversation.isBlocked(), isGroup: !conversation.isPrivate(), isOnline: conversation.isOnline(), - isArchived: conversation.get('isArchived'), isPublic: conversation.isPublic(), isRss: conversation.isRss(), amMod: conversation.isModerator( @@ -446,7 +432,7 @@ export class SessionConversation extends React.Component { onCloseOverlay: () => conversation.resetMessageSelection(), onDeleteContact: () => conversation.deleteContact(), onResetSession: () => { - this.resetSelection(); + conversation.endSession(); }, // These are view only and don't update the Conversation model, so they @@ -484,10 +470,6 @@ export class SessionConversation extends React.Component { onCopyPublicKey: () => { conversation.copyPublicKey(); }, - onArchive: () => { - conversation.unload('archive'); - conversation.setArchived(true); - }, onMoveToInbox: () => { conversation.setArchived(false); },