Migrate to SQLCipher for messages/cache

Quite a few other fixes, including:
  - Sending to contact with no avatar yet (not synced from mobile)
  - Left pane doesn't update quickly or at all on new message
  - Left pane doesn't show sent or error status

Also:
 - Contributing.md: Ensure set of linux dev dependencies is complete
This commit is contained in:
Scott Nonnenberg 2018-07-26 18:13:56 -07:00
parent fc461c82ce
commit 3105b77475
29 changed files with 2006 additions and 716 deletions

View file

@ -3,25 +3,34 @@ const { isObject, isString } = require('lodash');
const ITEMS_STORE_NAME = 'items';
const LAST_PROCESSED_INDEX_KEY = 'attachmentMigration_lastProcessedIndex';
const IS_MIGRATION_COMPLETE_KEY = 'attachmentMigration_isComplete';
const MESSAGE_LAST_INDEX_KEY = 'sqlMigration_messageLastIndex';
const UNPROCESSED_LAST_INDEX_KEY = 'sqlMigration_unprocessedLastIndex';
// Public API
exports.READ_RECEIPT_CONFIGURATION_SYNC = 'read-receipt-configuration-sync';
exports.getAttachmentMigrationLastProcessedIndex = connection =>
exports._getItem(connection, LAST_PROCESSED_INDEX_KEY);
exports.setAttachmentMigrationLastProcessedIndex = (connection, value) =>
exports._setItem(connection, LAST_PROCESSED_INDEX_KEY, value);
exports.deleteAttachmentMigrationLastProcessedIndex = connection =>
exports._deleteItem(connection, LAST_PROCESSED_INDEX_KEY);
exports.isAttachmentMigrationComplete = async connection =>
Boolean(await exports._getItem(connection, IS_MIGRATION_COMPLETE_KEY));
exports.markAttachmentMigrationComplete = connection =>
exports._setItem(connection, IS_MIGRATION_COMPLETE_KEY, true);
exports.getMessageExportLastIndex = connection =>
exports._getItem(connection, MESSAGE_LAST_INDEX_KEY);
exports.setMessageExportLastIndex = (connection, lastIndex) =>
exports._setItem(connection, MESSAGE_LAST_INDEX_KEY, lastIndex);
exports.getUnprocessedExportLastIndex = connection =>
exports._getItem(connection, UNPROCESSED_LAST_INDEX_KEY);
exports.setUnprocessedExportLastIndex = (connection, lastIndex) =>
exports._setItem(connection, UNPROCESSED_LAST_INDEX_KEY, lastIndex);
// Private API
exports._getItem = (connection, key) => {
if (!isObject(connection)) {