mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
PendingMessageCache Done
This commit is contained in:
parent
193573aa67
commit
734debe841
3 changed files with 41 additions and 12 deletions
|
@ -27,6 +27,12 @@ import {
|
|||
import { SessionSpinner } from './SessionSpinner';
|
||||
import { joinChannelStateManager } from './LeftPaneChannelSection';
|
||||
|
||||
// HIJACKING BUTTON FOR TESTING
|
||||
import { PendingMessageCache } from '../../session/sending/PendingMessageCache';
|
||||
import { MessageQueue } from '../../session/sending';
|
||||
import { ExampleMessage } from '../../session/sending/MessageQueue';
|
||||
|
||||
|
||||
export interface Props {
|
||||
searchTerm: string;
|
||||
isSecondaryDevice: boolean;
|
||||
|
@ -45,6 +51,10 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
|
|||
private readonly updateSearchBound: (searchedString: string) => void;
|
||||
private readonly debouncedSearch: (searchTerm: string) => void;
|
||||
|
||||
// HIJACKED FOR TESTING
|
||||
private readonly messageQueue: any;
|
||||
private readonly pendingMessageCache: any;
|
||||
|
||||
public constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
|
@ -82,6 +92,11 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
|
|||
this.handleOnPasteSessionID = this.handleOnPasteSessionID.bind(this);
|
||||
this.handleMessageButtonClick = this.handleMessageButtonClick.bind(this);
|
||||
this.debouncedSearch = debounce(this.search.bind(this), 20);
|
||||
|
||||
|
||||
// HIJACKING FOR TESTING
|
||||
this.messageQueue = new MessageQueue();
|
||||
this.pendingMessageCache = new PendingMessageCache();
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
|
@ -97,7 +112,7 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
|
|||
if (conversationList !== undefined) {
|
||||
conversationList = conversationList.filter(
|
||||
conversation =>
|
||||
!conversation.isSecondary && !conversation.isPendingFriendRequest
|
||||
!conversation.isPendingFriendRequest && !conversation.isSecondary
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -361,12 +376,29 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
|
|||
);
|
||||
}
|
||||
|
||||
private handleToggleOverlay() {
|
||||
this.setState((state: any) => {
|
||||
return { showComposeView: !state.showComposeView };
|
||||
});
|
||||
// empty our generalized searchedString (one for the whole app)
|
||||
this.updateSearch('');
|
||||
private async handleToggleOverlay() {
|
||||
// HIJACKING BUTTON FOR TESTING
|
||||
console.log('[vince] pendingMessageCache:', this.pendingMessageCache);
|
||||
|
||||
const pubkey = window.textsecure.storage.user.getNumber();
|
||||
const exampleMessage = new ExampleMessage();
|
||||
|
||||
console.log('[vince] exampleMessage:', exampleMessage);
|
||||
|
||||
const devices = this.pendingMessageCache.getPendingDevices();
|
||||
console.log('[vince] devices:', devices);
|
||||
|
||||
if ($('.session-search-input input').val()) {
|
||||
this.pendingMessageCache.removePendingMessageByIdentifier(exampleMessage.identifier);
|
||||
} else {
|
||||
this.pendingMessageCache.addPendingMessage(pubkey, exampleMessage);
|
||||
}
|
||||
|
||||
// this.setState((state: any) => {
|
||||
// return { showComposeView: !state.showComposeView };
|
||||
// });
|
||||
// // empty our generalized searchedString (one for the whole app)
|
||||
// this.updateSearch('');
|
||||
}
|
||||
|
||||
private handleOnPasteSessionID(value: string) {
|
||||
|
@ -408,4 +440,4 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
|
|||
const serverURL = window.CONSTANTS.DEFAULT_PUBLIC_CHAT_URL;
|
||||
joinChannelStateManager(this, serverURL, this.handleCloseOnboarding);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import { ContentMessage } from '../ContentMessage';
|
||||
import { SignalService } from '../../../../../protobuf';
|
||||
|
||||
export class SyncMessage extends ContentMessage {
|
||||
export abstract class SyncMessage extends ContentMessage {
|
||||
public ttl(): number {
|
||||
return this.getDefaultTTL();
|
||||
}
|
||||
|
|
|
@ -3,9 +3,6 @@ import { RawMessage } from '../types/RawMessage';
|
|||
import { ContentMessage } from '../messages/outgoing';
|
||||
import * as MessageUtils from '../utils';
|
||||
import { PubKey } from '../types';
|
||||
import logger from 'redux-logger';
|
||||
|
||||
// TODO: We should be able to import functions straight from the db here without going through the window object
|
||||
|
||||
// This is an abstraction for storing pending messages.
|
||||
// Ideally we want to store pending messages in the database so that
|
||||
|
|
Loading…
Reference in a new issue