cleanup unused code

pull/1404/head
Audric Ackermann 4 years ago
parent cf2ddc64d8
commit cf25e89a14

@ -258,7 +258,6 @@
getThemeSetting: () => storage.get('theme-setting', 'light'), getThemeSetting: () => storage.get('theme-setting', 'light'),
setThemeSetting: value => { setThemeSetting: value => {
storage.put('theme-setting', value); storage.put('theme-setting', value);
onChangeTheme();
}, },
getHideMenuBar: () => storage.get('hide-menu-bar'), getHideMenuBar: () => storage.get('hide-menu-bar'),
setHideMenuBar: value => { setHideMenuBar: value => {
@ -1171,7 +1170,6 @@
); );
messageReceiver.addEventListener('empty', onEmpty); messageReceiver.addEventListener('empty', onEmpty);
messageReceiver.addEventListener('reconnect', onReconnect); messageReceiver.addEventListener('reconnect', onReconnect);
messageReceiver.addEventListener('progress', onProgress);
messageReceiver.addEventListener('configuration', onConfiguration); messageReceiver.addEventListener('configuration', onConfiguration);
// messageReceiver.addEventListener('typing', onTyping); // messageReceiver.addEventListener('typing', onTyping);
@ -1198,7 +1196,6 @@
const hasThemeSetting = Boolean(storage.get('theme-setting')); const hasThemeSetting = Boolean(storage.get('theme-setting'));
if (!hasThemeSetting && textsecure.storage.get('userAgent') === 'OWI') { if (!hasThemeSetting && textsecure.storage.get('userAgent') === 'OWI') {
storage.put('theme-setting', 'ios'); storage.put('theme-setting', 'ios');
onChangeTheme();
} }
const syncRequest = new textsecure.SyncRequest( const syncRequest = new textsecure.SyncRequest(
textsecure.messaging, textsecure.messaging,
@ -1244,12 +1241,6 @@
}); });
} }
function onChangeTheme() {
// const view = window.owsDesktopApp.appView;
// if (view) {
// view.applyTheme();
// }
}
function onEmpty() { function onEmpty() {
initialLoadComplete = true; initialLoadComplete = true;
@ -1278,15 +1269,6 @@
Whisper.Notifications.enable(); Whisper.Notifications.enable();
}, window.CONSTANTS.NOTIFICATION_ENABLE_TIMEOUT_SECONDS * 1000); }, window.CONSTANTS.NOTIFICATION_ENABLE_TIMEOUT_SECONDS * 1000);
} }
function onProgress(ev) {
const { count } = ev;
window.log.info(`onProgress: Message count is ${count}`);
// const view = window.owsDesktopApp.appView;
// if (view) {
// view.onProgress(count);
// }
}
function onConfiguration(ev) { function onConfiguration(ev) {
const { configuration } = ev; const { configuration } = ev;
const { const {

@ -123,7 +123,6 @@
return Promise.resolve(); return Promise.resolve();
}, },
onEmpty() {}, onEmpty() {},
onProgress() {},
showEditProfileDialog(options) { showEditProfileDialog(options) {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
options.theme = this.getThemeObject(); options.theme = this.getThemeObject();

@ -119,15 +119,6 @@ MessageReceiver.prototype.extend({
// This promise will resolve when there are no more messages to be processed. // This promise will resolve when there are no more messages to be processed.
return Promise.all(incoming); return Promise.all(incoming);
}, },
updateProgress(count) {
// count by 10s
if (count % 10 !== 0) {
return;
}
const ev = new Event('progress');
ev.count = count;
this.dispatchEvent(ev);
},
getStatus() { getStatus() {
if (this.hasConnected) { if (this.hasConnected) {
return WebSocket.CLOSED; return WebSocket.CLOSED;

@ -1138,7 +1138,7 @@ async function sessionGenerateKeyPair(event, seed) {
ed25519KeyPair, ed25519KeyPair,
}; };
// null as first parameter to indivate no error // null as first parameter to indicate no error
event.reply('generate-keypair-seed-response', null, x25519KeyPair); event.reply('generate-keypair-seed-response', null, x25519KeyPair);
} catch (err) { } catch (err) {
event.reply('generate-keypair-seed-response', err); event.reply('generate-keypair-seed-response', err);

@ -14,6 +14,7 @@ const { app } = electron.remote;
const { clipboard } = electron; const { clipboard } = electron;
window.PROTO_ROOT = 'protos'; window.PROTO_ROOT = 'protos';
const appConfig = require('./app/config'); const appConfig = require('./app/config');
const config = require('url').parse(window.location.toString(), true).query; const config = require('url').parse(window.location.toString(), true).query;

@ -603,9 +603,6 @@ export async function handleMessageEvent(event: MessageEvent): Promise<void> {
? ConversationType.GROUP ? ConversationType.GROUP
: ConversationType.PRIVATE; : ConversationType.PRIVATE;
// MAXIM: So id is actually conversationId
const id = isIncoming ? source : destination;
const { const {
PROFILE_KEY_UPDATE, PROFILE_KEY_UPDATE,
SESSION_RESTORE, SESSION_RESTORE,
@ -613,9 +610,14 @@ export async function handleMessageEvent(event: MessageEvent): Promise<void> {
// tslint:disable-next-line: no-bitwise // tslint:disable-next-line: no-bitwise
const isProfileUpdate = Boolean(message.flags & PROFILE_KEY_UPDATE); const isProfileUpdate = Boolean(message.flags & PROFILE_KEY_UPDATE);
let conversationId = isIncoming ? source : destination;
if (isProfileUpdate) { if (isProfileUpdate) {
await handleProfileUpdate(message.profileKey, id, type, isIncoming); await handleProfileUpdate(
message.profileKey,
conversationId,
type,
isIncoming
);
confirm(); confirm();
return; return;
} }
@ -651,7 +653,6 @@ export async function handleMessageEvent(event: MessageEvent): Promise<void> {
// - primarySource if it is an incoming DM message, // - primarySource if it is an incoming DM message,
// - destination if it is an outgoing message, // - destination if it is an outgoing message,
// - group.id if it is a group message // - group.id if it is a group message
let conversationId = id;
if (isGroupMessage) { if (isGroupMessage) {
// remove the prefix from the source object so this is correct for all other // remove the prefix from the source object so this is correct for all other
message.group.id = message.group.id.replace( message.group.id = message.group.id.replace(

@ -69,9 +69,6 @@ class EnvelopeQueue {
} }
private cleanup(promise: Promise<any>) { private cleanup(promise: Promise<any>) {
// TODO: enable this?
// this.updateProgress(this.count);
// We want to clear out the promise chain whenever possible because it could // We want to clear out the promise chain whenever possible because it could
// lead to large memory usage over time: // lead to large memory usage over time:
// https://github.com/nodejs/node/issues/6673#issuecomment-244331609 // https://github.com/nodejs/node/issues/6673#issuecomment-244331609

1
ts/window.d.ts vendored

@ -19,6 +19,7 @@ import { any } from 'underscore';
import { Store } from 'redux'; import { Store } from 'redux';
import { MessageController } from './session/messages/MessageController'; import { MessageController } from './session/messages/MessageController';
import { DefaultTheme } from 'styled-components'; import { DefaultTheme } from 'styled-components';
/* /*
We declare window stuff here instead of global.d.ts because we are importing other declarations. We declare window stuff here instead of global.d.ts because we are importing other declarations.
If you import anything in global.d.ts, the type system won't work correctly. If you import anything in global.d.ts, the type system won't work correctly.

Loading…
Cancel
Save