Remove unused settings module
This commit is contained in:
parent
06dec4fec1
commit
17389f4e01
2 changed files with 1 additions and 102 deletions
|
@ -1,99 +0,0 @@
|
||||||
// Copyright 2018-2020 Signal Messenger, LLC
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
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 MESSAGE_COUNT_KEY = 'sqlMigration_messageCount';
|
|
||||||
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.getMessageExportCount = connection =>
|
|
||||||
exports._getItem(connection, MESSAGE_COUNT_KEY);
|
|
||||||
exports.setMessageExportCount = (connection, count) =>
|
|
||||||
exports._setItem(connection, MESSAGE_COUNT_KEY, count);
|
|
||||||
|
|
||||||
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)) {
|
|
||||||
throw new TypeError("'connection' is required");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isString(key)) {
|
|
||||||
throw new TypeError("'key' must be a string");
|
|
||||||
}
|
|
||||||
|
|
||||||
const transaction = connection.transaction(ITEMS_STORE_NAME, 'readonly');
|
|
||||||
const itemsStore = transaction.objectStore(ITEMS_STORE_NAME);
|
|
||||||
const request = itemsStore.get(key);
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
request.onerror = event => reject(event.target.error);
|
|
||||||
|
|
||||||
request.onsuccess = event =>
|
|
||||||
resolve(event.target.result ? event.target.result.value : null);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports._setItem = (connection, key, value) => {
|
|
||||||
if (!isObject(connection)) {
|
|
||||||
throw new TypeError("'connection' is required");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isString(key)) {
|
|
||||||
throw new TypeError("'key' must be a string");
|
|
||||||
}
|
|
||||||
|
|
||||||
const transaction = connection.transaction(ITEMS_STORE_NAME, 'readwrite');
|
|
||||||
const itemsStore = transaction.objectStore(ITEMS_STORE_NAME);
|
|
||||||
const request = itemsStore.put({ id: key, value }, key);
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
request.onerror = event => reject(event.target.error);
|
|
||||||
|
|
||||||
request.onsuccess = () => resolve();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports._deleteItem = (connection, key) => {
|
|
||||||
if (!isObject(connection)) {
|
|
||||||
throw new TypeError("'connection' is required");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isString(key)) {
|
|
||||||
throw new TypeError("'key' must be a string");
|
|
||||||
}
|
|
||||||
|
|
||||||
const transaction = connection.transaction(ITEMS_STORE_NAME, 'readwrite');
|
|
||||||
const itemsStore = transaction.objectStore(ITEMS_STORE_NAME);
|
|
||||||
const request = itemsStore.delete(key);
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
request.onerror = event => reject(event.target.error);
|
|
||||||
|
|
||||||
request.onsuccess = () => resolve();
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2018-2021 Signal Messenger, LLC
|
// Copyright 2018-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
// The idea with this file is to make it webpackable for the style guide
|
// The idea with this file is to make it webpackable for the style guide
|
||||||
|
@ -16,7 +16,6 @@ const GroupChange = require('../../ts/groupChange');
|
||||||
const IndexedDB = require('./indexeddb');
|
const IndexedDB = require('./indexeddb');
|
||||||
const OS = require('../../ts/OS');
|
const OS = require('../../ts/OS');
|
||||||
const Stickers = require('../../ts/types/Stickers');
|
const Stickers = require('../../ts/types/Stickers');
|
||||||
const Settings = require('./settings');
|
|
||||||
const RemoteConfig = require('../../ts/RemoteConfig');
|
const RemoteConfig = require('../../ts/RemoteConfig');
|
||||||
const Util = require('../../ts/util');
|
const Util = require('../../ts/util');
|
||||||
|
|
||||||
|
@ -431,7 +430,6 @@ exports.setup = (options = {}) => {
|
||||||
Migrations,
|
Migrations,
|
||||||
OS,
|
OS,
|
||||||
RemoteConfig,
|
RemoteConfig,
|
||||||
Settings,
|
|
||||||
Services,
|
Services,
|
||||||
State,
|
State,
|
||||||
Stickers,
|
Stickers,
|
||||||
|
|
Loading…
Reference in a new issue