Session resetting

pull/1102/head
Vincent 5 years ago
parent d09dc92e3d
commit 494e1222a6

@ -293,7 +293,8 @@ window.getMessageTTL = () => window.storage.get('message-ttl', 24);
// Media Permissions // Media Permissions
window.getMediaPermissions = () => ipc.sendSync('get-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 // Auto update setting
window.getAutoUpdateEnabled = () => ipc.sendSync('get-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 = { window.lokiFeatureFlags = {
multiDeviceUnpairing: true, multiDeviceUnpairing: true,
privateGroupChats: true, privateGroupChats: true,
useSnodeProxy: !process.env.USE_STUBBED_NETWORK, useSnodeProxy: false, //!process.env.USE_STUBBED_NETWORK,
useSealedSender: true, useSealedSender: true,
useOnionRequests: false, useOnionRequests: false,
}; };

@ -15,6 +15,7 @@ import { getTimestamp } from './SessionConversationManager';
import { SessionScrollButton } from '../SessionScrollButton'; import { SessionScrollButton } from '../SessionScrollButton';
import { SessionGroupSettings } from './SessionGroupSettings'; import { SessionGroupSettings } from './SessionGroupSettings';
import { ResetSessionNotification } from '../../conversation/ResetSessionNotification';
interface State { interface State {
@ -76,8 +77,6 @@ export class SessionConversation extends React.Component<any, State> {
this.scrollToBottom = this.scrollToBottom.bind(this); this.scrollToBottom = this.scrollToBottom.bind(this);
this.renderMessage = this.renderMessage.bind(this); this.renderMessage = this.renderMessage.bind(this);
this.renderTimerNotification = this.renderTimerNotification.bind(this);
this.renderFriendRequest = this.renderFriendRequest.bind(this);
// Group settings panel // Group settings panel
this.toggleGroupSettingsPane = this.toggleGroupSettingsPane.bind(this); this.toggleGroupSettingsPane = this.toggleGroupSettingsPane.bind(this);
@ -231,20 +230,24 @@ export class SessionConversation extends React.Component<any, State> {
<>{ <>{
messages.map((message: any) => { messages.map((message: any) => {
const messageProps = message.propsForMessage; const messageProps = message.propsForMessage;
const timerProps = message.propsForTimerNotification; const quoteProps = message.propsForQuote;
const friendRequestProps = message.propsForFriendRequest;
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 attachmentProps = message.propsForAttachment;
const groupNotificationProps = message.propsForGroupNotification; const groupNotificationProps = message.propsForGroupNotification;
const quoteProps = message.propsForQuote;
let item; let item;
// firstMessageOfSeries tells us to render the avatar only for the first message // firstMessageOfSeries tells us to render the avatar only for the first message
// in a series of messages from the same user // in a series of messages from the same user
item = messageProps ? this.renderMessage(messageProps, message.firstMessageOfSeries) : item; item = messageProps ? this.renderMessage(messageProps, message.firstMessageOfSeries) : item;
item = timerProps ? this.renderTimerNotification(timerProps) : item;
item = quoteProps ? this.renderMessage(timerProps, message.firstMessageOfSeries, quoteProps) : item; item = quoteProps ? this.renderMessage(timerProps, message.firstMessageOfSeries, quoteProps) : item;
item = friendRequestProps
? this.renderFriendRequest(friendRequestProps): item; item = timerProps ? <TimerNotification {...timerProps} /> : item;
item = friendRequestProps ? <FriendRequest {...friendRequestProps} /> : item;
item = resetSessionProps ? <ResetSessionNotification {...resetSessionProps} /> : item;
// item = attachmentProps ? this.renderMessage(timerProps) : item; // item = attachmentProps ? this.renderMessage(timerProps) : item;
return item; return item;
@ -268,7 +271,6 @@ export class SessionConversation extends React.Component<any, State> {
isFriend={headerProps.isFriend} isFriend={headerProps.isFriend}
i18n={window.i18n} i18n={window.i18n}
isGroup={headerProps.isGroup} isGroup={headerProps.isGroup}
isArchived={headerProps.isArchived}
isPublic={headerProps.isPublic} isPublic={headerProps.isPublic}
isRss={headerProps.isRss} isRss={headerProps.isRss}
amMod={headerProps.amMod} amMod={headerProps.amMod}
@ -287,7 +289,6 @@ export class SessionConversation extends React.Component<any, State> {
onResetSession={headerProps.onResetSession} onResetSession={headerProps.onResetSession}
onCloseOverlay={headerProps.onCloseOverlay} onCloseOverlay={headerProps.onCloseOverlay}
onDeleteSelectedMessages={headerProps.onDeleteSelectedMessages} onDeleteSelectedMessages={headerProps.onDeleteSelectedMessages}
onArchive={headerProps.onArchive}
onMoveToInbox={headerProps.onMoveToInbox} onMoveToInbox={headerProps.onMoveToInbox}
onShowSafetyNumber={headerProps.onShowSafetyNumber} onShowSafetyNumber={headerProps.onShowSafetyNumber}
onShowAllMedia={headerProps.onShowAllMedia} onShowAllMedia={headerProps.onShowAllMedia}
@ -317,7 +318,8 @@ export class SessionConversation extends React.Component<any, State> {
messageProps.firstMessageOfSeries = firstMessageOfSeries; messageProps.firstMessageOfSeries = firstMessageOfSeries;
messageProps.onSelectMessage = (messageId: string) => { messageProps.onSelectMessage = (messageId: string) => {
this.selectMessage(messageId); this.selectMessage(messageId);
} };
messageProps.quote = quoteProps || undefined; messageProps.quote = quoteProps || undefined;
return ( return (
@ -326,23 +328,6 @@ export class SessionConversation extends React.Component<any, State> {
} }
public renderTimerNotification(timerProps: any) {
timerProps.i18n = window.i18n;
return (
<TimerNotification {...timerProps} />
);
}
public renderFriendRequest(friendRequestProps: any) {
friendRequestProps.i18n = window.i18n;
return (
<FriendRequest {...friendRequestProps} />
);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~ GETTER METHODS ~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~ GETTER METHODS ~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -393,6 +378,8 @@ export class SessionConversation extends React.Component<any, State> {
} }
}); });
console.log(`[header] messages: `, messages);
return { newTopMessage, previousTopMessage }; return { newTopMessage, previousTopMessage };
} }
@ -422,7 +409,6 @@ export class SessionConversation extends React.Component<any, State> {
isBlocked: conversation.isBlocked(), isBlocked: conversation.isBlocked(),
isGroup: !conversation.isPrivate(), isGroup: !conversation.isPrivate(),
isOnline: conversation.isOnline(), isOnline: conversation.isOnline(),
isArchived: conversation.get('isArchived'),
isPublic: conversation.isPublic(), isPublic: conversation.isPublic(),
isRss: conversation.isRss(), isRss: conversation.isRss(),
amMod: conversation.isModerator( amMod: conversation.isModerator(
@ -446,7 +432,7 @@ export class SessionConversation extends React.Component<any, State> {
onCloseOverlay: () => conversation.resetMessageSelection(), onCloseOverlay: () => conversation.resetMessageSelection(),
onDeleteContact: () => conversation.deleteContact(), onDeleteContact: () => conversation.deleteContact(),
onResetSession: () => { onResetSession: () => {
this.resetSelection(); conversation.endSession();
}, },
// These are view only and don't update the Conversation model, so they // These are view only and don't update the Conversation model, so they
@ -484,10 +470,6 @@ export class SessionConversation extends React.Component<any, State> {
onCopyPublicKey: () => { onCopyPublicKey: () => {
conversation.copyPublicKey(); conversation.copyPublicKey();
}, },
onArchive: () => {
conversation.unload('archive');
conversation.setArchived(true);
},
onMoveToInbox: () => { onMoveToInbox: () => {
conversation.setArchived(false); conversation.setArchived(false);
}, },

Loading…
Cancel
Save