Tighten merge

pull/1157/head
Vincent 5 years ago
parent 4fd19126ec
commit c3f3f30911

@ -415,4 +415,4 @@ export function getMessagesWithFileAttachments(
// Sender Keys
export function getSenderKeys(groupId: any, senderIdentity: any): Promise<any>;
export function createOrUpdateSenderKeys(data: any): Promise<void>;
export function createOrUpdateSenderKeys(data: any): Promise<void>;

@ -3,7 +3,7 @@
/* global window: false */
const path = require('path');
const electron = require('electron');
const Data = require('./js/modules/data')
const Data = require('./js/modules/data');
const { webFrame } = electron;
const semver = require('semver');
@ -71,31 +71,18 @@ window.isBeforeVersion = (toCheck, baseVersion) => {
}
};
// eslint-disable-next-line func-names
window.CONSTANTS = new function() {
this.MAX_LOGIN_TRIES = 3;
this.MAX_PASSWORD_LENGTH = 64;
this.MAX_USERNAME_LENGTH = 20;
this.MAX_GROUP_NAME_LENGTH = 64;
this.DEFAULT_PUBLIC_CHAT_URL = appConfig.get('defaultPublicChatServer');
this.MAX_CONNECTION_DURATION = 5000;
this.MAX_MESSAGE_BODY_LENGTH = 64 * 1024;
window.CONSTANTS = {
MAX_LOGIN_TRIES: 3,
MAX_PASSWORD_LENGTH: 64,
MAX_USERNAME_LENGTH: 20,
MAX_GROUP_NAME_LENGTH: 64,
DEFAULT_PUBLIC_CHAT_URL: appConfig.get('defaultPublicChatServer'),
MAX_CONNECTION_DURATION: 5000,
MAX_MESSAGE_BODY_LENGTH: 64 * 1024,
// Limited due to the proof-of-work requirement
this.SMALL_GROUP_SIZE_LIMIT = 10;
// Number of seconds to turn on notifications after reconnect/start of app
this.NOTIFICATION_ENABLE_TIMEOUT_SECONDS = 10;
this.SESSION_ID_LENGTH = 66;
// Loki Name System (LNS)
this.LNS_DEFAULT_LOOKUP_TIMEOUT = 6000;
// Minimum nodes version for LNS lookup
this.LNS_CAPABLE_NODES_VERSION = '2.0.3';
this.LNS_MAX_LENGTH = 64;
// Conforms to naming rules here
// https://loki.network/2020/03/25/loki-name-system-the-facts/
this.LNS_REGEX = `^[a-zA-Z0-9_]([a-zA-Z0-9_-]{0,${this.LNS_MAX_LENGTH -
2}}[a-zA-Z0-9_]){0,1}$`;
}();
SMALL_GROUP_SIZE_LIMIT: 10,
NOTIFICATION_ENABLE_TIMEOUT_SECONDS: 10, // number of seconds to turn on notifications after reconnect/start of app
};
window.versionInfo = {
environment: window.getEnvironment(),
@ -344,7 +331,6 @@ window.LokiMessageAPI = require('./js/modules/loki_message_api');
if (process.env.USE_STUBBED_NETWORK) {
window.StubMessageAPI = require('./integration_test/stubs/stub_message_api');
window.StubAppDotNetApi = require('./integration_test/stubs/stub_app_dot_net_api');
window.StubLokiSnodeAPI = require('./integration_test/stubs/stub_loki_snode_api');
}
window.LokiPublicChatAPI = require('./js/modules/loki_public_chat_api');
@ -432,8 +418,6 @@ window.lokiFeatureFlags = {
privateGroupChats: true,
useSnodeProxy: !process.env.USE_STUBBED_NETWORK,
useOnionRequests: true,
useFileOnionRequests: false,
enableSenderKeys: false,
onionRequestHops: 1,
};
@ -460,7 +444,7 @@ if (
};
/* eslint-enable global-require, import/no-extraneous-dependencies */
window.lokiFeatureFlags = {};
window.lokiSnodeAPI = new window.StubLokiSnodeAPI(); // no need stub out each function here
window.lokiSnodeAPI = {}; // no need stub out each function here
}
if (config.environment.includes('test-integration')) {
window.lokiFeatureFlags = {
@ -468,4 +452,4 @@ if (config.environment.includes('test-integration')) {
privateGroupChats: true,
useSnodeProxy: !process.env.USE_STUBBED_NETWORK,
};
}
}

@ -27,12 +27,6 @@ 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;
@ -51,10 +45,6 @@ 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);
@ -92,11 +82,6 @@ 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() {
@ -112,7 +97,7 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
if (conversationList !== undefined) {
conversationList = conversationList.filter(
conversation =>
!conversation.isPendingFriendRequest && !conversation.isSecondary
!conversation.isSecondary && !conversation.isPendingFriendRequest
);
}
@ -376,29 +361,12 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
);
}
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 handleToggleOverlay() {
this.setState((state: any) => {
return { showComposeView: !state.showComposeView };
});
// empty our generalized searchedString (one for the whole app)
this.updateSearch('');
}
private handleOnPasteSessionID(value: string) {
@ -440,4 +408,4 @@ export class LeftPaneMessageSection extends React.Component<Props, any> {
const serverURL = window.CONSTANTS.DEFAULT_PUBLIC_CHAT_URL;
joinChannelStateManager(this, serverURL, this.handleCloseOnboarding);
}
}
}

Loading…
Cancel
Save