partial raw messages

pull/1163/head
Vincent 6 years ago
parent 392c201a13
commit f0ba4fa276

@ -2,7 +2,7 @@ import {
createOrUpdateItem, createOrUpdateItem,
getItemById, getItemById,
} from '../../../js/modules/data'; } from '../../../js/modules/data';
import { BareRawMessage, RawMessage } from '../types/RawMessage'; import { PartialRawMessage, RawMessage } from '../types/RawMessage';
import { ContentMessage } from '../messages/outgoing'; import { ContentMessage } from '../messages/outgoing';
import { PubKey } from '../types'; import { PubKey } from '../types';
import * as MessageUtils from '../utils'; import * as MessageUtils from '../utils';
@ -107,11 +107,11 @@ export class PendingMessageCache {
return []; return [];
} }
const barePending = JSON.parse(String(data.value)) as Array<BareRawMessage>; const barePending = JSON.parse(String(data.value)) as Array<PartialRawMessage>;
// Rebuild plainTextBuffer // Rebuild plainTextBuffer
// tslint:disable-next-line: no-unnecessary-local-variable // tslint:disable-next-line: no-unnecessary-local-variable
const pending = barePending.map((message: BareRawMessage) => { const pending = barePending.map((message: PartialRawMessage) => {
const rebuiltMessage = { ...message }; const rebuiltMessage = { ...message };
// From Array<number> to ArrayBuffer // From Array<number> to ArrayBuffer

@ -11,7 +11,8 @@ export interface RawMessage {
encryption: EncryptionType; encryption: EncryptionType;
} }
export interface BareRawMessage { // For building RawMessages from JSON
export interface PartialRawMessage {
identifier: string; identifier: string;
plainTextBuffer: any; plainTextBuffer: any;
timestamp: number; timestamp: number;

Loading…
Cancel
Save